/* EVEX-Tools: gemeinsames Stylesheet (Basis aus Transaktionsmails).
   Marke (EVEX Brand Guide): Schwarz/Weiß, Grau #E2E3E4 (Linien, Neutraltöne davon abgeleitet), Akzent Grün #60bb46 als Fläche mit schwarzer Schrift, DM Sans, Phosphor Icons.
   --accent = Grün für Text/Fokus (lesbar), --accent-fill = Markengrün für Flächen. Videoportal-Ergänzungen am Ende. */

@font-face {
    font-family: "DM Sans";
    src: url("fonts/DMSans-Variable.ttf") format("truetype-variations"), url("fonts/DMSans-Variable.ttf") format("truetype");
    font-weight: 100 1000; font-style: normal; font-display: swap;
}

:root {
    --bg: #f3f4f4;
    --surface: #ffffff;
    --soft: #ecedee;
    --text: #121314;
    --muted: #575b60;
    --faint: #686c71;            /* Platzhalter, 4,7:1 auf Weiß */
    --border: #e2e3e4;           /* Trennlinien (dekorativ) */
    --border-strong: #84888d;    /* Feldrahmen, 3,2:1 auf Weiß */

    --accent: #2a7019;
    --accent-hover: #1e5512;
    --accent-soft: #eaf5e5;
    --accent-text: #0b0f0a;

    --error: #b3261e;
    --error-soft: #fdeceb;
    --error-wash: #fffafa;
    --ok: #16743a;
    --ok-soft: #e7f5ec;
    --warn: #7a4d00;
    --warn-soft: #fff4dc;

    /* Schriftrollen: fünf Größen, jede mit einer Aufgabe */
    --fs-title: 1.625rem;    /* 26 px Seitenüberschrift */
    --fs-heading: 1.125rem;  /* 18 px Abschnitt, Dialogtitel */
    --fs-body: 1rem;         /* 16 px Fließtext, Felder, Adressen */
    --fs-ui: .875rem;        /* 14 px Beschriftungen, Tabellen, Hinweise, Buttons */
    --fs-meta: .8rem;        /* 12,8 px Datum, Herkunft, Spaltenköpfe, Badges */

    --radius: 10px;
    --radius-card: 14px;
    --ease: cubic-bezier(.2, .7, .2, 1);
    --ease-out-expo: cubic-bezier(.16, 1, .3, 1);

    color-scheme: light;

    /* Ergänzende Töne (früher fest im Code), damit Hell und Dunkel aus denselben Variablen kommen */
    --selection: #cfe9c4;
    --scrollbar: #c6c8cb;
    --border-hover: #5f6368;
    --ctl-border: #d0d2d4;            /* Rahmen von Icon-Buttons und Chips */
    --row-hover: #f7f7f8;
    --accent-border: #a9d69a;
    --ok-border: #bfe3cc;
    --ok-text: #0f5a2c;
    --error-border: #f1c4c0;
    --error-border-strong: #d99a95;
    --warn-border: #f0d9a8;
    --warn-icon: #b07a12;
    --tip-bg: #121314;
    --tip-text: #ffffff;
    --shadow: rgba(18, 19, 20, .28);
    --shadow-soft: rgba(18, 19, 20, .1);
    --backdrop: rgba(12, 13, 14, .45);
    --focus-ring: rgba(96, 187, 70, .35);
    --veil: rgba(0, 0, 0, .06);
    --logo-filter: none;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23575b60' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5'/%3E%3C/svg%3E");
    accent-color: var(--accent);
    --accent-fill: #60bb46;
    --accent-fill-hover: #52a83a;
}

/* ---- Dunkler Modus ----------------------------------------------------------------------------
   Standard: Einstellung von System bzw. Browser. Der Schalter im Footer setzt data-theme="light"|"dark"
   am <html> (gespeichert im Browser) und geht der Systemeinstellung vor. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0d0e0f;
        --surface: #16171a;
        --soft: #1f2023;
        --text: #eeeff0;
        --muted: #a8abaf;
        --faint: #91959a;
        --border: #2b2d30;
        --border-strong: #686c71;
        --border-hover: #8a8e93;
        --ctl-border: #393b3f;
        --row-hover: #1b1c1f;
        --accent: #7dd062;
        --accent-hover: #9be084;
        --accent-soft: #1b2d16;
        --accent-text: #0b0f0a;
        --accent-border: #3f6f31;
        --error: #ff8f86;
        --error-soft: #3a1e1f;
        --error-wash: #21171a;
        --error-border: #6d3431;
        --error-border-strong: #94443f;
        --ok: #6fd49a;
        --ok-soft: #15301f;
        --ok-text: #93e3b4;
        --ok-border: #2b5c3c;
        --warn: #f3c26e;
        --warn-soft: #33290f;
        --warn-border: #5f4c1d;
        --warn-icon: #e2aa3d;
        --selection: #2f4f25;
        --scrollbar: #3e4044;
        --tip-bg: #e2e3e4;
        --tip-text: #0d0e0f;
        --shadow: rgba(0, 0, 0, .55);
        --shadow-soft: rgba(0, 0, 0, .3);
        --backdrop: rgba(3, 6, 10, .65);
        --focus-ring: rgba(125, 208, 98, .35);
        --veil: rgba(255, 255, 255, .08);
        --logo-filter: invert(1);
        --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a8abaf' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5'/%3E%3C/svg%3E");
    --accent-fill: #60bb46;
    --accent-fill-hover: #74c95b;
}
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d0e0f;
    --surface: #16171a;
    --soft: #1f2023;
    --text: #eeeff0;
    --muted: #a8abaf;
    --faint: #91959a;
    --border: #2b2d30;
    --border-strong: #686c71;
    --border-hover: #8a8e93;
    --ctl-border: #393b3f;
    --row-hover: #1b1c1f;
    --accent: #7dd062;
    --accent-hover: #9be084;
    --accent-soft: #1b2d16;
    --accent-text: #0b0f0a;
    --accent-border: #3f6f31;
    --error: #ff8f86;
    --error-soft: #3a1e1f;
    --error-wash: #21171a;
    --error-border: #6d3431;
    --error-border-strong: #94443f;
    --ok: #6fd49a;
    --ok-soft: #15301f;
    --ok-text: #93e3b4;
    --ok-border: #2b5c3c;
    --warn: #f3c26e;
    --warn-soft: #33290f;
    --warn-border: #5f4c1d;
    --warn-icon: #e2aa3d;
    --selection: #2f4f25;
    --scrollbar: #3e4044;
    --tip-bg: #e2e3e4;
    --tip-text: #0d0e0f;
    --shadow: rgba(0, 0, 0, .55);
    --shadow-soft: rgba(0, 0, 0, .3);
    --backdrop: rgba(3, 6, 10, .65);
    --focus-ring: rgba(125, 208, 98, .35);
    --veil: rgba(255, 255, 255, .08);
    --logo-filter: invert(1);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a8abaf' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5'/%3E%3C/svg%3E");
    --accent-fill: #60bb46;
    --accent-fill-hover: #74c95b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    overflow-y: scroll;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 450 var(--fs-body)/1.55 "DM Sans", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
    font-optical-sizing: auto;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
    caret-color: var(--accent);
}
::selection { background: var(--selection); color: var(--text); }
a { color: var(--text); text-decoration-color: var(--accent-fill); text-underline-offset: .2em; text-decoration-thickness: 2px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
code { background: var(--soft); padding: .1rem .35rem; border-radius: 5px; font-size: .88em; }
h1 { font-size: var(--fs-title); line-height: 1.3; font-weight: 600; letter-spacing: -.02em; margin: 0 0 1rem; text-wrap: balance; }
h2 { font-size: var(--fs-heading); line-height: 1.35; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .75rem; }
p { margin: 0 0 1rem; }
/* Erklärtexte in Karten: lesbare Zeilenlänge, deutsche Silbentrennung */
main.wide section > p, .hint, .notice, .empty, .sd-hint { max-width: 70ch; hyphens: auto; -webkit-hyphens: auto; }
ul { padding-left: 1.2rem; }
/* Textklasse; Buttons nutzen .small nur als Größe (siehe button.small) */
.small:not(button):not(.btn) { font-size: var(--fs-ui); color: var(--muted); }
p.small { margin: 1.25rem 0 0; }
.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--error); font-weight: 600; }
.icon { display: inline-block; flex: none; width: 1em; height: 1em; vertical-align: -.14em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Scrollbalken passend zur Fläche */
* { scrollbar-color: var(--scrollbar) transparent; scrollbar-width: thin; }

/* ---- Kopfzeile ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner {
    max-width: 1180px; margin: 0 auto; padding: .25rem 1.25rem; min-height: 4rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 2rem;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand { gap: .15rem; }
/* Die Datei enthält den Schutzraum: Höhe 3,5rem ergibt etwa 18 px Schriftzug */
.brand .logo { display: block; height: 3.5rem; width: auto; margin-left: -1.05rem; filter: var(--logo-filter); }
.brand-name { padding-left: .9rem; border-left: 1px solid var(--border-strong); font-weight: 600; font-size: var(--fs-body); letter-spacing: -.005em; color: var(--muted); line-height: 1.6rem; }
.brand:hover .brand-name { color: var(--text); }
.topbar nav { display: flex; gap: .25rem; margin-right: auto; }
.topbar nav a {
    padding: .4rem .75rem; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: var(--fs-ui); text-decoration: none;
    transition: background-color .15s var(--ease), color .15s var(--ease);
}
.topbar nav a:hover { background: var(--soft); color: var(--text); }
.topbar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent-fill); }
.topbar .who { color: var(--muted); font-size: var(--fs-ui); margin-left: auto; }
.topbar nav + .who { margin-left: 0; }
.topbar .who a { color: var(--muted); }

