/* =====================================================================
   EventApp – Design im Stil von iOS (Apple Human Interface Guidelines)
   Systemschrift, gruppierte Listen, Schalter, Tab-Leiste, Hell/Dunkel.
   ===================================================================== */

:root {
    color-scheme: light dark;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text",
            "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;

    /* iOS-Systemfarben (hell) */
    --bg: #f2f2f7;              /* systemGroupedBackground */
    --surface: #ffffff;         /* secondarySystemGroupedBackground */
    --surface-2: #f2f2f7;
    --label: #000000;
    --label-2: rgba(60, 60, 67, 0.6);
    --label-3: rgba(60, 60, 67, 0.3);
    --separator: rgba(60, 60, 67, 0.29);
    --fill: rgba(120, 120, 128, 0.2);
    --fill-2: rgba(120, 120, 128, 0.16);
    --fill-3: rgba(118, 118, 128, 0.12);
    --pressed: #d1d1d6;
    --chrome: rgba(249, 249, 249, 0.82);
    --segment: #ffffff;
    --alert: rgba(242, 242, 242, 0.9);
    --toast: rgba(255, 255, 255, 0.92);

    --blue: #007aff;
    --green: #34c759;
    --red: #ff3b30;
    --orange: #ff9500;
    --yellow: #ffcc00;
    --indigo: #5856d6;
    --purple: #af52de;
    --pink: #ff2d55;
    --teal: #30b0c7;
    --gray: #8e8e93;

    /* Gut lesbare Textvarianten (Kontrast) */
    --green-text: #248a3d;
    --red-text: #d70015;
    --orange-text: #c93400;
    --blue-text: #0063cc;

    --content-width: 680px;
    --navbar-height: 44px;
    --tabbar-height: 50px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --surface: #1c1c1e;
        --surface-2: #2c2c2e;
        --label: #ffffff;
        --label-2: rgba(235, 235, 245, 0.6);
        --label-3: rgba(235, 235, 245, 0.3);
        --separator: rgba(84, 84, 88, 0.65);
        --fill: rgba(120, 120, 128, 0.36);
        --fill-2: rgba(120, 120, 128, 0.32);
        --fill-3: rgba(118, 118, 128, 0.24);
        --pressed: #3a3a3c;
        --chrome: rgba(22, 22, 24, 0.82);
        --segment: #636366;
        --alert: rgba(40, 40, 42, 0.92);
        --toast: rgba(44, 44, 46, 0.94);

        --blue: #0a84ff;
        --green: #30d158;
        --red: #ff453a;
        --orange: #ff9f0a;
        --yellow: #ffd60a;
        --indigo: #5e5ce6;
        --purple: #bf5af2;
        --pink: #ff375f;
        --teal: #40c8e0;
        --gray: #8e8e93;

        --green-text: #30d158;
        --red-text: #ff6961;
        --orange-text: #ffb340;
        --blue-text: #409cff;
    }
}

/* ------------------------------------------------------------------ Grundlagen */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--label);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--blue); text-decoration: none; }

button { font: inherit; letter-spacing: inherit; }

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent);
    outline-offset: 2px;
    border-radius: 6px;
}

.sprite { display: none; }

[hidden] { display: none !important; }

.icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.125em;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.muted { color: var(--label-2); }
.small { font-size: 13px; }
.lead { color: var(--label-2); font-size: 15px; margin: -6px 0 24px; }

code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
}

/* Farb-Hilfsklassen */
.bg-blue { background: var(--blue); }
.bg-green { background: var(--green); }
.bg-red { background: var(--red); }
.bg-orange { background: var(--orange); }
.bg-indigo { background: var(--indigo); }
.bg-gray { background: var(--gray); }
.c-blue { color: var(--blue); }
.c-green { color: var(--green-text); }
.c-red { color: var(--red); }
.c-orange { color: var(--orange-text); }
.c-indigo { color: var(--indigo); }

/* ------------------------------------------------------------------ Navigationsleiste */

.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding-top: var(--safe-top);
    border-bottom: 0.5px solid transparent;
    transition: background-color 0.2s, border-color 0.2s;
}