/* ---- Seitenrahmen ---- */
.card {
    width: calc(100% - 2rem); max-width: 26rem; margin: 2.5rem auto 1.5rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 2rem;
}
.card form { margin-top: .25rem; }
.card form button[type=submit] { width: 100%; }
.card .btn { margin-top: 0; }

main.wide { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
main.wide section {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
    padding: 1.4rem 1.6rem; margin-bottom: 1.25rem;
}
main.wide section form.grid, main.wide > form.grid { max-width: 46rem; }
/* :where hält die Spezifität niedrig, damit .short und Feldgruppen die Breite selbst bestimmen */
main.wide section :where(input:not([type=checkbox]):not([type=radio]):not([type=search]), textarea, select) { max-width: 40rem; }
main.wide section select.short { max-width: 14rem; }
main.wide section input.short { max-width: 14rem; }
.back { margin: 0 0 .5rem; font-size: var(--fs-ui); }
.back a { display: inline-block; padding: .2rem 0; text-decoration: none; color: var(--muted); }
.back a:hover { color: var(--accent); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head > button { margin: 0; }
.page-head button .icon, .page-head .btn .icon { width: 1.1rem; height: 1.1rem; }
.page-meta { display: flex; align-items: center; gap: .4rem; margin: .3rem 0 0; font-size: var(--fs-ui); color: var(--muted); }
.page-meta .icon { color: var(--faint); }

/* Projektübersicht: Kacheln */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 1rem; }
.tile {
    position: relative; display: flex; flex-direction: column; gap: 1.1rem; min-height: 8.5rem; padding: 1.15rem 1.2rem 1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.tile:hover { border-color: var(--accent); box-shadow: 0 6px 18px -10px var(--shadow); }
.tile:has(.tile-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-name { margin: 0; padding-right: 2.5rem; font-size: var(--fs-heading); line-height: 1.3; overflow-wrap: anywhere; }
.tile-link { color: var(--text); text-decoration: none; }
.tile-link:hover { color: var(--text); }
.tile-link:focus-visible { outline: none; }
/* Ganze Kachel klickbar */
.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tile .badge { position: absolute; top: 3.1rem; left: 1.2rem; }
.tile.is-inactive { background: var(--soft); }
.tile.is-inactive .tile-name { color: var(--muted); }
.tile.is-inactive .tile-name { margin-bottom: 1.6rem; }
.tile-facts { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: var(--fs-ui); color: var(--muted); }
.tile-facts li { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .35rem; }
.tile-facts strong { color: var(--text); font-weight: 600; }
.tile-facts .icon { color: var(--faint); }
.tile-facts .unit { margin-left: -.1rem; }
.tile .tile-edit { position: absolute; top: .7rem; right: .7rem; z-index: 1; }
.tile-new { align-items: center; justify-content: center; border-style: dashed; border-color: var(--border-strong); background: transparent; }
.tile-new .tile-link { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--muted); }
.tile-new .tile-link .icon { width: 1.25rem; height: 1.25rem; }
.tile-new:hover .tile-link { color: var(--accent); }

.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.narrow { max-width: 26rem; }
.static { margin: 0; }
.hint { margin: .35rem 0 0; font-size: var(--fs-ui); color: var(--muted); max-width: 40rem; }
.count {
    display: inline-block; margin-left: .35rem; padding: .05rem .5rem; border-radius: 999px;
    background: var(--soft); color: var(--muted); font-size: var(--fs-meta); font-weight: 600; vertical-align: .1em;
}

/* ---- Formulare ---- */
label { display: block; font-weight: 600; font-size: var(--fs-ui); margin: 1.1rem 0 .35rem; }
input, select, textarea {
    display: block; width: 100%; min-height: 2.75rem; padding: .6rem .8rem; font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
/* Auswahlfelder wie Textfelder: gleiche Breite und Höhe, eigener Pfeil statt Systemoptik */
select {
    -webkit-appearance: none; appearance: none; padding-right: 2.4rem; text-overflow: ellipsis; cursor: pointer;
    background-image: var(--select-arrow);
    background-repeat: no-repeat; background-position: right .75rem center; background-size: 1rem;
}
textarea { min-height: 0; resize: vertical; }
textarea.mono { font: var(--fs-ui)/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
textarea.code { max-width: none !important; min-height: 16rem; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--focus-ring);
}
input:disabled, select:disabled { background: var(--soft); color: var(--muted); cursor: not-allowed; }
input.short { max-width: 14rem; }
input[type=checkbox], input[type=radio] { display: inline-block; width: 1.05rem; min-height: 0; height: 1.05rem; margin: 0 .5rem 0 0; vertical-align: -.15rem; }
input[type=file] { padding: .4rem; }
input[type=file]::file-selector-button {
    margin-right: .75rem; padding: .4rem .8rem; font: inherit; font-weight: 600; color: var(--text);
    background: var(--soft); border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer;
}
label.check { display: flex; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: .3rem; flex: none; }
fieldset { border: 0; padding: 0; margin: 1.4rem 0 0; }
fieldset > legend + label, fieldset > legend + .checklist { margin-top: .35rem; }
/* Erstes Feld direkt unter der Kartenüberschrift bzw. am Kartenanfang ohne Extra-Abstand */
main.wide section > form:first-child > input[type=hidden] + label,
main.wide section > h2 + form > input[type=hidden] + label { margin-top: 0; }
legend { font-weight: 600; font-size: var(--fs-ui); margin-bottom: .35rem; padding: 0; }
/* Auswahlliste mit Checkboxen: eine Zeile je Eintrag */
.picklist { margin: 1.1rem 0 0; padding: 0; max-width: 40rem; }
.picklist legend { margin-bottom: .4rem; }
.pick {
    display: flex; align-items: center; gap: .65rem; margin: 0; padding: .6rem .8rem;
    font-weight: 400; font-size: var(--fs-body); cursor: pointer;
    border: 1px solid var(--border-strong); border-top-width: 0; background: var(--surface);
    transition: background-color .12s var(--ease);
}
.picklist legend + .pick, .picklist > .pick:first-of-type { border-top-width: 1px; border-radius: var(--radius) var(--radius) 0 0; }
.picklist > .pick:last-of-type { border-radius: 0 0 var(--radius) var(--radius); }
.picklist > .pick:only-of-type { border-radius: var(--radius); }
.pick:hover { background: var(--soft); }
.pick:has(input:checked) { background: var(--accent-soft); }
.pick input[type=checkbox] { margin: 0; flex: none; width: 1.1rem; height: 1.1rem; }
.pick-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
label.check.spaced { margin-top: 1.25rem; }

.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .1rem 1rem; }
.checklist label.check { margin: .35rem 0; }
.row3 { display: grid; grid-template-columns: 1.6fr .8fr 1.7fr; gap: 0 .75rem; max-width: 40rem; }
form.inline { display: inline; margin: 0; }

/* ---- Buttons ---- */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    margin-top: 1rem; min-height: 2.75rem; padding: .6rem 1.15rem; font: inherit; font-weight: 600; line-height: 1.3;
    text-decoration: none; color: var(--accent-text); background: var(--accent-fill); border: 1px solid var(--accent-fill);
    border-radius: var(--radius); cursor: pointer; white-space: nowrap;
    transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
button:hover, .btn:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); color: var(--accent-text); }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:disabled { opacity: .55; cursor: progress; transform: none; }
button.secondary, .btn.secondary { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
button.secondary:hover, .btn.secondary:hover { background: var(--soft); border-color: var(--border-hover); color: var(--text); }
button.danger { color: var(--error); background: var(--surface); border-color: var(--error-border-strong); }
button.danger:hover { background: var(--error-soft); border-color: var(--error); color: var(--error); }
button.small, .btn.small { margin: 0; min-height: 2.25rem; padding: .35rem .75rem; font-size: var(--fs-ui); }
.btn.small { color: var(--accent); background: var(--surface); border-color: var(--border-strong); }
.btn.small:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
button.link {
    margin: 0; min-height: 0; padding: 0; border: 0; background: none; color: var(--text); text-decoration-color: var(--accent-fill); text-decoration-thickness: 2px;
    font: inherit; font-weight: 400; text-decoration: underline; text-underline-offset: .18em; cursor: pointer;
}
button.link:hover { background: none; color: var(--accent); }
.rowactions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.rowactions form { margin: 0; }
.rowactions.spaced { margin-top: .9rem; }

/* ---- Reiter ---- */
.tabs { display: flex; gap: .25rem; margin: 0 0 1.25rem; border-bottom: 1px solid var(--border-strong); }
.tabs a {
    position: relative; padding: .6rem 1rem; margin-bottom: -1px; color: var(--muted); font-weight: 600; font-size: var(--fs-ui);
    text-decoration: none; border-bottom: 2px solid transparent; transition: color .12s var(--ease), border-color .12s var(--ease);
}
.tabs a:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent-fill); border-bottom-width: 3px; }

/* ---- Meldungen ---- */
.notice { margin: 0 0 1rem; padding: .7rem .95rem; border-radius: var(--radius); background: var(--soft); border: 1px solid var(--border); }
.notice.ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok-text); }
.notice.error { background: var(--error-soft); border-color: var(--error-border); color: var(--error); }

/* ---- Tabellen ---- */
.tablewrap { overflow-x: auto; margin: 0 -.25rem; padding: 0 .25rem; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
th, td { text-align: left; padding: .65rem .55rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: var(--fs-meta); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tbody tr { transition: background-color .12s var(--ease); }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
.num { text-align: right; }

.badge {
    display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: var(--fs-meta); font-weight: 600; white-space: nowrap;
    background: var(--soft); color: var(--muted);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.fail { background: var(--error-soft); color: var(--error); }
.badge.sent { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ==== Projektseite ======================================================= */

/* Kopf der Projektseite: "Neuer Kontakt" ist die Hauptaktion */
.head-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.head-actions .btn, .head-actions button { margin: 0; }
.btn-new { padding-left: 1rem; padding-right: 1.25rem; font-size: var(--fs-body); }
.btn-new .icon { width: 1.25rem; height: 1.25rem; }
.notice.warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); font-weight: 600; }

/* Dialog "Neuer Kontakt": mehrere Formulare in einem Dialog */
.modal-body { padding: 1.5rem 1.6rem 1.35rem; }
.modal-body form { padding: 0; }
.modal-wide { width: min(38rem, calc(100vw - 2rem)); }
/* Reiter im Dialog: Einzelkontakt / Mehrere Kontakte */
.tabs-inline { margin: 0 0 1.1rem; }
.tabs-inline button {
    margin: 0 0 -1px; min-height: 0; padding: .55rem .9rem; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
    background: none; color: var(--muted); font-size: var(--fs-ui); font-weight: 600;
}
.tabs-inline button:hover { background: none; color: var(--text); border-bottom-color: var(--border-strong); }
.tabs-inline button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent-fill); border-bottom-width: 3px; }
.modal [role=tabpanel] label:first-of-type { margin-top: 0; }
#batch-emails { font-size: var(--fs-ui); }

.batch-review h2 { margin-bottom: .75rem; }
.sd-facts.compact { padding: .6rem 0; margin-bottom: .75rem; font-size: var(--fs-ui); }
.batch-groups { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .35rem; font-size: var(--fs-ui); }
.batch-list { color: var(--muted); overflow-wrap: anywhere; }
.batch-warn strong { color: var(--warn); }
.batch-bad strong { color: var(--error); }
.batch-confirm label.check { margin: 0 0 .5rem; font-size: var(--fs-ui); }
.batch-confirm .sd-hint { margin-top: .6rem; }

/* Suche: filtert die Liste beim Tippen */
form.search { margin: 0; }
.search-field { position: relative; display: block; }
.search-field .icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
main.wide section .search-field input { width: 17rem; max-width: 100%; min-height: 2.5rem; padding-left: 2.2rem; }
.empty { margin: .5rem 0 .25rem; color: var(--muted); }

/* Icon-Buttons: große Symbole, Bedeutung im Tooltip und für Screenreader */
.icon-btn {
    position: relative; margin: 0; width: 2.5rem; height: 2.5rem; min-height: 0; padding: 0; flex: none;
    color: var(--muted); background: var(--surface); border: 1px solid var(--ctl-border); border-radius: 9px;
}
.icon-btn .icon { width: 1.3rem; height: 1.3rem; }
.icon-btn:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); }
.icon-btn[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); }
.icon-btn.primary { color: var(--accent-text); background: var(--accent-fill); border-color: var(--accent-fill); }
.icon-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.icon-btn.danger { color: var(--muted); background: var(--surface); border-color: var(--ctl-border); }
.icon-btn.danger:hover { color: var(--error); background: var(--error-soft); border-color: var(--error-border-strong); }
.icon-btn[aria-busy="true"] { opacity: .5; }
a.icon-btn { display: inline-flex; align-items: center; justify-content: center; }