.navbar--compact {
    background: var(--chrome);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom-color: var(--separator);
}

.navbar-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: calc(var(--content-width) + 16px);
    height: var(--navbar-height);
    margin: 0 auto;
    padding: 0 8px;
}

.navbar-leading { justify-self: start; display: flex; min-width: 0; }
.navbar-trailing { justify-self: end; display: flex; gap: 4px; min-width: 0; }

.navbar-title {
    max-width: 52vw;
    overflow: hidden;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
}

.navbar--compact .navbar-title { opacity: 1; }

.nav-button {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    background: none;
    color: var(--blue);
    font-size: 17px;
    white-space: nowrap;
    cursor: pointer;
}

.nav-button .icon { width: 24px; height: 24px; stroke-width: 2.4; }
.nav-button--icon { padding: 0 10px; }
.nav-button--bold { font-weight: 600; }
.nav-button:active { opacity: 0.4; }
.nav-button:disabled { color: var(--label-3); }

/* ------------------------------------------------------------------ Inhalt */

.content {
    max-width: calc(var(--content-width) + 32px);
    margin: 0 auto;
    padding: 0 16px calc(var(--tabbar-height) + var(--safe-bottom) + 40px);
}

.large-title {
    margin: 2px 0 16px;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ Gruppierte Listen (wie in den Einstellungen) */

.section { display: block; margin: 0 0 32px; }

.section-header {
    margin: 0;
    padding: 0 16px 7px;
    font-size: 13px;
    font-weight: 400;
    line-height: 18px;
    letter-spacing: 0;
    text-transform: uppercase;
    color: var(--label-2);
}

.section-footer {
    margin: 0;
    padding: 7px 16px 0;
    font-size: 13px;
    line-height: 18px;
    letter-spacing: 0;
    color: var(--label-2);
}

.section-footer strong { color: var(--orange-text); font-weight: 600; }

.list {
    margin: 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
    background: var(--surface);
    border-radius: 12px;
}

.list--spaced { margin-top: 24px; }

/* Trennlinien zwischen Zeilen, eingerückt wie bei iOS */
.list > * { position: relative; }
.list > * + *::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: var(--inset, 16px);
    z-index: 1;
    border-top: 0.5px solid var(--separator);
    pointer-events: none;
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 11px 16px;
    border: 0;
    background: var(--surface);
    color: var(--label);
    text-align: left;
    font-size: 17px;
}

.row--icon { --inset: 60px; gap: 15px; }
.row--avatar { --inset: 64px; }
.row--top { align-items: flex-start; }

a.row, button.row, label.row { cursor: pointer; transition: background-color 0.25s; }
a.row:active, button.row:active, label.check-row:active { background: var(--pressed); transition: none; }

@media (hover: hover) {
    a.row:hover, button.row:hover { background: color-mix(in srgb, var(--pressed) 40%, var(--surface)); }
}

.row-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 29px;
    height: 29px;
    border-radius: 7px;
    color: #fff;
    font-size: 18px;
}

.row-icon .icon { stroke-width: 2.1; }

.row-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.row-title { overflow-wrap: anywhere; }

.row-subtitle {
    font-size: 15px;
    line-height: 20px;
    color: var(--label-2);
    overflow-wrap: anywhere;
}

.row-text { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.4; }

.row-chevron {
    width: 14px;
    height: 14px;
    color: var(--label-3);
    stroke-width: 3;
}

.row--button { justify-content: center; font-size: 17px; }
.row--button.row--icon { justify-content: flex-start; }
.row--button.c-red { color: var(--red); }

.row form { margin: 0; }

/* Eingabefelder in Listen */
.row--field { cursor: text; }

.field-label {
    flex: 0 0 auto;
    width: 112px;
    color: var(--label);
}

.input {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--label);
    font: inherit;
    letter-spacing: inherit;
    caret-color: var(--blue);
}

.input::placeholder { color: var(--label-3); opacity: 1; }
.input:focus-visible { outline: 0; }
.row--field:focus-within { background: color-mix(in srgb, var(--blue) 5%, var(--surface)); }