/* Tooltips (data-tip) bei Hover und Tastaturfokus */
[data-tip] { position: relative; }
[data-tip]::after {
    content: attr(data-tip); position: absolute; z-index: 30; bottom: calc(100% + 8px); left: 50%;
    width: max-content; max-width: min(24rem, 80vw); padding: .4rem .6rem; border-radius: 7px;
    background: var(--tip-bg); color: var(--tip-text); font-size: var(--fs-meta); font-weight: 500; line-height: 1.45; letter-spacing: 0;
    text-align: left; white-space: pre-line; text-transform: none;
    opacity: 0; visibility: hidden; transform: translate(-50%, 3px); pointer-events: none;
    transition: opacity .12s var(--ease), transform .12s var(--ease), visibility 0s .12s;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after {
    opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: .2s, .2s, 0s;
}
.tip-start[data-tip]::after { left: 0; transform: translate(0, 3px); }
.tip-start[data-tip]:hover::after, .tip-start[data-tip]:focus-visible::after { transform: none; }
.tip-end[data-tip]::after { left: auto; right: 0; transform: translate(0, 3px); }
.tip-end[data-tip]:hover::after, .tip-end[data-tip]:focus-visible::after { transform: none; }
/* Ausgeklappt sitzt der Tooltip unter dem Button, damit er die Zeile darüber nicht verdeckt */
.rcp-panel [data-tip]::after { bottom: auto; top: calc(100% + 8px); }

/* Filter nach Versandstand */
.status-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.25rem 0 .9rem; }
.chip {
    margin: 0; min-height: 2.25rem; padding: .3rem .8rem; gap: .4rem; font-size: var(--fs-ui); font-weight: 600;
    color: var(--muted); background: var(--surface); border: 1px solid var(--ctl-border); border-radius: 999px;
}
.chip:hover { color: var(--text); background: var(--soft); border-color: var(--border-strong); }
.chip .icon { width: 1rem; height: 1rem; }
.chip-n { min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: var(--fs-meta); text-align: center; }
.chip-open .icon { color: var(--warn-icon); }
.chip-ok .icon { color: var(--ok); }
.chip-fail .icon { color: var(--error); }
.chip[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.chip[aria-pressed="true"] .chip-n { background: var(--surface); color: var(--accent); }

/* Kontaktliste: eine Zeile je Kontakt, Details beim Ausklappen */
.rcp-list { list-style: none; margin: 0 -.6rem; padding: 0; }
.rcp { border-radius: 10px; transition: background-color .12s var(--ease); }
.rcp + .rcp { border-top: 1px solid var(--border); }
.rcp:hover { background: var(--row-hover); }
.rcp.is-open { background: var(--row-hover); border-top-color: transparent; }
.rcp.is-open + .rcp { border-top-color: transparent; }
.rcp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "body status actions"; align-items: center; gap: .5rem 1rem; padding: .6rem .6rem .6rem .9rem; }
.rcp-body { grid-area: body; }
.rcp-row > .status { grid-area: status; }
.rcp-actions { grid-area: actions; }
.rcp-body { min-width: 0; }
.addr { display: block; font-weight: 600; overflow-wrap: anywhere; line-height: 1.35; }
.rcp-meta { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin-top: .1rem; font-size: var(--fs-meta); color: var(--muted); }
.rcp-meta > span { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.rcp-meta .icon { width: .95rem; height: .95rem; color: var(--faint); }
.rcp-actions { display: flex; }
.rcp-actions form { margin: 0; }
/* Senden: die Hauptaktion der Zeile. Noch nicht gesendet = gefüllt, danach "Erneut senden" = farbiger Rahmen */
.rcp-actions .icon-btn.send { color: var(--accent-text); background: var(--accent-fill); border: 1.5px solid var(--accent-fill); }
.rcp-actions .icon-btn.send:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.rcp-actions .icon-btn.send.is-again { color: var(--accent); background: var(--surface); }
.rcp-actions .icon-btn.send.is-again:hover { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-hover); }
.rcp-actions { gap: .4rem; }