textarea.input {
    min-height: 66px;
    resize: vertical;
    line-height: 1.4;
}

.input--date { min-height: 22px; text-align: left; }
.input--date::-webkit-date-and-time-value { text-align: left; }
.input--date::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }

.row:has(.input-validation-error) .field-label { color: var(--red-text); }

/* ------------------------------------------------------------------ Schalter (UISwitch) */

.switch {
    position: relative;
    flex: 0 0 auto;
    width: 51px;
    height: 31px;
    margin: 0;
    border-radius: 31px;
    background: var(--fill);
    cursor: pointer;
    transition: background-color 0.25s var(--ease);
    -webkit-appearance: none;
    appearance: none;
}

.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s var(--ease);
}

.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline-offset: 3px; border-radius: 31px; }

/* ------------------------------------------------------------------ Stepper (UIStepper) */

.stepper { display: inline-flex; align-items: center; gap: 14px; }

.stepper-input {
    width: 2.2ch;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--label);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }

.stepper-buttons {
    display: inline-flex;
    overflow: hidden;
    border-radius: 8px;
    background: var(--fill-3);
}

.stepper-buttons button {
    display: grid;
    place-items: center;
    width: 46px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--label);
    font-size: 18px;
    cursor: pointer;
}

.stepper-buttons button + button { border-left: 0.5px solid var(--separator); }
.stepper-buttons button:active { background: var(--fill); }
.stepper-buttons button:disabled { color: var(--label-3); cursor: default; }
.stepper-buttons .icon { stroke-width: 2.2; }

/* ------------------------------------------------------------------ Auswahlliste mit Häkchen */

.check-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.check-mark {
    width: 20px;
    height: 20px;
    color: var(--blue);
    stroke-width: 2.6;
    visibility: hidden;
}

.check-row input:checked ~ .check-mark { visibility: visible; }
.check-row input:focus-visible ~ .row-body { text-decoration: underline; text-underline-offset: 3px; }
.check-row:has(input:disabled) { cursor: default; opacity: 0.45; }

/* ------------------------------------------------------------------ Auto-Formular: Felder ein-/ausblenden */

.car-form:has([data-field="has-car"]:not(:checked)) .if-car { display: none; }
.car-form:has([data-field="has-car"]:checked):has([data-field="drives"]:checked) .if-not-driver { display: none; }

/* ------------------------------------------------------------------ Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 50px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s var(--ease), background-color 0.15s;
}

.btn:active { opacity: 0.7; transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn .icon { font-size: 19px; stroke-width: 2.4; }

.btn--block { display: flex; width: 100%; }
.btn--spaced { margin-top: 16px; }
.btn--filled { background: var(--blue); color: #fff; }
.btn--tinted { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.btn--gray { background: var(--fill-3); color: var(--label-2); }
.btn--destructive.btn--tinted { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }

.btn--sm {
    min-height: 34px;
    padding: 0 16px;
    border-radius: 17px;
    font-size: 15px;
}

/* ------------------------------------------------------------------ Segmentierte Auswahl */

.segmented {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    margin: 0 0 24px;
    padding: 2px;
    border-radius: 9px;
    background: var(--fill-3);
}

.segmented a {
    padding: 6px 10px;
    border-radius: 7px;
    color: var(--label);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-align: center;
    transition: background-color 0.2s;
}

.segmented a[aria-current="page"] {
    background: var(--segment);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

/* ------------------------------------------------------------------ Chips, Avatare, Kalender-Kachel */

.chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--fill-3);
    color: var(--label-2);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
}

.chip .icon { font-size: 14px; stroke-width: 2.3; }
.chip--green { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green-text); }
.chip--blue { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue-text); }
.chip--orange { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange-text); }

.avatar {
    --size: 36px;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: linear-gradient(180deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c));
    color: #fff;
    font-size: calc(var(--size) * 0.4);
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
    user-select: none;
}

.avatar { position: relative; overflow: hidden; }

.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover; /* bis das Bild geladen ist, scheinen die Initialen durch */
}