/* Versandstand: farbiger Streifen links und Etikett mit Text, Details im Tooltip */
.rcp { box-shadow: inset 3px 0 0 transparent; }
.rcp.st-open { box-shadow: inset 3px 0 0 var(--warn-icon); }
.rcp.st-ok { box-shadow: inset 3px 0 0 var(--ok); }
.rcp.st-fail { box-shadow: inset 3px 0 0 var(--error); }
.status {
    display: inline-flex; align-items: center; gap: .4rem; min-width: 11.5rem; padding: .3rem .7rem .3rem .5rem; border-radius: 999px;
    font-size: var(--fs-ui); font-weight: 600; line-height: 1.3; white-space: nowrap; cursor: default;
}
.status .icon { width: 1.1rem; height: 1.1rem; }
.status-sub { font-weight: 500; opacity: .85; }
.status-open { background: var(--warn-soft); color: var(--warn); }
.status-open .icon { color: var(--warn-icon); }
.status-ok { background: var(--ok-soft); color: var(--ok-text); }
.status-ok .icon { color: var(--ok); }
.status-fail { background: var(--error-soft); color: var(--error); }
.status:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Ausgeklappter Eintrag */
.rcp-panel {
    display: grid; grid-template-columns: minmax(14rem, 22rem) minmax(0, 1fr) auto; gap: 1rem 2rem; align-items: start;
    margin: 0 .6rem 0 .9rem; padding: .9rem 0 1rem; border-top: 1px solid var(--border);
    animation: panel-in .18s var(--ease-out-expo);
}
@keyframes panel-in { from { opacity: 0; transform: translateY(-3px); } }
.rcp-panel form { margin: 0; }
.rcp-panel label { margin: 0 0 .3rem; font-size: var(--fs-meta); color: var(--muted); }
.inline-row { display: flex; gap: .4rem; align-items: center; }
main.wide section .inline-row select { flex: 1; min-width: 0; max-width: none; min-height: 2.5rem; padding-top: .4rem; padding-bottom: .4rem; font-size: var(--fs-ui); }
.panel-history h3 { margin: 0 0 .4rem; font-size: var(--fs-meta); font-weight: 600; color: var(--muted); }
.history-empty { margin: 0; font-size: var(--fs-ui); color: var(--muted); }
ol.history { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: var(--fs-ui); }
ol.history li { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.45; }
ol.history li > .icon { margin-top: .2em; }
.h-ok > .icon { color: var(--ok); }
.h-fail > .icon, .h-fail strong { color: var(--error); }
.h-what { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.h-what strong { color: var(--text); font-weight: 600; }
.h-att, .h-why { display: flex; gap: .3rem; align-items: center; font-size: var(--fs-meta); }
.h-why { color: var(--error); }
.panel-remove { align-self: end; }

/* Rückmeldung direkt am Eintrag */
.row-note {
    display: flex; gap: .45rem; align-items: flex-start; margin: .45rem 0 .1rem; padding: .35rem .6rem; border-radius: 8px;
    font-size: var(--fs-ui); line-height: 1.4; width: fit-content;
}
.row-note .icon { flex: none; margin-top: .15em; }
.row-note.ok { background: var(--ok-soft); color: var(--ok-text); }
.row-note.error { background: var(--error-soft); color: var(--error); }

/* Bestätigung vor dem Versand: die Mail so, wie der Kontakt sie bekommt */
.send-dialog, .modal {
    width: min(34rem, calc(100vw - 2rem)); padding: 0; border: 0; border-radius: var(--radius-card);
    color: var(--text); background: var(--surface);
    box-shadow: 0 24px 60px -12px var(--shadow), 0 4px 14px var(--shadow-soft);
}
.send-dialog::backdrop, .modal::backdrop { background: var(--backdrop); }
.send-dialog[open], .modal[open] { animation: dialog-in .32s var(--ease-out-expo); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.send-dialog > form, .modal > form { padding: 1.5rem 1.6rem 1.35rem; }
.modal { width: min(30rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; }
.modal label:first-of-type { margin-top: 0; }
.modal .notice { margin-bottom: .5rem; }
.modal .sd-actions { margin-top: 1.4rem; }
.send-dialog h2, .modal h2 { margin: 0 0 1rem; }
.sd-warn { margin: 0 0 1rem; padding: .6rem .8rem; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: var(--fs-ui); }
.sd-facts { display: grid; grid-template-columns: 5.5rem 1fr; gap: .55rem 1rem; margin: 0; padding: 1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: var(--fs-body); }
.sd-facts dt { font-size: var(--fs-ui); padding-top: .1rem; }
.sd-facts dt { color: var(--muted); }
.sd-facts dd { margin: 0; overflow-wrap: anywhere; }
.sd-to { font-weight: 600; }
.sd-subject { font-weight: 600; }
.sd-hint { margin: .85rem 0 0; font-size: var(--fs-meta); color: var(--muted); }
.sd-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; }
.sd-actions button, .sd-actions .btn { margin: 0; }

/* Eintragszustände */
.rcp.has-error { background: var(--error-wash); }
.rcp.is-recent, .rcp:target { animation: row-recent 2.6s var(--ease-out-expo) both; }
@keyframes row-recent {
    0%, 35% { background: var(--accent-soft); }
    100%    { background: transparent; }
}
.rcp.has-error.is-recent, .rcp.has-error:target { animation-name: row-recent-error; }
@keyframes row-recent-error {
    0%, 35% { background: var(--accent-soft); }
    100%    { background: var(--error-wash); }
}

/* ---- Sonstige Seiten ---- */
.preview-frame { border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: #fff; }
.preview-frame iframe { display: block; width: 100%; height: 70vh; min-height: 30rem; border: 0; }
/* Projektansicht: Vorschau der Vorlagen im Dialog */
.modal-preview { width: min(48rem, calc(100vw - 2rem)); }
.modal-preview .sd-facts { margin-top: .9rem; }
.modal-preview .preview-frame iframe { height: min(60vh, 42rem); min-height: 18rem; }
section.danger-zone { border-color: var(--error-border); }

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: .01ms !important; }
    .rcp.is-recent, .rcp:target { animation: none; background: var(--accent-soft); }
    .send-dialog[open], .modal[open], .rcp-panel { animation: none; }
    [data-tip]::after { transition: none; }
}

/* ---- Schmale Bildschirme ---- */
@media (max-width: 60rem) {
    .rcp-panel { grid-template-columns: minmax(0, 1fr) auto; }
    .panel-template { grid-column: 1; }
    .panel-history { grid-column: 1; }
    .panel-remove { grid-column: 2; grid-row: 1; align-self: start; }
}
@media (max-width: 40rem) {
    .card { width: calc(100% - 1.5rem); margin-top: 1rem; padding: 1.25rem; }
    .topbar-inner { padding: .2rem 1rem .5rem; gap: .1rem 1rem; }
    .brand .logo { height: 3rem; margin-left: -.9rem; }
    .brand-name { font-size: var(--fs-ui); padding-left: .75rem; }
    .topbar nav { order: 3; width: 100%; margin: 0 -.25rem; overflow-x: auto; }
    .topbar .who { margin-left: auto; }
    main.wide { padding: 1.25rem .75rem 3rem; }
    main.wide section { padding: 1.1rem 1rem; }
    .row3 { grid-template-columns: 1fr; }

    /* Verwaltungstabellen (Projekte, Nutzer, Vorlagen) als gestapelte Einträge */
    table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: auto; }
    table.stack thead { display: none; }
    table.stack tr { padding: .8rem 0; border-bottom: 1px solid var(--border); }
    table.stack tbody tr:last-child { border-bottom: 0; }
    table.stack td { border: 0; padding: .15rem 0; text-align: left; }
    table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: var(--fs-ui); }
    table.stack td.c-main { font-size: var(--fs-body); padding-bottom: .3rem; }
    table.stack td.c-go { padding-top: .5rem; }
    table.stack td br { display: none; }
    table.stack td .muted.small:not(button) { margin-left: .35rem; }

    form.search, .section-head .search-field { width: 100%; }
    main.wide section .search-field input { width: 100%; }
    .rcp-list { margin: 0 -.5rem; }
    .rcp-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "body actions" "status actions"; gap: .45rem .6rem; padding: .6rem .5rem .6rem .8rem; }
    .rcp-row > .status { justify-self: start; min-width: 0; }
    .head-actions { width: 100%; }
    .head-actions .btn-new { flex: 1; }
    .rcp-panel { grid-template-columns: 1fr; margin: 0 .5rem 0 .8rem; gap: 1rem; }
    .panel-remove { grid-column: 1; grid-row: auto; justify-self: end; }
    .sd-facts { grid-template-columns: 1fr; gap: .1rem; }
    .sd-facts dd { margin-bottom: .45rem; }
    .sd-actions button, .sd-actions .btn { flex: 1 1 100%; }
}

/* ---- Felder je Kontakt (Version 2) ---- */
/* Angaben unter der Adresse */
.rcp-values { display: flex; flex-wrap: wrap; gap: .15rem 1rem; margin-top: .2rem; font-size: var(--fs-meta); }
.rv { display: inline-flex; align-items: baseline; gap: .35rem; min-width: 0; overflow-wrap: anywhere; }
.rv-label { color: var(--muted); }
.rv code { font-size: .95em; padding: 0 .3rem; border-radius: 4px; background: var(--soft); }
.rv-missing { align-items: center; color: var(--warn); font-weight: 600; }
.rv-missing .icon { width: .95rem; height: .95rem; }

/* Eingaben im Dialog und im ausgeklappten Eintrag */
.field-auto { display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: baseline; margin: 1rem 0 0; font-size: var(--fs-ui); }
.field-auto-label { font-weight: 600; }
.field-auto code { padding: .05rem .35rem; border-radius: 4px; background: var(--soft); }
.panel-values { padding-bottom: 1rem; margin-bottom: 1rem !important; border-bottom: 1px solid var(--border); }
.panel-values h3 { margin: 0 0 .5rem; font-size: var(--fs-meta); font-weight: 600; color: var(--muted); }
.panel-values label { margin-top: .6rem !important; }
.panel-values h3 + label { margin-top: 0 !important; }
.panel-values input, .panel-values select { width: 100%; min-height: 2.5rem; padding-top: .4rem; padding-bottom: .4rem; font-size: var(--fs-ui); }
.panel-values .field-auto { margin-top: .6rem; }
.panel-values button { margin-top: .75rem; }

/* Import: Spalten zuordnen */
.map-grid { display: grid; grid-template-columns: minmax(8rem, auto) minmax(0, 1fr); gap: .6rem 1rem; align-items: center; margin: .5rem 0 0; }
.map-grid label, .map-grid .map-auto-label { margin: 0; font-weight: 600; font-size: var(--fs-ui); }
.map-grid select { width: 100%; margin: 0; }
.map-grid .muted { font-size: var(--fs-ui); }

/* Projekt bearbeiten: Felder, Listen */
.tabs .count { margin-left: .25rem; }
.fields-table .inline-row input { min-width: 10rem; margin: 0; }
.fields-table .inline-row button, .fields-table form.inline button { margin: 0; }
fieldset.choice label.check { margin: .35rem 0; }