.avatar--xs { --size: 24px; font-size: 10px; }
.avatar--xl { --size: 88px; }

.c0 { --c: #007aff; }
.c1 { --c: #34c759; }
.c2 { --c: #ff9500; }
.c3 { --c: #af52de; }
.c4 { --c: #ff2d55; }
.c5 { --c: #5856d6; }
.c6 { --c: #30b0c7; }
.c7 { --c: #a2845e; }

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -7px; }

.cal-tile {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    width: 54px;
    padding: 7px 0 8px;
    border-radius: 12px;
    background: var(--surface-2);
    line-height: 1;
}

.cal-tile__weekday {
    color: var(--red);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cal-tile__day {
    margin-top: 3px;
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.cal-tile__month {
    margin-top: 3px;
    color: var(--label-2);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cal-tile--lg { width: 72px; padding: 10px 0 11px; border-radius: 16px; background: var(--surface); }
.cal-tile--lg .cal-tile__weekday { font-size: 13px; }
.cal-tile--lg .cal-tile__day { font-size: 36px; }
.cal-tile--lg .cal-tile__month { font-size: 12px; }

/* ------------------------------------------------------------------ Foto-Auswahl */

.photo-field { margin: 0 0 20px; }

.photo-picker {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 2 / 1;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface);
    color: var(--blue);
    cursor: pointer;
    transition: transform 0.2s var(--ease);
}

.photo-picker:active { transform: scale(0.99); }
.photo-picker:focus-within { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 2px; }

.photo-picker__img {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s, filter 0.2s;
}

.photo-picker__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.photo-picker__empty .icon { width: 40px; height: 40px; stroke-width: 1.6; }

.photo-picker__change {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.photo-picker.has-photo .photo-picker__img { display: block; }
.photo-picker.has-photo .photo-picker__empty { display: none; }
.photo-picker.has-photo .photo-picker__change { display: inline-flex; }
.photo-field:has([data-field="remove-photo"]:checked) .photo-picker__img { opacity: 0.3; filter: grayscale(1); }

.list--below { margin-top: 10px; }

/* ------------------------------------------------------------------ Event-Liste */

.event-list { display: flex; flex-direction: column; gap: 10px; }

.event-card {
    display: block;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface);
    color: var(--label);
    transition: transform 0.2s var(--ease), background-color 0.2s;
}

.event-card:active { transform: scale(0.98); background: var(--pressed); }

.event-card__photo {
    display: block;
    width: 100%;
    aspect-ratio: 2.2 / 1;
    object-fit: cover;
    background: var(--fill-3);
}

.event-card__main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 12px 14px 14px;
}

.event-card__body { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }

.event-card__title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.event-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    color: var(--label-2);
    font-size: 15px;
}

.event-card__meta > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.event-card__meta .icon { font-size: 14px; }

.event-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 6px;
}

.event-card__count { color: var(--label-2); font-size: 13px; letter-spacing: 0; }

.event-card__chevron {
    width: 14px;
    height: 14px;
    color: var(--label-3);
    stroke-width: 3;
}

/* ------------------------------------------------------------------ Event-Details */

.hero-photo {
    display: block;
    width: 100%;
    max-height: 380px;
    aspect-ratio: 16 / 9;
    margin: 4px 0 20px;
    border-radius: 18px;
    object-fit: cover;
    background: var(--fill-3);
}

.hero { display: flex; align-items: center; gap: 16px; margin: 4px 0 24px; }
.hero-text { min-width: 0; }
.hero .large-title { margin: 0; font-size: 28px; line-height: 1.15; }
.hero-sub { margin: 4px 0 0; color: var(--label-2); font-size: 15px; }

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0 0 32px;
}

.stats--2 { grid-template-columns: repeat(2, 1fr); }

.stat {
    padding: 12px 12px 10px;
    border-radius: 14px;
    background: var(--surface);
}

.stat__label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
}

.stat__label .icon { font-size: 15px; stroke-width: 2.3; }

.stat__value {
    margin-top: 4px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.check-badge {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 15px;
}

.check-badge .icon { stroke-width: 3; }

.card {
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
}

.card--empty {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--label-2);
    font-size: 15px;
}

.card--empty .icon { font-size: 30px; color: var(--label-3); stroke-width: 1.6; }
.card--empty p { margin: 0; }

.info-box,
.error-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
}

.info-box { background: var(--fill-3); color: var(--label-2); }
.error-box { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red-text); }
.error-box.validation-summary-valid { display: none; }
.error-box ul { margin: 0; padding: 0; list-style: none; }

.field-validation-error {
    display: block;
    padding: 6px 16px 0;
    color: var(--red-text);
    font-size: 13px;
    letter-spacing: 0;
}

.field-validation-valid { display: none; }

/* Auto-Karten mit Sitzplätzen */
.car-card {
    padding: 14px 16px 16px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: inset 0 0 0 0 transparent;
    transition: box-shadow 0.2s;
}

.car-card + .car-card { margin-top: 12px; }
.car-card--mine { box-shadow: inset 0 0 0 2px var(--green); }

.car-card__head { display: flex; align-items: center; gap: 12px; }
.car-card__title { font-weight: 600; overflow-wrap: anywhere; }
.car-card__sub { color: var(--label-2); font-size: 15px; }

.seats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 10px;
    margin: 16px 0 14px;
    padding: 0;
    list-style: none;
}

.seat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 52px;
    color: var(--label-2);
    font-size: 11px;
    letter-spacing: 0;
    text-align: center;
}

.seat .avatar { --size: 42px; }

.seat__name {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.seat--driver .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--indigo); }
.seat--driver .seat__name { color: var(--indigo); font-weight: 600; }
.seat--me .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--green); }
.seat--me .seat__name { color: var(--green-text); font-weight: 600; }

.seat__empty {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1.5px dashed var(--label-3);
    border-radius: 50%;
    color: var(--label-3);
    font-size: 18px;
}

.car-card__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 34px; }
.car-card__actions form { margin: 0; }

/* ------------------------------------------------------------------ Leere Zustände */

.empty {
    padding: 48px 24px;
    color: var(--label-2);
    text-align: center;
}

.empty > .icon { width: 60px; height: 60px; margin-bottom: 14px; color: var(--label-3); stroke-width: 1.4; }
.empty h2 { margin: 0 0 6px; color: var(--label); font-size: 22px; font-weight: 700; }
.empty p { margin: 0 0 22px; font-size: 15px; }
.empty--page { padding-top: 15vh; }
.empty--page .large-title { font-size: 28px; margin-bottom: 8px; }

/* ------------------------------------------------------------------ Profil */

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0 0 24px;
}

.avatar-form { margin: 0 0 8px; text-align: center; }

.avatar-picker {
    position: relative;
    display: inline-block;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s var(--ease);
}

.avatar-picker:active { transform: scale(0.96); }
.avatar-picker:focus-within { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 3px; }
.avatar-picker.is-saving .avatar { opacity: 0.6; }

.avatar-picker__badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 3px solid var(--bg);
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 15px;
}

.avatar-picker__badge .icon { stroke-width: 2.2; }

.profile-photo-actions { display: flex; gap: 18px; justify-content: center; margin-top: 6px; }
.profile-photo-actions form { margin: 0; }

.link-button {
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--blue);
    font-size: 15px;
    cursor: pointer;
}

.link-button--destructive { color: var(--red); }
.link-button:active { opacity: 0.4; }
.profile-name { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; text-align: center; }
.profile-sub { color: var(--label-2); font-size: 15px; }

/* ------------------------------------------------------------------ Anmelden & Registrieren */

.page-auth .navbar { display: none; }
.page-auth .content { padding-bottom: 0; }

.auth {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 420px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: calc(var(--safe-top) + 32px) 0 24px;
}

.app-icon {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    border-radius: 22.5%;
    background: linear-gradient(160deg, #5ac8fa 0%, #007aff 55%, #5856d6 100%);
    color: #fff;
    font-size: 46px;
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.28);
}

.app-icon .icon { stroke-width: 1.8; }