/* Liste: Filter und Suche */
.list-toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; margin: 0 0 .9rem; }
.list-toolbar .status-filter { margin: 0; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }
a.chip[aria-current="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
a.chip[aria-current="true"] .chip-n { background: var(--surface); color: var(--accent); }
.items-table code { overflow-wrap: anywhere; }

@media (max-width: 40rem) {
    .map-grid { grid-template-columns: 1fr; gap: .25rem; }
    .map-grid select { margin-bottom: .5rem; }
}

/* ======================================================================
   Videoportal: Kundenseiten, Player, Backend-Ergänzungen
   ====================================================================== */
.card.card-wide { max-width: 60rem; }
.page-head > .btn { margin: 0; }
.actions { margin: 0; }
.pager { display: flex; gap: 1rem; align-items: center; margin: 1rem 0 0; font-size: var(--fs-ui); }

/* Suche und Testmail: Feld und Button in einer Zeile */
form.search { display: flex; gap: .5rem; max-width: 30rem; margin: 0 0 1rem; }
main.wide section form.search input { max-width: none; flex: 1; min-width: 0; }
form.search button { margin: 0; flex: none; }

/* Player mit Wasserzeichen und eigenem Vollbild-Knopf */
.player { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #0b0f16; border-radius: 12px; overflow: hidden; }
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #0b0f16; }
.player:fullscreen { border-radius: 0; aspect-ratio: auto; }
.remaining { margin: .9rem 0 0; }
.watermark {
    position: absolute; z-index: 2; pointer-events: none; user-select: none;
    max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #fff; opacity: .4; font: 600 .85rem/1 system-ui, sans-serif; text-shadow: 0 0 3px #000, 0 0 6px #000;
    animation: wm-move 48s linear infinite;
}
@keyframes wm-move {
    0%   { top: 5%;  left: 4%; }
    25%  { top: 5%;  left: 52%; }
    50%  { top: 86%; left: 52%; }
    75%  { top: 86%; left: 4%; }
    100% { top: 5%;  left: 4%; }
}
.player .fs {
    position: absolute; z-index: 3; right: .6rem; top: .6rem; margin: 0; min-height: 0; padding: .3rem .65rem; font-size: var(--fs-meta);
    background: rgba(0, 0, 0, .55); border-color: rgba(255, 255, 255, .35); color: #fff; opacity: 0; transition: opacity .15s;
}
.player:hover .fs, .player .fs:focus-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .watermark { animation: none; top: 5%; left: 4%; }
}
@media (max-width: 40rem) {
    form.search { max-width: none; }
}

/* Vorschau im Backend: Dialog mit Player, Player-Seite im Rahmen, Icon-Buttons in der Videotabelle */
.modal.modal-video { width: min(56rem, calc(100vw - 2rem)); }
.modal-video .section-head { margin-bottom: .75rem; }
.modal-video .player { border-radius: var(--radius); }
.modal-video .hint { margin-top: .6rem; }
body.player-frame { margin: 0; min-height: 0; display: block; background: #0b0f16; overflow: hidden; }
body.player-frame video, body.player-frame iframe { display: block; width: 100%; height: 100vh; border: 0; background: #0b0f16; }
.player-message { margin: 0; padding: 2rem 1.5rem; color: #fff; font-size: var(--fs-ui); }
.row-icons { justify-content: flex-end; flex-wrap: nowrap; }
.row-icons .icon-btn { margin: 0; }
.page-head > button { margin: 0; }
@media (max-width: 40rem) {
    .row-icons { justify-content: flex-start; }
}
.row-icons form { margin: 0; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn:disabled:hover { color: var(--muted); background: var(--surface); border-color: var(--ctl-border); }

/* Videotabelle: Titel in einer Zeile, darunter die Angaben zum Video */
.video-table td.c-main { width: 100%; max-width: 0; }
.v-title {
    display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font-size: var(--fs-body); font-weight: 600; line-height: 1.35; color: var(--text); text-decoration: none;
}
.v-title:hover { color: var(--accent); text-decoration: underline; }
.v-meta { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin-top: .2rem; font-size: var(--fs-meta); color: var(--muted); }
.v-meta > span { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.v-meta .icon { width: .95rem; height: .95rem; color: var(--faint); }
@media (max-width: 40rem) {
    .video-table td.c-main { max-width: none; }
    .v-title { white-space: normal; }
}

/* Footer auf allen Seiten: Gegenstück zur Kopfzeile */
.sitefooter { margin-top: auto; background: var(--surface); border-top: 1px solid var(--border); font-size: var(--fs-meta); color: var(--muted); }
.sitefooter-inner {
    max-width: 1180px; margin: 0 auto; padding: 1rem 1.25rem;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1.5rem;
}
.sitefooter nav { display: flex; flex-wrap: wrap; gap: .25rem .6rem; }
.sitefooter a { color: var(--muted); }
.sitefooter a:hover { color: var(--text); }
@media (max-width: 40rem) {
    .sitefooter-inner { padding: .9rem 1rem; }
}


/* ---- Sprachen ---------------------------------------------------------- */
/* Sprachumschalter im Footer der Kundenseiten: aktuelle Sprache hervorgehoben */
.sitefooter nav.langs a[aria-current] { color: var(--text); font-weight: 600; text-decoration: none; }
/* Auswahl der verfügbaren Sprachen in den Einstellungen */
fieldset.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0 1rem; margin: .5rem 0 0; }
fieldset.checks > legend { grid-column: 1 / -1; font-weight: 600; margin-bottom: .2rem; }
fieldset.checks label.check { margin: .25rem 0; }
/* Sprachwahl in der Adresstabelle */
select.lang-pick { width: auto; min-width: 0; padding-top: .2rem; padding-bottom: .2rem; font-size: var(--fs-meta); }
/* Adresstabelle: Adresse fett, darunter die Angaben; rechts Sprache und Aktionen */
.addr-table span.v-title:hover { color: var(--text); text-decoration: none; }
.addr-table .v-meta .badge { font-size: var(--fs-meta); padding: .05rem .55rem; }
.addr-table .v-meta .warn { color: var(--error); }
.addr-table td.c-go { vertical-align: middle; }
.row-icons select.lang-pick { height: 2.5rem; margin: 0; padding: 0 1.9rem 0 .7rem; font-size: var(--fs-ui); }
/* Filterleiste der Adressliste: Suche, Sprache, Status, Sortierung in einer Zeile */
.list-filter { margin: 0 0 .75rem; padding: .85rem 1rem; background: var(--soft); border-radius: var(--radius); }
.list-filter .lf-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .9rem; }
.list-filter .lf-row > label, .list-filter .lf-search > label { display: flex; flex-direction: column; gap: .25rem; margin: 0; font-size: var(--fs-meta); font-weight: 600; color: var(--muted); }
.list-filter .lf-search { flex: 1 1 18rem; display: flex; flex-direction: column; gap: .25rem; }
.list-filter .lf-q { display: flex; }
main.wide section .list-filter .lf-q input { flex: 1; min-width: 0; max-width: none; margin: 0; min-height: 2.5rem; padding-top: .35rem; padding-bottom: .35rem; font-size: var(--fs-ui); border-radius: var(--radius) 0 0 var(--radius); }
.list-filter .lf-q button { margin: 0 0 0 -1px; min-height: 2.5rem; padding: .35rem .9rem; font-size: var(--fs-ui); border-radius: 0 var(--radius) var(--radius) 0; }
main.wide section .list-filter .lf-row select { width: auto; min-width: 8rem; max-width: 17rem; margin: 0; min-height: 2.5rem; padding-top: .35rem; padding-bottom: .35rem; font-size: var(--fs-ui); font-weight: 400; }
.list-filter .lf-reset { font-size: var(--fs-ui); padding-bottom: .55rem; }

/* ---- Formulare im Backend: Beschriftung und Hinweis links, Feld rechts ---- */
.frow {
    display: grid; grid-template-columns: minmax(11rem, 15.5rem) minmax(0, 1fr); gap: .4rem 2.5rem;
    padding: 1.05rem 0; border-top: 1px solid var(--border);
}
section > h2 + .frow, .add-body form > .frow:first-of-type { border-top: 0; padding-top: .2rem; }
/* Beschriftung auf Höhe des Feldtextes (Feld 2,75rem hoch) */
.frow-label > label, .frow-label > .flabel { display: block; margin: .7rem 0 0; font-size: var(--fs-ui); font-weight: 600; line-height: 1.35; color: var(--text); }
.frow-label .hint { margin-top: .3rem; font-size: var(--fs-meta); line-height: 1.5; }
.frow-field { min-width: 0; }
.frow-field > label.check { margin: .7rem 0 0; }
.frow-field > input + label.check, .frow-field > select + label.check { margin-top: .65rem; }
.frow-field > .hint { margin-top: .4rem; font-size: var(--fs-meta); }
.frow-field label.sub { margin: .9rem 0 .3rem; font-size: var(--fs-meta); color: var(--muted); }
.frow-field > label.sub:first-child, .frow-field > div:first-child > label.sub:first-child { margin-top: 0; }
.frow-field .hint-first { margin: .7rem 0 0; font-size: var(--fs-ui); }
.frow-field .hint code { font-size: .92em; }
/* Nur Text, kein Feld: Beschriftung und Wert auf einer Grundlinie */
.frow.static .frow-label > .flabel { margin-top: 0; }
.frow.static { padding: .8rem 0; align-items: baseline; font-size: var(--fs-ui); }
section > h2 + .frow.static { padding-top: .1rem; }
.frow.static .frow-field > .hint { font-size: var(--fs-meta); }
button.flush, .btn.flush { margin: 0; }
.ok-text { color: var(--ok); }
/* Zahl mit Einheit */
.unit-field { display: flex; align-items: center; gap: .65rem; }
main.wide section .unit-field input { width: 7.5rem; flex: none; }
.unit { font-size: var(--fs-ui); color: var(--muted); }
.mono-in { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-ui) !important; }
/* Speichern: bleibt beim Scrollen am unteren Rand sichtbar */
.form-actions {
    position: sticky; bottom: 0; z-index: 5; display: flex; gap: .6rem; align-items: center;
    margin: -.25rem 0 1.25rem; padding: .85rem 0; background: var(--bg); box-shadow: 0 -1px 0 var(--border);
}
.form-actions button, .form-actions .btn { margin: 0; }
/* Gefahrenbereich: Text links, Button rechts */
.dz-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; }
.dz-row h2 { margin-bottom: .2rem; }
.dz-row .hint { margin: 0; }
.dz-row form { margin: 0; }
.dz-row button { margin: 0; }
/* Stand des Versands */
.stat-line { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.5rem; }
.stat-line strong { font-size: var(--fs-body); font-weight: 600; }
.stat-line .is-open strong { color: var(--warn); }
.count-open { background: var(--warn-soft); color: var(--warn); }
.tabs a[aria-current="page"] .count-open { background: var(--warn-soft); }
/* Adressen hinzufügen: aufklappbar, offen solange die Liste leer ist */
.add-panel { padding-top: 0 !important; padding-bottom: 0 !important; }
.add-panel summary {
    display: flex; align-items: baseline; gap: .75rem; padding: 1.15rem 0; cursor: pointer; list-style: none;
}
.add-panel summary::-webkit-details-marker { display: none; }
.add-panel summary h2 { margin: 0; }
.add-panel summary::before {
    content: ""; flex: none; width: .55rem; height: .55rem; margin-right: .1rem; align-self: center;
    border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg);
    transition: transform .15s var(--ease);
}
.add-panel details[open] summary::before { transform: translateY(-.15rem) rotate(45deg); }
.add-panel summary:hover h2 { color: var(--accent); }
.summary-hint { font-size: var(--fs-ui); color: var(--muted); }
.add-panel details[open] .summary-hint { display: none; }
.add-body { padding-bottom: 1.2rem; }
.section-head h2 .muted { margin-left: .3rem; font-size: var(--fs-ui); font-weight: 600; }
.section-head .btn.small .icon { width: 1rem; height: 1rem; }
/* Kurzbeschreibung unter der Kartenüberschrift */
section > h2 + .section-desc { margin: -.4rem 0 .6rem; font-size: var(--fs-ui); color: var(--muted); }
.section-desc + .frow { border-top: 0; padding-top: .2rem; }
.section-desc + .frow.static { padding-top: .1rem; }
.badge.warn-badge { background: var(--warn-soft); color: var(--warn); margin: 0 .35rem; }
.frow-field form.search { margin: 0; }
.frow-field form + form button.link { margin-top: .6rem; font-size: var(--fs-ui); }
/* Sprachen in den Einstellungen */
fieldset.checks label.check .code { margin-left: .35rem; color: var(--muted); font-size: var(--fs-meta); }
@media (max-width: 40rem) {
    .frow { grid-template-columns: 1fr; gap: .3rem; }
    .frow-label > label, .frow-label > .flabel { margin-top: 0; }
    .frow.static { gap: .1rem; }
    .frow-label:empty { display: none; }
    .dz-row button { width: 100%; }
}

/* Linkseite: Bestätigung vor dem Abspielen */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1.25rem; font-size: var(--fs-ui); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.consent { margin: 0 0 1rem; padding: .85rem 1rem; background: var(--soft); border-radius: var(--radius); font-size: var(--fs-ui); }
.consent label.check { margin: 0; font-size: var(--fs-ui); }
.consent p { margin: .5rem 0 0 1.55rem; color: var(--muted); }
@media (max-width: 30rem) { .facts { grid-template-columns: 1fr; gap: 0; } .facts dd { margin-bottom: .4rem; } }
.frow-field > p.static { margin: .7rem 0 0; font-size: var(--fs-ui); }

/* Versand: Auswahlliste mit Checkboxen und Leiste zum Senden */
.pick-table td.c-check, .pick-table th.c-check { width: 2.25rem; padding-right: 0; }
.pick-table td.c-check input, .pick-table th.c-check input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; vertical-align: middle; }
.pick-table .check-all { margin: 0; display: inline; }
.pick-table label.v-title { display: block; margin: 0; font-size: var(--fs-body); font-weight: 600; cursor: pointer; }
.pick-table tbody tr.is-picked { background: var(--accent-soft); }
.th-sub { font-weight: 500; text-transform: none; letter-spacing: 0; }
.send-bar {
    position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.25rem;
    margin: 1rem -1.6rem -1.4rem; padding: .85rem 1.6rem; background: var(--surface);
    border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.send-count { margin: 0; font-size: var(--fs-ui); color: var(--muted); }
.send-count strong { color: var(--text); font-size: var(--fs-body); }
.send-again { color: var(--warn); }
.send-again strong { color: var(--warn); }
.send-panel .list-filter { margin-bottom: .5rem; }
@media (max-width: 40rem) {
    .send-bar { margin: 1rem -1rem -1.1rem; padding: .8rem 1rem; }
    .send-bar button { width: 100%; }
    .pick-table, .pick-table tbody, .pick-table tr { display: block; }
    .pick-table thead tr { display: flex; align-items: center; }
    .pick-table tbody tr { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); }
    .pick-table td { border: 0; padding: 0; }
    .pick-table td.c-main { max-width: none; }
}