.auth-title { margin: 0 0 6px; font-size: 28px; font-weight: 700; text-align: center; }
.auth-sub { margin: 0 0 28px; padding: 0 12px; color: var(--label-2); font-size: 15px; text-align: center; }
.auth-submit { margin-top: 24px; }
.auth-switch { margin: 24px 0 0; color: var(--label-2); font-size: 15px; text-align: center; }

/* ------------------------------------------------------------------ Tab-Leiste */

.tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    display: flex;
    justify-content: space-around;
    padding-bottom: var(--safe-bottom);
    border-top: 0.5px solid var(--separator);
    background: var(--chrome);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
}

.tab {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: var(--tabbar-height);
    color: var(--gray);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.tab .icon { width: 26px; height: 26px; stroke-width: 1.8; }
.tab[aria-current="page"] { color: var(--blue); }
.tab[aria-current="page"] .icon { stroke-width: 2.2; }
.tab:active { opacity: 0.5; }

/* Ab Tablet-Breite: schwebende Tab-Leiste oben in der Mitte (wie iPadOS) */
@media (min-width: 768px) {
    :root { --navbar-height: 60px; }

    .navbar-title { visibility: hidden; }

    .tabbar {
        top: calc(var(--safe-top) + 9px);
        right: auto;
        bottom: auto;
        left: 50%;
        gap: 2px;
        padding: 4px;
        border: 0.5px solid var(--separator);
        border-radius: 999px;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
        transform: translateX(-50%);
    }

    .tab {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 6px;
        height: 34px;
        padding: 0 16px;
        border-radius: 999px;
        color: var(--label);
        font-size: 15px;
        letter-spacing: -0.01em;
    }

    .tab .icon { width: 18px; height: 18px; stroke-width: 2; }
    .tab[aria-current="page"] { background: var(--fill-3); color: var(--blue); font-weight: 600; }

    .content { padding-bottom: 64px; }
    .large-title { margin-top: 12px; }
}

/* ------------------------------------------------------------------ Hinweis-Banner (oben) */

.toast {
    position: fixed;
    top: calc(var(--safe-top) + 10px);
    left: 50%;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: min(92vw, 440px);
    padding: 11px 18px 11px 12px;
    border-radius: 22px;
    background: var(--toast);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.16), 0 0 0 0.5px var(--separator);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    animation: toast 4.5s var(--ease) forwards;
}

.toast--error { animation-duration: 7s; }

.toast-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 15px;
}

.toast-icon .icon { stroke-width: 3; }
.toast--error .toast-icon { background: var(--red); }

@keyframes toast {
    0% { opacity: 0; transform: translate(-50%, -130%); }
    8% { opacity: 1; transform: translate(-50%, 0); }
    90% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -130%); visibility: hidden; }
}

/* ------------------------------------------------------------------ Bestätigungsdialog (UIAlertController) */

dialog.alert {
    width: 270px;
    max-width: calc(100vw - 48px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: var(--alert);
    -webkit-backdrop-filter: saturate(180%) blur(40px);
    backdrop-filter: saturate(180%) blur(40px);
    color: var(--label);
    text-align: center;
}

dialog.alert[open] { animation: alert-in 0.22s var(--ease); }
dialog.alert::backdrop { background: rgba(0, 0, 0, 0.25); }
dialog.alert form { margin: 0; }

@keyframes alert-in {
    from { opacity: 0; transform: scale(1.12); }
}

.alert-body { padding: 19px 16px 18px; }
.alert-title { margin: 0 0 3px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.alert-message { margin: 0; font-size: 13px; line-height: 1.35; letter-spacing: 0; }

.alert-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 0.5px solid var(--separator);
}

.alert-actions button {
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--blue);
    font-size: 17px;
    cursor: pointer;
}

.alert-actions button:active { background: var(--fill-3); }
.alert-actions button + button { border-left: 0.5px solid var(--separator); }
.alert-cancel { font-weight: 600; }
.alert-ok { color: var(--red) !important; }

/* ------------------------------------------------------------------ Barrierefreiheit */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

    .toast { animation: none; }
}