/* Meldungen: schweben oben, wenn die Seite nach einer Aktion an der vorigen Stelle bleibt */
.flash.is-floating {
    position: fixed; z-index: 60; top: 1rem; left: 50%; transform: translateX(-50%);
    width: min(40rem, calc(100vw - 2rem));
    animation: flash-in .35s var(--ease-out-expo);
}
.flash.is-floating .notice { margin: 0 0 .5rem; padding-right: 2.75rem; box-shadow: 0 12px 32px -10px var(--shadow), 0 2px 6px var(--shadow-soft); }
.flash.is-floating .notice:last-of-type { margin-bottom: 0; }
.flash-close {
    position: absolute; top: .4rem; right: .45rem; margin: 0; width: 2rem; height: 2rem; min-height: 0; padding: 0;
    font-size: 1.3rem; line-height: 1; color: currentColor; background: transparent; border: 0; border-radius: 999px; opacity: .7;
}
.flash-close:hover { opacity: 1; color: inherit; background: var(--veil); border: 0; }
.flash.is-leaving { opacity: 0; transform: translate(-50%, -6px); transition: opacity .35s var(--ease), transform .35s var(--ease); }
@keyframes flash-in { from { opacity: 0; transform: translate(-50%, -8px); } }
/* Angesprungene Zeile kurz hervorheben, mit Abstand zum oberen Rand */
tr[id^="g-"] { scroll-margin-top: 35vh; }
tr[id^="g-"]:target { animation: row-recent 2.6s var(--ease-out-expo) both; }
[data-list-anchor] { scroll-margin-top: 1rem; }
@media (prefers-reduced-motion: reduce) {
    .flash.is-floating, tr[id^="g-"]:target { animation: none; }
    tr[id^="g-"]:target { background: var(--accent-soft); }
}

/* Footer: Sprache und Rechtliches rechts */
.footer-end { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.25rem; }

/* ---- Darstellung im Header rechts außen: Wie System / Hell / Dunkel und Hoher Kontrast ---- */
.display-controls { display: inline-flex; align-items: center; gap: .4rem; margin-left: auto; }
.topbar .who + .display-controls { margin-left: -.75rem; }
.theme-switch { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--soft); }
.theme-switch button, .contrast-toggle {
    margin: 0; width: 1.9rem; height: 1.9rem; min-height: 0; padding: 0; border: 0; border-radius: 999px;
    color: var(--muted); background: transparent;
}
.contrast-toggle { width: 2.15rem; height: 2.15rem; border: 1px solid var(--border); background: var(--soft); }
.theme-switch button .icon, .contrast-toggle .icon { width: .95rem; height: .95rem; }
.theme-switch button:hover, .contrast-toggle:hover { color: var(--text); background: var(--veil); border-color: var(--border); }
.theme-switch button[aria-pressed="true"] { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px var(--shadow-soft); }
.contrast-toggle[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-fill); border-color: var(--accent-fill); }
.theme-switch button:focus-visible, .contrast-toggle:focus-visible { outline-offset: 1px; border-radius: 999px; }
/* Tooltips im Header unterhalb, oben ist kein Platz */
.topbar [data-tip]::after { bottom: auto; top: calc(100% + 8px); }
@media (max-width: 40rem) {
    .topbar .who + .display-controls { margin-left: 0; }
    .display-controls { order: 2; }
}

/* ---- Hoher Kontrast -----------------------------------------------------------------------------
   data-contrast="more" setzt theme.js (Systemeinstellung prefers-contrast oder Schalter im Header).
   Dunkle Variante: nach der hellen, gleiche Spezifität, daher gewinnt sie im dunklen Modus. */
:root[data-contrast="more"]:not([data-theme="dark"]) {
    --bg: #ffffff; --surface: #ffffff; --soft: #ecedee;
    --text: #000000; --muted: #26282b; --faint: #3a3d41;
    --border: #5f6368; --border-strong: #1c1d1f; --border-hover: #000000; --ctl-border: #3a3d41; --row-hover: #e6e7e8;
    --accent: #1e5512; --accent-hover: #123a0a; --accent-soft: #e1f2db; --accent-text: #000000; --accent-border: #1e5512;
    --error: #8c1810; --error-soft: #fbe3e1; --error-border: #8c1810; --error-border-strong: #8c1810;
    --ok: #0a5126; --ok-soft: #dff2e6; --ok-text: #063d1c; --ok-border: #0a5126;
    --warn: #4f3200; --warn-soft: #fbecc8; --warn-border: #4f3200; --warn-icon: #6b4500;
    --selection: #bfe3b2; --scrollbar: #5f6368;
    --tip-bg: #000000; --tip-text: #ffffff; --focus-ring: rgba(30, 85, 18, .35);
    --accent-fill: #60bb46;
    --accent-fill-hover: #4f9e38;
}
@media (prefers-color-scheme: dark) {
    :root[data-contrast="more"]:not([data-theme="light"]) {
        --bg: #000000; --surface: #08090a; --soft: #151618;
        --text: #ffffff; --muted: #e2e3e4; --faint: #c9cbce;
        --border: #7e8287; --border-strong: #d4d6d8; --border-hover: #ffffff; --ctl-border: #a7aaae; --row-hover: #121315;
        --accent: #a6e88f; --accent-hover: #c6f2b5; --accent-soft: #14270f; --accent-text: #000000; --accent-border: #a6e88f;
        --error: #ffb8b2; --error-soft: #2c1010; --error-border: #ffb8b2; --error-border-strong: #ffb8b2;
        --ok: #95f2bd; --ok-soft: #0b2516; --ok-text: #b0f7cd; --ok-border: #95f2bd;
        --warn: #ffd98f; --warn-soft: #2a2008; --warn-border: #ffd98f; --warn-icon: #ffd98f;
        --selection: #3d6330; --scrollbar: #7e8287;
        --tip-bg: #ffffff; --tip-text: #000000; --focus-ring: rgba(166, 232, 143, .45);
    --accent-fill: #60bb46;
    --accent-fill-hover: #7fd466;
}
}
:root[data-contrast="more"][data-theme="dark"] {
    --bg: #000000; --surface: #08090a; --soft: #151618;
    --text: #ffffff; --muted: #e2e3e4; --faint: #c9cbce;
    --border: #7e8287; --border-strong: #d4d6d8; --border-hover: #ffffff; --ctl-border: #a7aaae; --row-hover: #121315;
    --accent: #a6e88f; --accent-hover: #c6f2b5; --accent-soft: #14270f; --accent-text: #000000; --accent-border: #a6e88f;
    --error: #ffb8b2; --error-soft: #2c1010; --error-border: #ffb8b2; --error-border-strong: #ffb8b2;
    --ok: #95f2bd; --ok-soft: #0b2516; --ok-text: #b0f7cd; --ok-border: #95f2bd;
    --warn: #ffd98f; --warn-soft: #2a2008; --warn-border: #ffd98f; --warn-icon: #ffd98f;
    --selection: #3d6330; --scrollbar: #7e8287;
    --tip-bg: #ffffff; --tip-text: #000000; --focus-ring: rgba(166, 232, 143, .45);
    --accent-fill: #60bb46;
    --accent-fill-hover: #7fd466;
}
/* Über die Farben hinaus: klare Kanten, kräftiger Fokus, Status nicht nur über Farbe */
:root[data-contrast="more"] main.wide section, :root[data-contrast="more"] .card, :root[data-contrast="more"] .topbar,
:root[data-contrast="more"] .sitefooter { border-color: var(--border-strong); }
:root[data-contrast="more"] input, :root[data-contrast="more"] select, :root[data-contrast="more"] textarea { border-width: 2px; }
:root[data-contrast="more"] .badge, :root[data-contrast="more"] .count, :root[data-contrast="more"] .notice { border: 1px solid currentColor; }
:root[data-contrast="more"] .tabs { border-bottom-color: var(--border-strong); }
:root[data-contrast="more"] .tabs a[aria-current="page"] { border-bottom-width: 3px; }
:root[data-contrast="more"] :focus-visible { outline: 3px solid var(--accent) !important; outline-offset: 2px; }
:root[data-contrast="more"] .hint, :root[data-contrast="more"] .v-meta, :root[data-contrast="more"] .small { color: var(--muted); }
:root[data-contrast="more"] .player .watermark { opacity: .55; }
:root[data-contrast="more"] .list-filter, :root[data-contrast="more"] .consent { border: 1px solid var(--border); }
