/* ==========================================================================
   Gassert Admin – Design System
   Ruhig, monochrom, Gassert-Gruen als Akzent. Enterprise/Senior-UX.
   ========================================================================== */

/* Oswald lokal (kein externer Google-Font-Aufruf; DSGVO/LG Muenchen 3 O 17493/20) */
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/oswald/oswald-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/oswald/oswald-500-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/oswald/oswald-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/oswald/oswald-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/oswald/oswald-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/oswald/oswald-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    /* Neutralpalette */
    --bg:           #f6f7f9;
    --surface:      #ffffff;
    --surface-2:    #fbfbfc;
    --border:       #e6e8ec;
    --border-strong:#d6dae0;

    --text:         #14181f;
    --text-muted:   #5b6573;
    --text-subtle:  #8b94a1;

    /* elexx-CRM: neutrale Slate-Palette, dunkles Sky-Blau als Akzent (sky-700/800) */
    --accent:       #0369a1;
    --accent-strong:#075985;
    --accent-tint:  #e0f2fe;
    --accent-ring:  rgba(3,105,161,.25);
    --brand:        #334155;
    --brand-strong: #1e293b;

    /* Status */
    --ok:           #16a34a;
    --ok-tint:      #dcfce7;
    --idle:         #98a1ad;
    --danger:       #b42318;
    --danger-tint:  #fdecea;

    --radius:       6px;
    --radius-sm:    4px;
    --shadow-sm:    0 1px 2px rgba(16,24,40,.04);
    --shadow-card:  0 1px 2px rgba(16,24,40,.05), 0 1px 1px rgba(16,24,40,.03);

    --sidebar-w:    248px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-headline: "Oswald", "Segoe UI", Roboto, sans-serif;
}

/* Dark-Mode: nur Variablen ueberschreiben, Layout bleibt gleich.
   Aktiviert via <html data-theme="dark"> (server-side aus 'theme'-Cookie gesetzt). */
:root[data-theme="dark"] {
    color-scheme: dark;

    --bg:           #0f141b;
    --surface:      #171e28;
    --surface-2:    #1f2836;
    --border:       #2a3446;
    --border-strong:#3a4658;

    --text:         #e6e9ef;
    --text-muted:   #a1adbd;
    --text-subtle:  #7a8698;

    /* Akzent bleibt, aber Tint wird dunkler, damit is-active nicht blendet */
    --accent-tint:  #0c2e42;
    --accent-ring:  rgba(14,165,233,.35);
    --brand:        #94a3b8;
    --brand-strong: #cbd5e1;

    --ok-tint:      #0f2e21;
    --danger-tint:  #3a1616;

    --shadow-sm:    0 1px 2px rgba(0,0,0,.35);
    --shadow-card:  0 1px 2px rgba(0,0,0,.35), 0 1px 1px rgba(0,0,0,.25);
}

/* Logo-Umschaltung: farbige Version im Light-Mode, weisse Version im Dark-Mode.
   :root-Prefix hebt Spezifitaet ueber `.sidebar__brand img` etc. */
:root .logo--dark  { display: none; }
:root[data-theme="dark"] .logo--light { display: none; }
:root[data-theme="dark"] .logo--dark  { display: block; }

/* Utility */
.text-right { text-align: right; }
.text-left  { text-align: left;  }

/* Vorlagen-Editor: Layout mit grosser Textarea + Platzhalter-Sidebar */
.tpl-editor-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    margin-top: 12px;
}
@media (max-width: 960px) {
    .tpl-editor-wrap { grid-template-columns: 1fr; }
}

.tpl-code {
    width: 100%;
    min-height: 480px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.55;
    tab-size: 2;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    padding: 12px 14px;
    resize: vertical;
    white-space: pre;
    overflow: auto;
}
.tpl-code:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.tpl-code--small { min-height: 160px; }

.tpl-help {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    max-height: calc(100vh - 200px);
    overflow: auto;
    position: sticky;
    top: 16px;
    align-self: start;
    box-shadow: var(--shadow-card);
}
.tpl-help__title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .02em;
    color: var(--text);
    margin-bottom: 6px;
}
.tpl-group { margin-top: 14px; }
.tpl-group__label {
    font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-subtle); margin-bottom: 6px;
}
.tpl-token {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 3px 8px;
    font-size: 12px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}
.tpl-token:hover {
    background: var(--accent-tint);
    border-color: var(--accent);
    color: var(--accent-strong);
}

.section-title, .kpi__label, .topbar__title, h1, h2, h3, h4 {
    font-family: var(--font-headline);
    letter-spacing: .01em;
}

/* --------------------------------------------------------------
   Oswald-Look: konsequent auf allen UI-Titeln, Labels, Buttons,
   Table-Headern und Card-Kopfzeilen. Body-Fließtext bleibt System-
   Sans (Arial-Familie), Monospace bleibt Monospace.
   -------------------------------------------------------------- */
h5, h6,
.btn,
.badge,
.crm-toolbar__back,
.crm-tab, .crm-tab__badge,
.dl__label, .dl__value,
.data thead th,
.data tbody td,
.table thead th,
.table tbody td,
.card--pad > strong,
.card--pad > b,
.tpl-group__label,
.tom-intro,
.stat__label,
.kpi-card__label,
.nav__label,
.nav__link,
.public__title,
.alert,
.info-label,
label {
    font-family: var(--font-headline);
    letter-spacing: .015em;
}

/* Auch die alten Monospace-Textstellen laufen jetzt einheitlich in Oswald,
   damit die Optik im ganzen CRM konsistent ist (User-Wunsch). Wer wirklich
   Monospace möchte, kann explizit die Klasse .mono--force setzen. */
.data td[style*="monospace"],
.data td.mono,
.data .mono,
[style*="font-family:monospace"],
[style*="font-family: monospace"] {
    font-family: var(--font-headline) !important;
    font-style: normal !important;
    letter-spacing: .015em;
}
.mono--force { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace !important; }

/* Textbaustein-Kontextmenü (Rechtsklick in Kopf-/Fußtext-Textareas) */
.tb-menu {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(15,23,42,.15);
    min-width: 300px;
    max-width: 420px;
    padding: 4px;
    font-family: var(--font-headline);
}
.tb-menu__header {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-subtle); padding: 8px 12px 6px;
}
.tb-menu__empty { padding: 6px 12px 10px; color: var(--text-subtle); font-size: 13px; }
.tb-menu__item {
    display: flex; align-items: center; gap: 4px;
    border-radius: 4px;
}
.tb-menu__item:hover { background: var(--surface-2); }
.tb-menu__label {
    flex: 1; text-align: left;
    background: none; border: 0; cursor: pointer;
    padding: 8px 10px; font: inherit; font-size: 13.5px;
    color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-menu__item.is-default .tb-menu__label { color: var(--accent-strong); }
.tb-menu__actions { display: flex; gap: 2px; padding-right: 6px; }
.tb-menu__act {
    width: 26px; height: 26px; border: 0; background: transparent;
    cursor: pointer; border-radius: 4px; color: var(--text-muted);
    font-size: 14px; line-height: 1;
}
.tb-menu__act:hover { background: var(--border); color: var(--text); }
.tb-menu__act--del:hover { background: #fee4e2; color: #b3261e; }
.tb-menu__sep { height: 1px; background: var(--border); margin: 4px 0; }
.tb-menu__save {
    display: block; width: 100%; text-align: left;
    background: none; border: 0; cursor: pointer;
    padding: 8px 12px; font: inherit; font-size: 13px;
    color: var(--accent-strong); border-radius: 4px;
}
.tb-menu__save:hover { background: var(--accent-tint); }

/* Tab-Navigation — deutlich sichtbar, Karteireiter-Stil */
.tabs {
    display: flex; gap: 6px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 18px;
    padding: 0 4px;
}
.tabs__link {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    padding: 12px 22px;
    font: inherit; font-family: var(--font-headline);
    font-size: 15px; font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: -2px;
    position: relative;
    transition: background .12s, color .12s;
}
.tabs__link:hover {
    color: var(--text);
    background: var(--surface);
}
.tabs__link.is-active {
    background: var(--surface);
    color: var(--accent-strong);
    border-bottom: 2px solid var(--surface);
}
.tabs__link.is-active::after {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 8px 8px 0 0;
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Tabs mit Live-Summen rechts (Angebot-Editor) */
.tabs--with-sums { align-items: stretch; justify-content: space-between; }
.tabs--with-sums .tabs__nav { display: flex; gap: 6px; }
.tabs__sums {
    display: flex; align-items: stretch; gap: 0;
    margin-bottom: -2px;
    padding-bottom: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}
.tabs__sum {
    display: flex; flex-direction: column; justify-content: center;
    padding: 6px 14px 4px;
    border-left: 1px solid var(--border);
    min-width: 96px;
}
.tabs__sum:first-child { border-left: 0; }
.tabs__sum-lbl {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 500; line-height: 1;
}
.tabs__sum-val {
    font-family: var(--font-headline);
    font-size: 15px; font-weight: 500; color: var(--text);
    font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 3px;
}
.tabs__sum--brutto { background: var(--accent-tint, rgba(245,158,11,.08)); }
.tabs__sum--brutto .tabs__sum-val { font-size: 17px; font-weight: 600; color: var(--accent-strong); }
@media (max-width: 720px) {
    .tabs--with-sums { flex-direction: column; align-items: flex-start; gap: 8px; }
    .tabs__sums { margin-bottom: 0; align-self: stretch; }
}

/* Prompt-Modal (z.B. Baustein-Name eingeben) — ersetzt window.prompt/confirm */
.pmodal { position: fixed; inset: 0; z-index: 10001; display: flex; align-items: center; justify-content: center; }
.pmodal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.35); }
.pmodal__dialog {
    position: relative; background: #fff; border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 20px 60px rgba(15,23,42,.2);
    width: 100%; max-width: 440px; padding: 24px;
}
.pmodal__title { font-family: var(--font-headline); font-size: 16px; font-weight: 500; margin: 0 0 8px; }
.pmodal__msg   { color: var(--text-muted); font-size: 13.5px; margin: 0 0 14px; }
.pmodal__input { width: 100%; }
.pmodal__opts  { margin: 12px 0 0; font-size: 13.5px; display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.pmodal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Pflichtfeld-Marker: kleines rotes Sternchen im Label */
.required {
    color: var(--danger, #b91c1c);
    font-weight: 500;
    margin-left: 2px;
}

/* Tabellen-Filter: "Kein Treffer"-Zeile */
.table-filter__empty td {
    text-align: center;
    color: var(--text-subtle);
    padding: 32px 16px !important;
    font-style: normal;
    background: var(--surface-2);
    border-top: 1px dashed var(--border);
}

/* Buttons + Badges: nur leicht kräftiger als Body, nicht mehr bold. */
.btn, .badge {
    font-weight: 500;
}

/* Standard-Überschriften laufen in Regular; Card-Section-Titel bekommen
   Medium (500) für dezente Betonung, damit die Karten-Struktur klar wird. */
h1, h2, h3, h4, h5, h6,
.public__title, .topbar__title,
.crm-toolbar__title {
    font-weight: 400 !important;
    letter-spacing: .01em;
}
.crm-section-title,
.card--pad > strong,
.card--pad > b {
    font-weight: 500 !important;
    letter-spacing: .02em;
}
strong, b { font-weight: 500; }

/* Sidebar-Nav durchgehend Regular */
.nav__link, .nav__link.is-active, .nav__label {
    font-weight: 400;
}
.nav__label { letter-spacing: .06em; }

/* Table-Header dezenter */
.data thead th, .table thead th {
    font-weight: 400;
    letter-spacing: .04em;
    color: var(--text-muted);
}

/* Toolbar-Meta, .muted etc. bleiben Regular */
.crm-toolbar__meta, .muted { font-weight: 400; }

/* Tabellen bewusst leicht: keine fette Schrift — weder Header noch Zellen.
   Header nur mit leichtem letter-spacing zur Absetzung. */
.data thead th, .table thead th { font-weight: 500; letter-spacing: .02em; }
.data tbody td, .table tbody td { font-weight: 400 !important; }
.data tbody td.cell-strong,
.data .cell-strong { font-weight: 400 !important; }

/* Text-Inputs generell nicht fett — auch wenn Container fette Schrift erbt. */
.crm-input,
input.crm-input,
select.crm-input,
textarea.crm-input {
    font-weight: 400 !important;
}

/* Systemweite Reduzierung der Schriftgewichte: Oswald wirkt bei 600/700
   deutlich fetter als Arial. Deshalb 600 -> 500 und 700 -> 600 in
   generischen Textelementen (Überschriften bleiben aus dem globalen Setup). */
.card--pad > strong, .card--pad > b,
.crm-section-title,
.dl__label,
strong, b {
    font-weight: 500;
}
/* Table-Header, Cell-Strong, .muted -> nie fett */
.data thead th, .table thead th { font-weight: 500; }
.data tbody td, .table tbody td,
.data tbody td.cell-strong, .data .cell-strong,
.muted {
    font-weight: 400 !important;
}
/* Nav-Items und Toolbar-Titel: normal statt bold */
.nav__link            { font-weight: 400; }
.nav__link.is-active  { font-weight: 500; }
.crm-toolbar__title   { font-weight: 500; }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-headline);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }

svg.ic { width: 18px; height: 18px; stroke: currentColor; fill: none;
         stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- App-Shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 96px;
}
.sidebar__brand img { height: 64px; width: auto; max-width: 100%; display: block; }

/* Artikel-Autocomplete im Angebots-Editor (Art.-Nr. + Bezeichnung).
   Floating-Panel unter dem Input, feste Position → keine Overflow-Probleme. */
.pos-suggest {
    position: fixed; z-index: 100;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 8px 24px rgba(15,23,42,.12);
    max-height: 320px; overflow-y: auto;
    max-width: 640px;
}
.pos-suggest__item {
    display: grid; grid-template-columns: 90px 1fr 100px; gap: 12px; align-items: center;
    padding: 8px 12px; border: 0; background: transparent; text-align: left;
    width: 100%; cursor: pointer;
    font: inherit; font-size: 13px; color: var(--text);
    border-bottom: 1px solid var(--border);
}
.pos-suggest__item:last-child { border-bottom: 0; }
.pos-suggest__item:hover,
.pos-suggest__item.is-active { background: var(--accent-tint); }
.pos-suggest__nr    { font-variant-numeric: tabular-nums; font-weight: 500; }
.pos-suggest__bez   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-suggest__preis { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* Kompakt-Logo (Favicon) im eingeklappten Zustand — Spezifität muss
   `.sidebar__brand img` schlagen, sonst überschreibt display:block das display:none. */
.sidebar__brand .logo--compact { display: none; }

/* Sidebar-Collapse-Button (nur Desktop). Volle Breite unten in der Sidebar,
   über dem Nutzer-Menü — klickt Menü zwischen 248px und 68px um. */
.sidebar__collapse {
    display: flex; align-items: center; justify-content: flex-start; gap: 10px;
    width: calc(100% - 16px); margin: 6px 8px;
    padding: 8px 12px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-muted); cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 500;
    transition: color .12s, background .12s;
}
.sidebar__collapse:hover { background: var(--surface-2); color: var(--text); }
.sidebar__collapse-icon { width: 16px !important; height: 16px !important; transition: transform .2s ease; flex: none; }
body.nav-collapsed .sidebar__collapse-icon { transform: rotate(180deg); }
@media (max-width: 720px) { .sidebar__collapse { display: none; } }

/* Eingeklappte Sidebar — nur Desktop, Handy nutzt weiter das Overlay */
@media (min-width: 721px) {
    body.nav-collapsed .sidebar { width: 68px; }
    body.nav-collapsed .sidebar__brand { padding: 12px 8px; min-height: 68px; }
    body.nav-collapsed .sidebar__brand .logo--full { display: none; }
    body.nav-collapsed .sidebar__brand .logo--compact { display: block; height: 36px; width: auto; }
    body.nav-collapsed .nav { padding: 12px 8px; }
    body.nav-collapsed .nav__label { display: none; }
    body.nav-collapsed .nav__link { justify-content: center; padding: 10px 8px; gap: 0; }
    body.nav-collapsed .nav__link > span,
    body.nav-collapsed .nav__group-chev,
    body.nav-collapsed .user__meta,
    body.nav-collapsed .user__chev,
    body.nav-collapsed .sidebar__legal,
    body.nav-collapsed .sidebar__collapse-label { display: none; }
    body.nav-collapsed .nav__group { margin-top: 8px; }
    body.nav-collapsed .nav__group-body { display: none; }
    body.nav-collapsed .nav__link.is-active .nav__badge {
        position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px;
    }
    body.nav-collapsed .sidebar__foot { padding: 8px 6px; }
    body.nav-collapsed .user { justify-content: center; padding: 6px 0; }
    body.nav-collapsed .user-menu[open] .user-menu__panel { position: fixed; left: 76px; bottom: 60px; width: 220px; }
    body.nav-collapsed .sidebar__collapse {
        justify-content: center; padding: 10px 8px; margin: 6px 8px;
    }
}

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav__label {
    font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-subtle); padding: 6px 12px 8px;
}
/* Abstand vor weiteren Gruppen-Ueberschriften (zweite, dritte ...) */
.nav__label:not(:first-child) { margin-top: 16px; }
.nav__link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin: 2px 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500; font-size: 14px;
    position: relative; transition: background .12s, color .12s;
}
.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link.is-active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
/* Dark-Mode: aktiver Menüpunkt in weißer Schrift */
[data-theme="dark"] .nav__link.is-active {
    color: #ffffff;
}
[data-theme="dark"] .nav__link.is-active .ic,
[data-theme="dark"] .nav__link.is-active .nav__badge {
    color: #ffffff;
}
.nav__link .ic { width: 18px; height: 18px; opacity: .9; }
.nav__badge {
    margin-left: auto; flex: none;
    min-width: 20px; height: 20px; padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff;
    font-size: 11.5px; font-weight: 700; line-height: 1;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}
.nav__link.is-active .nav__badge { background: var(--accent-strong); }

/* Aufklappbares Nav-Obermenü (Systemeinstellungen). Nutzt natives <details>. */
.nav__group { margin-top: 16px; }
.nav__group > summary {
    list-style: none;                       /* Standard-Marker aus */
    cursor: pointer;
}
.nav__group > summary::-webkit-details-marker { display: none; }
.nav__group-chev {
    margin-left: auto;
    width: 14px !important; height: 14px !important;
    transition: transform .15s ease;
    opacity: .7;
}
.nav__group[open] > summary .nav__group-chev { transform: rotate(90deg); }
.nav__group-body { padding-left: 8px; margin: 2px 0 4px; }
.nav__link--sub {
    padding-left: 20px;                     /* leicht eingerückt gegenüber Top-Level */
    font-size: 13.5px;
}
.nav__link--sub .ic { width: 16px; height: 16px; }

.sidebar__foot { padding: 12px; border-top: 1px solid var(--border); }
.user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px; border-radius: var(--radius-sm);
}
.user__avatar {
    width: 34px; height: 34px; flex: none; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; letter-spacing: .02em;
}
.user__meta { min-width: 0; line-height: 1.3; }
.user__name { font-weight: 600; font-size: 13.5px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user__mail { font-size: 12px; color: var(--text-subtle);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* User-Menu (Mini-Popup ueber dem User): Klick auf User oeffnet Panel mit
   Einstellungen / Theme-Toggle / Abmelden. Nutzt natives <details>. */
.user-menu { position: relative; }
.user-menu > summary {
    list-style: none;
    cursor: pointer;
    outline: none;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary .user { flex: 1; }
.user-menu > summary:hover .user,
.user-menu[open] > summary .user { background: var(--surface-2); }
.user__chev {
    flex: none; width: 16px !important; height: 16px !important;
    margin-left: auto; margin-right: 4px;
    color: var(--text-subtle);
    transition: transform .15s ease;
}
.user-menu[open] .user__chev { transform: rotate(180deg); }

.user-menu__panel {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(15,23,42,.12));
    padding: 4px;
    z-index: 20;
}
.user-menu__form { margin: 0; }
.user-menu__item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 4px;
    background: transparent; border: 0;
    color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500;
    text-align: left; cursor: pointer;
    text-decoration: none;
}
.user-menu__item:hover { background: var(--surface-2); }
.user-menu__item.is-active { background: var(--accent-tint); color: var(--accent-strong); }
.user-menu__item .ic { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
.user-menu__item.is-active .ic { color: var(--accent-strong); }
.user-menu__item--danger { color: var(--danger, #b91c1c); }
.user-menu__item--danger .ic { color: var(--danger, #b91c1c); }
.user-menu__item--danger:hover { background: color-mix(in srgb, var(--danger, #b91c1c) 8%, transparent); }

/* Theme-Toggle im Menu: nur passendes Icon + Label anzeigen */
.user-menu__item .ic--moon,
.user-menu__item .ic--moon-label { display: none; }
[data-theme="dark"] .user-menu__item .ic--sun,
[data-theme="dark"] .user-menu__item .ic--sun-label { display: none; }
[data-theme="dark"] .user-menu__item .ic--moon,
[data-theme="dark"] .user-menu__item .ic--moon-label { display: inline-flex; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 30px;
    display: flex; align-items: center; gap: 12px;
}
.topbar__title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: var(--text); margin-right: auto; }
.topbar__sub { font-size: 13px; color: var(--text-subtle); }

/* Topbar: User-Menü rechts */
.user-menu--topbar { position: relative; margin-left: 8px; }
.user-menu--topbar > summary { padding: 0; }
.user--compact {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 8px 4px 4px; border-radius: 999px;
    transition: background .12s;
}
.user--compact:hover { background: var(--surface-2); }
.user--compact .user__avatar { width: 32px; height: 32px; font-size: 12.5px; }
.user--compact .user__chev {
    width: 14px !important; height: 14px !important;
    margin: 0; color: var(--text-subtle);
}
.user-menu--topbar[open] > summary .user--compact { background: var(--surface-2); }
.user-menu--topbar .user-menu__panel {
    top: calc(100% + 8px);
    bottom: auto;
    left: auto;
    right: 0;
    width: 240px;
}
.user-menu__header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    margin: -4px -4px 4px;
}
.user-menu__header .user__name {
    font-size: 13.5px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-menu__header .user__mail {
    font-size: 12px; color: var(--text-subtle); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__menu {
    display: none; /* nur in der mobilen Ansicht sichtbar */
    flex: none; align-self: center;
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    margin: -6px 6px -6px -8px;
    border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-muted); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.topbar__menu .ic { width: 22px; height: 22px; }
.topbar__menu:hover, .topbar__menu:active { background: var(--surface-2); color: var(--text); }

/* Abdunklung hinter der mobilen Sidebar */
.backdrop {
    position: fixed; inset: 0; z-index: 25;
    background: rgba(16,24,40,.45);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

/* Voll ausnutzen: Inhalte (v. a. Tabellen) so breit wie die Seite es hergibt. */
.content { padding: 26px 30px; width: 100%; }

/* ---------- Cards / Stats ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.card--pad { padding: 22px 24px; }

.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stat__label {
    font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-subtle);
}
.stat__value { font-size: 30px; font-weight: 680; letter-spacing: -.02em; margin-top: 8px; line-height: 1; }
.stat__value--ok { color: var(--ok); }
.stat__hint { font-size: 12.5px; color: var(--text-subtle); margin-top: 8px; }

.section-title { font-size: 15px; font-weight: 650; margin: 0 0 6px; }
.prose { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin: 0; max-width: 78ch; }

/* Key-Value-Liste (Detailansichten) */
.kv { margin: 0; }
.kv__row { display: grid; grid-template-columns: 240px 1fr; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.kv__row:last-child { border-bottom: 0; }
.kv__key { color: var(--text-muted); font-size: 13.5px; }
.kv__val { color: var(--text); word-break: break-word; }
.kv__val--strong { font-weight: 600; }
@media (max-width: 560px) { .kv__row { grid-template-columns: 1fr; gap: 4px; } }

.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13.5px; }
.backlink:hover { color: var(--text); }

/* Anhangs-Indikator in der Mailuebersicht (index.blade.php) */
.mail-subject { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.mail-subject__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mail-subject__clip { width: 14px; height: 14px; flex: none; color: var(--text-subtle); transform: rotate(45deg); }

/* Read-Status in der Mailuebersicht: ungelesen = fett, gelesen = normal + gedaempft. */
.mail-row a.linkcell { color: var(--text-muted); font-weight: 400; }
.mail-row--unseen a.linkcell { color: var(--text); font-weight: 650; }
.mail-row--unseen .mail-subject__clip { color: var(--accent); }

/* ---------- Mailprogramm-Look: Konto-Switcher (Pills mit Avatar) ---------- */
.mail-accounts {
    display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.mail-account {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 5px 14px 5px 5px;
    border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-muted); text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
    max-width: 100%;
}
.mail-account:hover {
    background: var(--surface-2); color: var(--text); border-color: var(--border-strong);
}
.mail-account.is-active {
    background: var(--accent-tint); border-color: var(--accent);
    color: var(--accent-strong);
}
.mail-account__avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
    background: hsl(var(--hue, 210) 55% 90%);
    color: hsl(var(--hue, 210) 55% 30%);
}
.mail-account.is-active .mail-account__avatar {
    background: var(--accent); color: #fff;
}
.mail-account__label {
    display: flex; flex-direction: column; gap: 0; line-height: 1.15;
    min-width: 0;
}
.mail-account__name {
    font-size: 13.5px; font-weight: 600; color: inherit;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-account__addr {
    font-size: 11px; color: var(--text-subtle); font-weight: 400;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-account.is-active .mail-account__addr { color: var(--accent-strong); opacity: .7; }
.mail-account__badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 7px;
    background: var(--accent); color: #fff;
    border-radius: 999px; font-size: 11.5px; font-weight: 700;
    flex-shrink: 0;
}
.mail-account.is-active .mail-account__badge {
    background: var(--accent-strong);
}
@media (max-width: 720px) {
    .mail-account__addr { display: none; }
    .mail-account { padding: 4px 12px 4px 4px; }
    .mail-account__avatar { width: 26px; height: 26px; font-size: 12.5px; }
}

/* ---------- Mailprogramm-Look: Ordner-Tabs + Suchleiste + Kartenliste ---------- */
.mail-toolbar {
    display: flex; align-items: center;
    gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.mail-toolbar__folders { display: flex; gap: 4px; flex-wrap: wrap; }

/* Prominenter "Verfassen"-Button — links, Pill, Markenblau (Gmail-Stil). */
.btn-compose {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px 10px 16px;
    background: var(--accent); color: #fff; text-decoration: none;
    border-radius: 999px; font-weight: 600; font-size: 14px;
    box-shadow: 0 2px 8px rgba(22,104,227,.22), 0 1px 2px rgba(16,24,40,.06);
    transition: background .12s, box-shadow .12s, transform .06s;
}
.btn-compose:hover { background: var(--accent-strong); box-shadow: 0 4px 12px rgba(22,104,227,.28), 0 1px 2px rgba(16,24,40,.08); }
.btn-compose:active { transform: translateY(1px); }
.btn-compose svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; }

/* Aktualisieren-Icon rechts, dezent runder Button. */
.mail-refresh {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-muted); text-decoration: none;
    margin-left: auto;
    transition: background .12s, color .12s, border-color .12s;
}
.mail-refresh:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.mail-refresh .ic { width: 15px; height: 15px; }
.mail-folder {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; font-size: 14px; font-weight: 500; color: var(--text-muted);
    border-radius: var(--radius-sm); text-decoration: none;
    transition: background .12s, color .12s;
}
.mail-folder .ic { width: 16px; height: 16px; opacity: .8; }
.mail-folder:hover { background: var(--surface-2); color: var(--text); }
.mail-folder.is-active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
.mail-folder.is-active .ic { opacity: 1; }

.mail-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-card);
}
.mail-panel__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 10px 12px 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    flex-wrap: wrap;
}
.mail-search {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 14px;
    flex: 1 1 240px; min-width: 200px; max-width: 460px;
    transition: border-color .12s, box-shadow .12s;
}
.mail-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.mail-search__ic { width: 15px; height: 15px; color: var(--text-subtle); flex-shrink: 0; }
.mail-search__input {
    flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
    font: inherit; font-size: 13.5px; color: var(--text); padding: 2px 0;
}
.mail-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.mail-panel__select { display: flex; align-items: center; gap: 8px; }
.mail-select-all {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 8px; border-radius: var(--radius-sm);
    color: var(--text-subtle); font-size: 12.5px;
    cursor: pointer; user-select: none;
}
.mail-select-all input[type="checkbox"] { accent-color: var(--accent); }
.mail-select-all__hint { white-space: nowrap; }

.maillist { display: flex; flex-direction: column; }
.maillist__row {
    display: grid;
    grid-template-columns: 40px 1fr;
    align-items: center;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
    position: relative;
}
.maillist__row:last-child { border-bottom: 0; }
.maillist__row:hover { background: var(--surface-2); }
.maillist__row:hover .maillist__check { opacity: 1; }
.maillist__row:has(input.row-check:checked) { background: var(--accent-tint); }
.maillist__row:has(input.row-check:checked) .maillist__check { opacity: 1; }

.maillist__check {
    display: flex; align-items: center; justify-content: center;
    height: 100%; padding: 0 0 0 14px;
    cursor: pointer; opacity: .35; transition: opacity .12s;
}
.maillist__check input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }

.maillist__body {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-column-gap: 14px;
    grid-row-gap: 3px;
    padding: 12px 16px 12px 6px;
    text-decoration: none; color: inherit;
    min-width: 0;
}
.maillist__avatar {
    grid-column: 1; grid-row: 1 / 3; align-self: center;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 15px; letter-spacing: .01em;
    background: hsl(var(--hue, 210) 55% 92%);
    color: hsl(var(--hue, 210) 55% 30%);
    flex-shrink: 0;
}
.maillist__from {
    grid-column: 2; grid-row: 1;
    font-size: 14px; font-weight: 500; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.maillist__prefix { color: var(--text-subtle); font-weight: 400; margin-right: 4px; }
.maillist__time {
    grid-column: 3; grid-row: 1; padding-left: 12px;
    font-size: 12px; color: var(--text-subtle); white-space: nowrap; align-self: baseline;
}
.maillist__subject {
    grid-column: 2; grid-row: 2;
    font-size: 13px; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.maillist__badges {
    grid-column: 3; grid-row: 2; padding-left: 12px;
    display: flex; gap: 8px; align-items: center; justify-content: flex-end;
}
.maillist__attach {
    width: 14px; height: 14px; color: var(--text-subtle);
    stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    transform: rotate(45deg);
}
.maillist__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* Ungelesen: Absender fett, Betreff normale Textfarbe, dezenter Balken links. */
.maillist__row.is-unseen::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 3px; background: var(--accent);
}
.maillist__row.is-unseen .maillist__from { font-weight: 700; }
.maillist__row.is-unseen .maillist__subject { color: var(--text); font-weight: 500; }

.maillist__empty {
    padding: 60px 20px; text-align: center; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 14px;
}

/* Handy: kleinere Avatare, kompakteres Padding, Suchleiste voll breit. */
@media (max-width: 720px) {
    .mail-toolbar { gap: 8px; }
    .mail-toolbar__folders { flex: 1 1 auto; }
    .mail-folder { padding: 7px 12px; font-size: 13.5px; }
    .mail-panel__head { padding: 8px 10px; }
    .mail-search { flex-basis: 100%; max-width: none; }
    .mail-select-all__hint { display: none; }
    .maillist__body { grid-template-columns: 34px minmax(0, 1fr) auto; grid-column-gap: 10px; padding: 10px 12px 10px 4px; }
    .maillist__avatar { width: 34px; height: 34px; font-size: 13.5px; }
    .maillist__check { padding-left: 10px; }
}

/* ---------- Compose: Kopf-/Fussleiste (Mail-App-Look) ---------- */
.compose { display: flex; flex-direction: column; }
.compose__body { padding: 22px 24px; }
.compose-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px 14px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.compose-bar--bottom {
    border-bottom: 0; border-top: 1px solid var(--border);
    justify-content: flex-end;
}
.compose-bar__title {
    margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--text);
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compose-bar__actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

@media (max-width: 720px) {
    .compose__body { padding: 16px 14px; }
    .compose-bar { padding: 12px 14px; }
    .compose-bar__title { font-size: 16px; }
}

/* ---------- Compose: Kopfzeilen dezent (Gmail-Stil) ---------- */
.compose__head {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}
.compose__row {
    display: grid;
    grid-template-columns: 66px 1fr;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}
.compose__row:last-child { border-bottom: 0; }
.compose__label {
    font-size: 12px; font-weight: 500;
    color: var(--text-subtle);
    letter-spacing: 0;
    margin: 0;
}
.compose__input {
    border: 0; outline: none;
    padding: 4px 0;
    background: transparent;
    font: inherit; font-size: 13.5px;
    color: var(--text);
    width: 100%;
}
.compose__input::placeholder { color: var(--text-subtle); opacity: .7; }
.compose__row:focus-within { background: var(--surface-2); }

/* ---------- Compose: WYSIWYG-Editor ---------- */
.editor {
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .12s, box-shadow .12s;
}
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.editor__toolbar {
    display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
    padding: 6px 8px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.editor__btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 8px;
    border: 1px solid transparent; border-radius: 6px;
    background: transparent; color: var(--text); cursor: pointer;
    font: inherit; font-size: 14px; line-height: 1;
    transition: background .12s, border-color .12s;
}
.editor__btn:hover { background: var(--surface); border-color: var(--border); }
.editor__btn:active { background: var(--accent-tint); }
.editor__btn .ic { width: 16px; height: 16px; }
.editor__sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor__area {
    min-height: 260px; max-height: 60vh; overflow-y: auto;
    padding: 16px 22px;
    font-size: 14px; line-height: 1.45; color: var(--text);
    outline: none;
}
/* Spacing identisch zu Vorschau + Sendedatei — was ich hier sehe, kommt beim Empfaenger genauso an. */
.editor__area p { margin: 0 0 6px; }
.editor__area p:has(> br:only-child) { margin: 0; line-height: 1; }
.editor__area blockquote {
    border-left: 3px solid #c8ced8; margin: 8px 0;
    padding: 4px 0 4px 12px; color: #3e4a5c;
}
.editor__area ul, .editor__area ol { margin: 4px 0 8px 22px; }
.editor__area img { max-width: 100%; max-height: 240px; height: auto; }
.editor__area a { color: var(--accent); }
.editor__area .signature { color: #5a6570; margin-top: 6px; }
.editor__area .signature img { max-width: 100%; height: auto; }

/* ---------- Compose: Drag-&-Drop-Zone ---------- */
.drop {
    border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
    padding: 18px 14px;
    background: var(--surface-2);
    text-align: center;
    transition: border-color .12s, background .12s;
    cursor: default;
}
.drop.is-hover { border-color: var(--accent); background: var(--accent-tint); }
.drop__hint { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13.5px; }
.drop__ic { width: 24px; height: 24px; color: var(--text-subtle); }
.drop__browse {
    background: none; border: 0; padding: 0; margin: 0;
    color: var(--accent-strong); font: inherit; font-weight: 600; cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px;
}
.drop__browse:hover { color: var(--accent); }
.drop__list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.drop__item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
}
.drop__item-ic { width: 14px; height: 14px; flex: none; color: var(--text-subtle); transform: rotate(45deg); }
.drop__item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.drop__item-size { flex: none; font-size: 12.5px; color: var(--text-subtle); }
.drop__item-remove {
    flex: none; width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-muted); cursor: pointer;
}
.drop__item-remove:hover { background: var(--danger-tint); color: var(--danger); border-color: var(--danger); }
.drop__item-remove .ic { width: 14px; height: 14px; }

/* Mail-Anlagen (show.blade.php) */
.attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attachment {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface);
}
.attachment:hover { border-color: var(--border-strong); background: var(--surface-2); }
.attachment__ic { width: 16px; height: 16px; flex: none; color: var(--text-subtle); transform: rotate(45deg); }
.attachment__name {
    flex: 1; min-width: 0;
    font-size: 13.5px; font-weight: 500; color: var(--accent-strong);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attachment__name:hover { text-decoration: underline; }
.attachment__meta { flex: none; font-size: 12.5px; color: var(--text-subtle); }

/* ---------- Systemstatus-Dashboard ---------- */
.srv + .srv { margin-top: 18px; }
.srv__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.srv__title { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 650; letter-spacing: -.01em; color: var(--text); }
.srv__ic { width: 30px; height: 30px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.srv__ic .ic { width: 17px; height: 17px; }
.srv__ic--app { background: var(--accent-tint); color: var(--accent); }
.srv__ic--doc { background: #fdf4e3; color: #c98a00; }
.srv__meta { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-subtle); }

.srv__grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.srv__grid + .srv__grid { margin-top: 14px; }

/* Metrik-Kachel (heller Innen-Block) */
.metric { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 15px 16px; }
.metric--wide { grid-column: 1 / -1; }
.metric__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric__name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.metric__name .ic { width: 15px; height: 15px; color: var(--text-muted); }
.metric__pct { font-size: 15px; font-weight: 680; letter-spacing: -.01em; color: var(--text); }

.meter { height: 7px; border-radius: 99px; background: var(--border); overflow: hidden; margin-top: 12px; }
.meter__fill { height: 100%; border-radius: 99px; background: var(--ok); min-width: 4px; }
.meter__fill--warn { background: #c98a00; }
.meter__fill--bad  { background: var(--danger); }
.metric__foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; font-size: 12px; color: var(--text-muted); }
.metric__note { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-subtle); display: flex; align-items: center; gap: 6px; }
.metric__note .ic { width: 14px; height: 14px; }

/* kompakte Fakten-Liste innerhalb einer Kachel */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 12px 0 0; font-size: 13px; }
.facts dt { color: var(--text-muted); white-space: nowrap; }
.facts dd { margin: 0; color: var(--text); }
.facts dd.is-strong { font-weight: 600; }

/* Dienst-Zeile */
.svc { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.svc + .svc { margin-top: 8px; }
.svc__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ok); }
.svc__dot--off { background: var(--danger); }
.svc__name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.svc__role { color: var(--text-subtle); font-size: 12.5px; }
.svc__badge { margin-left: auto; }

.sys-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; font-size: 13px; }
a.linkcell { color: var(--accent); font-weight: 600; }
a.linkcell:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
    text-align: left; padding: 12px 14px;
    font-size: 13px; font-weight: 600;
    color: var(--text-muted); background: var(--surface-2);
    border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
/* Einheitliche Tabellenschrift: gleiche Familie/Größe/Farbe; Hervorhebung nur via Fett.
   Umbruch erlaubt (long-text-Spalten setzen ggf. max-width). */
table.data tbody td {
    padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top;
    color: var(--text); font-size: 13.5px; line-height: 1.45;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.is-clickable { cursor: pointer; }
table.data .col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data .col-sub { color: var(--text-subtle); font-size: 12.5px; margin-top: 2px; }

/* ---------- CRM-Style Detail-/Editseite ---------- */
.crm-toolbar {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px;
    min-height: 52px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    position: sticky; top: 0; z-index: 5;
    box-shadow: var(--shadow-sm);
}
.crm-toolbar__back {
    color: var(--text-muted); font-weight: 600; font-size: 13px;
    padding: 4px 4px;
}
.crm-toolbar__back:hover { color: var(--accent-strong); }
.crm-toolbar__title {
    flex: 1; font-family: var(--font-headline); font-size: 15px; color: var(--text);
    font-weight: 600; letter-spacing: .01em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crm-toolbar__meta { font-family: var(--font); font-weight: 400; color: var(--text-subtle); font-size: 12.5px; }
.crm-toolbar__actions { display: flex; gap: 8px; align-items: center; }

.crm-split {
    display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px;
    align-items: start;
}
.crm-main { min-width: 0; }
.crm-side {
    position: sticky; top: 78px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    overscroll-behavior: contain;
    /* dezente Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    padding-right: 4px;
}
.crm-side::-webkit-scrollbar { width: 6px; }
.crm-side::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.crm-side::-webkit-scrollbar-track { background: transparent; }

.crm-section-title {
    font-family: var(--font-headline);
    font-size: 13px; font-weight: 600; color: var(--text-muted);
    letter-spacing: .02em;
    padding-bottom: 10px; margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.crm-section-title--on-tint { border-bottom-color: var(--accent-strong); color: var(--accent-strong); }

.crm-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field__hint { font-weight: 400; color: var(--text-subtle); font-size: 12px; margin-left: 4px; }

.crm-calc { background: var(--accent-tint); border-color: transparent; }
.crm-calc__row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 8px 0; font-size: 13.5px; color: var(--text);
}
.crm-calc__row + .crm-calc__row { border-top: 1px dashed rgba(47,117,70,.25); }
.crm-calc__row--total {
    font-family: var(--font-headline);
    font-size: 17px; font-weight: 700; color: var(--accent-strong);
    margin-top: 4px; padding-top: 12px;
    border-top: 2px solid var(--accent-strong) !important;
}

@media (max-width: 900px) {
    .crm-split { grid-template-columns: 1fr; }
    .crm-side { position: static; }
    .crm-toolbar { position: static; }
}

/* ---------- CRM Datenblatt-Zeilen (Label links, Wert rechts klick-editierbar) ---------- */
.dl { display: grid; }
.dl__row {
    display: grid; grid-template-columns: 170px minmax(0, 1fr);
    gap: 20px; padding: 8px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.dl__row:has(textarea) { align-items: start; }
.dl__row:has(textarea) .dl__label { padding-top: 10px; }
.dl__row:last-child { border-bottom: 0; }
.dl__label {
    font-size: 12.5px; color: var(--text-subtle); font-weight: 600;
    letter-spacing: .01em;
}
.dl__label small { font-weight: 400; color: var(--text-subtle); font-size: 11.5px; display: block; margin-top: 2px; }

/* CRM-Input: dezent sichtbarer Rahmen im Ruhezustand, deutlicher bei Hover/Fokus. */
.crm-input {
    display: block; width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 7px 10px;
    color: var(--text);
    font-family: var(--font-headline);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: .015em;
    line-height: 1.4;
    outline: none;
    transition: background .12s, border-color .12s, box-shadow .12s;
    box-sizing: border-box;
}
textarea.crm-input { resize: vertical; min-height: 34px; font-family: var(--font-headline); }
.crm-input:hover:not(:focus) { background: var(--surface); border-color: var(--border-strong); }
.crm-input:focus {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
/* Placeholder wenn Wert leer: dezenter Hinweis, nicht kursiv */
.crm-input::placeholder { color: var(--text-subtle); font-style: normal; }
/* Zahleneingaben rechtsbündig */
.crm-input.tnum { text-align: right; }

/* --------------------------------------------------------------
   <select>-Styling: eigener SVG-Chevron rechts, Oswald-Font,
   konsistente Padding/Border-Verhältnisse. Hover/Focus ändert nur
   den Border — der Chevron bleibt statisch (robuster in Chrome/FF).
   -------------------------------------------------------------- */
select.crm-input,
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--surface-2);
    background-image: url("/img/chevron-down.svg");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 7px;
    padding-right: 32px;
    cursor: pointer;
}
select.crm-input::-ms-expand,
select::-ms-expand { display: none; }
select.crm-input:disabled { color: var(--text-subtle); cursor: not-allowed; opacity: .7; }

/* --------------------------------------------------------------
   Custom-Select-Widget: die per public/js/custom-select.js
   erzeugte Div-basierte Dropdown-Alternative — damit auch die
   aufgeklappte Optionsliste vollständig per CSS stylbar ist.
   -------------------------------------------------------------- */
.cs { position: relative; display: block; }
.cs__native {
    /* Original-<select> unsichtbar aber im Form (wichtig für Auto-Save etc.) */
    position: absolute; opacity: 0; pointer-events: none;
    width: 1px; height: 1px; overflow: hidden;
}
.cs__control {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; text-align: left;
    background: var(--surface-2);
    background-image: url("/img/chevron-down.svg");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 7px;
    padding: 7px 32px 7px 10px;
    color: var(--text);
    font-family: var(--font-headline);
    font-weight: 400;
    letter-spacing: .015em;
    cursor: pointer;
}
.cs--open .cs__control,
.cs__control:focus {
    background-color: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
    outline: none;
}
.cs__value {
    flex: 1 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.cs__menu {
    position: absolute; z-index: 100;
    top: calc(100% + 4px); left: 0; right: 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(15,23,42,.12);
    padding: 4px;
    max-height: 260px; overflow-y: auto;
}
.cs__option {
    padding: 7px 12px;
    border-radius: 4px;
    color: var(--text);
    font-family: var(--font-headline);
    font-weight: 400;
    letter-spacing: .015em;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cs__option:hover              { background: var(--surface-2); }
.cs__option--selected          { background: var(--accent-tint, #e0eef8); color: var(--accent-strong, #075985); font-weight: 500; }
.cs__option--selected:hover    { background: var(--accent-tint, #e0eef8); }
.cs__option--disabled          { color: var(--text-subtle); cursor: not-allowed; opacity: .6; }

.cs--disabled { opacity: .7; pointer-events: none; }

/* Search-Input: dezente Lupe links */
input[type="search"].crm-input,
input[type="search"] {
    background-image: url("/img/search-icon.svg");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 14px 14px;
    padding-left: 32px;
}
input[type="search"].crm-input::-webkit-search-decoration,
input[type="search"].crm-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* Rechte Sidebar: schmaleres dl-Grid (Label über Wert wo Platz eng ist) */
.crm-side .dl__row { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
.crm-side .crm-input { padding: 6px 8px; }

/* Input mit Einheit-Suffix (z. B. Zahl + "Tage"/"%") — fixe Suffix-Spalte, damit
   mehrere Zeilen mit unterschiedlichen Einheiten trotzdem gleich breite Inputs haben. */
.input-with-suffix {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
}
.input-with-suffix .crm-input { text-align: right; font-variant-numeric: tabular-nums; }
.input-with-suffix__unit { color: var(--text-subtle); font-size: 12.5px; }

/* Gruppierungszeilen in table.data (z. B. Vorlagen-Uebersicht nach Belegart).
   Hebt Sektion visuell ab, aber Datenzeilen darunter behalten Spaltenflucht. */
.data-group td {
    background: var(--surface-2);
    padding: 8px 14px !important;
    border-bottom: 1px solid var(--border-strong) !important;
    border-top: 1px solid var(--border-strong);
}
.data-group__title {
    font-family: var(--font-headline); font-size: 13px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
    color: var(--text);
}
.data-group__count { color: var(--text-subtle); font-weight: 400; font-size: 12px; margin-left: 6px; }
.data-group__action { margin-left: 16px; font-size: 12.5px; color: var(--accent-strong); }
.data-group__action:hover { color: var(--accent); }
.data-empty td { color: var(--text-subtle); font-style: italic; padding: 10px 14px !important; }

/* Tab-Navigation innerhalb einer Detailansicht (z. B. Kunde: Stammdaten | Ansprechpartner) */
.crm-tabs {
    display: flex; gap: 4px;
    margin: 0 0 12px;
    border-bottom: 1px solid var(--border);
}
.crm-tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px;
    color: var(--text-muted);
    font-size: 13.5px; font-weight: 600;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    transition: color .12s, border-color .12s, background .12s;
}
.crm-tab:hover { color: var(--text); background: var(--surface-2); }
.crm-tab.is-active {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
}
.crm-tab__badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 18px; padding: 0 6px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px; font-weight: 700;
    border-radius: 4px;
    line-height: 1;
}
.crm-tab.is-active .crm-tab__badge { background: var(--accent-tint); color: var(--accent-strong); }

/* Kontakte-Zeilen im Ansprechpartner-Tab (inline-editierbar, mehrere Zeilen im Grid) */
.kontakt-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.kontakt-row:last-child { border-bottom: 0; }
.kontakt-row.is-deleted {
    opacity: .35;
    text-decoration: line-through;
}
.kontakt-row__grid {
    display: grid;
    grid-template-columns: 160px 90px 1fr 1fr 140px 200px 1fr 36px;
    gap: 10px;
    align-items: end;
}
@media (max-width: 1280px) {
    .kontakt-row__grid { grid-template-columns: 1fr 1fr 1fr 36px; }
    .kontakt-row__field--wide { grid-column: 1 / -2; }
}
.kontakt-row__label {
    display: block;
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--text-subtle); margin-bottom: 4px;
}
.kontakt-row__actions {
    display: flex; align-items: end; justify-content: flex-end;
}
.kontakt-row__actions .btn {
    width: 36px; height: 36px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
}

/* Firmen-Logo Preview im Unternehmen-Editor */
.logo-preview {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.logo-preview img { max-width: 100%; max-height: 80px; display: block; }
.logo-preview__path { font-size: 11.5px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }

/* Kunden-Editansicht: zweispaltiges Karten-Grid, damit Firma+Ansprechpartner und
   Anschrift+Bank jeweils nebeneinander liegen. Notizen spannt beide Spalten. */
.crm-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
.crm-cards-grid__wide { grid-column: 1 / -1; }
@media (max-width: 900px) {
    .crm-cards-grid { grid-template-columns: 1fr; }
}

/* Photon-Adress-Autovervollstaendigung (siehe public/js/kunde-photon.js) */
.photon-wrap { position: relative; }
.photon-suggest {
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    z-index: 20;
    margin: 0; padding: 4px 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow-card);
    max-height: 260px;
    overflow-y: auto;
    font-size: 13px;
}
.photon-suggest li {
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text);
    line-height: 1.35;
}
.photon-suggest li:hover,
.photon-suggest li.is-selected {
    background: var(--accent-tint);
    color: var(--accent-strong);
}

@media (max-width: 640px) {
    .dl__row { grid-template-columns: 1fr; gap: 2px; padding: 10px 0; }
    .dl__label { padding-top: 0; }
    .crm-side .dl__row { grid-template-columns: 1fr; }
}

/* CRM-Checkbox als saubere Zeile im dl */
.dl__checkbox {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin: -8px -10px;
    border-radius: 4px; cursor: pointer;
    color: var(--text); font-size: 14px;
}
.dl__checkbox:hover { background: var(--surface-2); }
.dl__checkbox input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.cell-strong { font-weight: 600; }   /* einzige erlaubte Hervorhebung in Tabellen */
.nowrap { white-space: nowrap; }

/* Sortierbare Kopfzellen (per app.js automatisch aktiviert) */
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--text-muted); }
table.data thead th.sortable::after {
    content: ""; display: inline-block; width: 0; height: 0; margin-left: 7px; vertical-align: middle;
    border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-bottom: 5px solid currentColor; opacity: .28;
}
table.data thead th.sort-asc::after  { opacity: .85; border-top: 0; border-bottom: 5px solid currentColor; }
table.data thead th.sort-desc::after { opacity: .85; border-bottom: 0; border-top: 5px solid currentColor; }

/* ---------- Aufklappbare Verlaufszeilen (Signage-Tagesdetails) ---------- */
th.col-toggle, td.col-toggle { width: 1%; padding-left: 8px; text-align: right; white-space: nowrap; }
tr.hist-row { cursor: pointer; transition: background .12s; }
tr.hist-row:hover { background: var(--surface-2); }
tr.hist-row.is-open { background: var(--accent-tint); }

/* Heute-Kennzeichnung: dezenter Left-Balken + kleines Badge im Datum. */
tr.is-today > td:first-child { position: relative; box-shadow: inset 3px 0 0 var(--accent); }
.today-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; margin-left: 8px;
    background: var(--accent); color: #fff;
    border-radius: 999px;
    font-size: 10.5px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
    vertical-align: middle;
    line-height: 1.25;
}

/* Aufklapp-Pill = echter Button, damit Rendering/Barrierefreiheit robust bleiben. */
.hist-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 8px 5px 12px;
    background: var(--surface); color: var(--accent-strong);
    border: 1px solid var(--border-strong); border-radius: 999px;
    font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1;
    white-space: nowrap; cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.hist-toggle:hover { background: var(--accent-tint); border-color: var(--accent); }
.hist-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hist-toggle__label { pointer-events: none; }
.hist-toggle__chevron {
    width: 14px; height: 14px; flex-shrink: 0;
    stroke: currentColor; fill: none;
    stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
    transition: transform .18s ease;
    pointer-events: none;
}
tr.hist-row.is-open .hist-toggle {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
tr.hist-row.is-open .hist-toggle__chevron { transform: rotate(180deg); }

tr.detail-row > td { padding: 0; background: var(--surface-2); white-space: normal; }
tr.detail-row:hover > td { background: var(--surface-2); }
.signage-detail { padding: 14px 16px; }
.signage-detail__stats {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    margin-bottom: 12px; color: var(--text-muted); font-size: 13px;
}
.signage-detail__stats strong { color: var(--text); font-weight: 600; }
.signage-detail__label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 0 0 6px; }
table.data.data--nested {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}
table.data.data--nested thead th { padding: 8px 14px; }
table.data.data--nested tbody td { padding: 8px 14px; }

/* ---------- Balkendiagramm (Signage 30-Tage-Verlauf) ---------- */
.sigchart-legend { display: flex; gap: 18px; align-items: center; margin: 0 0 8px; font-size: 12.5px; color: var(--text-muted); }
.sigchart-legend__key { display: inline-flex; align-items: center; gap: 7px; }
.sigchart-legend__swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: var(--accent); }
.sigchart-legend__swatch--pass { opacity: .30; }
.sigchart-wrap { width: 100%; }
/* aspect-ratio wird pro SVG inline gesetzt (viewBox-abhaengig, kein Leerraum in der Box). */
.sigchart-wrap svg { width: 100%; height: auto; display: block; }
@media (max-width: 720px) {
    /* Mobil: SVG bewahrt weiter Aspect-Ratio (kein Stauchen). Weil das SVG
       auf einem 350px-Screen dann nur ca. 93px hoch ist, werden die Text-
       Elemente in viewBox-Units groesser skaliert (24-28 statt 11). */
    .sigchart-axis { font-size: 26px; }
    .sigchart-peak { font-size: 26px; }
    .sigchart-bar--stop { stroke-width: 2.2; }
    .sigchart-legend { font-size: 13px; margin-bottom: 6px; }
    /* KPI-Kacheln (Vorbeilaeufer/Stopper/Quote/Verweildauer) auf Handy kompakter. */
    .grid--stats > .card--pad { padding: 14px 16px; }
    .grid--stats .stat__value { font-size: 24px; margin-top: 4px; }
    .grid--stats .stat__label { font-size: 11px; letter-spacing: .04em; }
    .grid--stats .stat__hint  { font-size: 12px; margin-top: 5px; }
    /* Pager auf schmalen Screens: kompaktere Buttons, rechtsbuendig. */
    .signage-pager .btn { padding: 6px 10px; }
    .signage-pager__nav { flex: 1; justify-content: flex-end; }
}
.sigchart-bar--pass { fill: var(--accent); fill-opacity: .28; }
.sigchart-bar--stop { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.sigchart-hit { fill: var(--accent); fill-opacity: 0; pointer-events: all; cursor: pointer; }
.sigchart-hit:hover { fill-opacity: .07; }

/* Info-Box: leer versteckt, per JS gefuellt beim Antippen eines Balkens. */
.sigchart-info {
    background: var(--accent-tint);
    color: var(--accent-strong);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 550;
    margin: -8px 0 12px;
}
.sigchart-info[hidden] { display: none; }
.sigchart-grid { stroke: var(--border); stroke-width: 1; }
.sigchart-axis-line { stroke: var(--border-strong); stroke-width: 1; }
.sigchart-axis { fill: var(--text-subtle); font-size: 11px; font-family: var(--font); }
.sigchart-peak { fill: var(--text); font-size: 11px; font-weight: 600; font-family: var(--font); }

/* Kopfzeile der Signage-Admin-Seite: Excel-Export + "Link teilen" nebeneinander. */
.signage-topbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* Signage-Tabellen: auf Handy (<=720px) zu Karten stapeln, damit nichts seitlich scrollt. */
@media (max-width: 720px) {
    .signage-mobile-cards { overflow: visible; }
    .signage-mobile-cards table.data,
    .signage-mobile-cards table.data thead,
    .signage-mobile-cards table.data tbody,
    .signage-mobile-cards table.data tr { display: block; width: 100%; }
    .signage-mobile-cards table.data thead { display: none; }
    /* Aufklapp-Detailzeilen bleiben zugeklappt bis der User sie oeffnet. */
    .signage-mobile-cards table.data tbody tr[hidden] { display: none; }
    .signage-mobile-cards table.data tbody tr {
        position: relative;
        padding: 14px 16px 12px;
        border-bottom: 1px solid var(--border);
    }
    .signage-mobile-cards table.data tbody tr:last-child { border-bottom: 0; }
    .signage-mobile-cards table.data tbody td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        padding: 4px 0;
        border: 0;
        white-space: normal;
    }
    .signage-mobile-cards table.data tbody td[data-label]::before {
        content: attr(data-label);
        color: var(--text-subtle);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: .04em;
        text-transform: uppercase;
        flex-shrink: 0;
    }
    .signage-mobile-cards table.data tbody td[data-mobile-role="header"] {
        display: block;
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
        padding: 0 0 6px;
        margin-bottom: 8px;
        border-bottom: 1px dashed var(--border);
    }
    .signage-mobile-cards table.data tbody td[data-mobile-role="subheader"] {
        display: block;
        font-size: 12.5px;
        color: var(--text-muted);
        padding: 0 0 8px;
        margin-top: -6px;
    }
    /* Aufklapp-Trigger auf Mobile: volle Breite ganz unten in der Karte.
       Ausgeschrieben mit !important, weil die allgemeinen mobile-cards-Regeln
       (display: flex auf td) sonst um die Renderreihenfolge kaempfen. */
    .signage-mobile-cards table.data tbody td[data-mobile-role="toggle"] {
        display: block !important;
        padding: 0 !important;
        margin: 12px 0 0 !important;
        text-align: center !important;
        white-space: normal !important;
        width: 100% !important;
    }
    .signage-mobile-cards table.data tbody td[data-mobile-role="toggle"]::before { content: none !important; }
    .signage-mobile-cards table.data tbody td[data-mobile-role="toggle"] button.hist-toggle {
        display: flex !important;
        width: 100% !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 12px 14px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }
    .signage-mobile-cards table.data tbody td[data-mobile-role="empty"] { display: block; }

    /* Heute-Balken auf Mobile: linker Rand der ganzen Karte, nicht nur des ersten TD. */
    .signage-mobile-cards tr.is-today > td:first-child { box-shadow: none; }
    .signage-mobile-cards tr.is-today { box-shadow: inset 3px 0 0 var(--accent); }

    /* Verschachtelte Detail-Tabellen (Stopper je Tag) bleiben klassische 2-Spalten-Tabelle. */
    .signage-mobile-cards table.data.data--nested,
    .signage-mobile-cards table.data.data--nested thead,
    .signage-mobile-cards table.data.data--nested tbody,
    .signage-mobile-cards table.data.data--nested tr { display: revert; }
    .signage-mobile-cards table.data.data--nested tbody tr { padding: 0; position: static; border-bottom: 1px solid var(--border); }
    .signage-mobile-cards table.data.data--nested tbody td { display: table-cell; padding: 8px 14px; white-space: nowrap; border-bottom: 1px solid var(--border); }
    .signage-mobile-cards table.data.data--nested tbody td::before { content: none; }

    /* Detail-Zeile (Aufklapp): weiter block, damit sie voll aufbaut */
    .signage-mobile-cards tr.detail-row { padding: 0; border-bottom: 1px solid var(--border); }
    .signage-mobile-cards tr.detail-row > td { display: block; padding: 0; }
    .signage-mobile-cards tr.detail-row > td::before { content: none; }
}

/* Read-only-Ansicht (public link, ohne Login) — eigener Rahmen ohne Sidebar. */
.public-view { background: var(--bg); min-height: 100vh; }
.public-shell { max-width: 1240px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 40px) 32px; display: flex; flex-direction: column; min-height: 100vh; }
.public-header { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.public-header__brand { height: 40px; width: auto; flex-shrink: 0; }
.public-header__meta { min-width: 0; }
.public-header__title { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.public-header__sub { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.public-main { flex: 1; padding: 0 !important; }
.public-footer { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-subtle); text-align: center; }
.public-footer a { color: var(--accent); text-decoration: none; }
.public-footer a:hover { text-decoration: underline; }

@media (max-width: 720px) {
    .public-shell { padding: 16px 14px 24px; }
    .public-header { gap: 12px; padding-bottom: 14px; margin-bottom: 16px; }
    .public-header__brand { height: 32px; }
    .public-header__title { font-size: 18px; line-height: 1.15; }
    .public-header__sub { font-size: 12px; margin-top: 3px; }
}
@media (max-width: 420px) {
    .public-header__brand { height: 28px; }
    .public-header__title { font-size: 16px; }
    .public-header__sub { font-size: 11.5px; }
}

/* Zwei Signage-Charts nebeneinander (auf breiten Screens), gestapelt auf schmalen. */
.signage-charts-grid { display: grid; gap: 16px 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.signage-charts-grid__item { min-width: 0; display: flex; flex-direction: column; }
.signage-charts-grid__item > .card { margin-top: auto; }
.signage-charts-grid__item > .muted { min-height: 2.6em; }
/* Zwei Chart-Varianten: breit = hoeher (fuellt die Box), schmal = wie gehabt. */
.sig-chart--narrow { display: none; }
@media (max-width: 1100px) {
    .signage-charts-grid { grid-template-columns: 1fr; }
    .signage-charts-grid__item > .muted { min-height: 0; }
    .sig-chart--wide { display: none; }
    .sig-chart--narrow { display: block; }
}

/* ---------- Badge ---------- */
/* Badges: leicht abgerundet (nicht pill) — CRM-Style */
.badge {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 3px 8px; border-radius: 4px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.badge--on  { background: var(--ok-tint); color: var(--ok); }
.badge--on::before  { background: var(--ok); box-shadow: 0 0 0 3px rgba(21,146,79,.14); }
.badge--off { background: var(--danger-tint); color: var(--danger); }
.badge--off::before { background: var(--danger); }
/* Semantische Status-Badges (z. B. Update-Status) */
.badge--ok { background: var(--ok-tint); color: var(--ok); }
.badge--ok::before { background: var(--ok); }
.badge--warn { background: #fdf4e3; color: #8a5a00; }
.badge--warn::before { background: #c98a00; }
.badge--idle { background: var(--surface-2); color: var(--text-muted); }
.badge--idle::before { background: var(--idle); }
.badge--danger { background: var(--danger-tint); color: var(--danger); }
.badge--danger::before { background: var(--danger); }
/* Prüfungs-Ergebnis-Badges: "Nicht in Ordnung" (semantisches Gegenstück zu badge--ok) */
.badge--err { background: #fee4e2; color: #8a2018; }
.badge--err::before { background: #8a2018; }

/* ---------- Feststellungs-Tabelle (Modul 3) ---------- */
.feststellung-table tbody tr.row-bestaetigt { background: rgba(47,117,70,.04); }
.feststellung-table tbody tr.row-ignoriert  { opacity: .55; }
.feststellung-table tbody td { vertical-align: top; }

.match-info__meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; font-size: 12.5px; }
.match-score {
    padding: 1px 7px; border-radius: 4px; font-weight: 700; font-size: 11.5px;
    background: var(--surface-2); color: var(--text-muted);
}
.match-score--sicher     { background: var(--ok-tint);      color: var(--ok); }
.match-score--vorschlag  { background: #fdf4e3;             color: #8a5a00; }
.match-score--bestaetigt { background: var(--ok-tint);      color: var(--ok); }

.feststellung-actions { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; justify-content: flex-start; }

/* Bulk-Aktions-Leiste (sichtbar wenn Zeilen ausgewaehlt) — klebt beim Scrollen unter der Toolbar */
.bulk-bar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 10px 16px; margin: 0 0 12px;
    background: var(--accent-tint);
    border: 1px solid var(--accent-strong);
    border-radius: var(--radius);
    font-size: 13px;
    position: sticky; top: 62px; z-index: 4;
    box-shadow: 0 4px 10px rgba(16,24,40,.06);
}
.bulk-bar[hidden] { display: none; }
@media (max-width: 720px) {
    .bulk-bar { position: static; top: auto; }
}
.bulk-bar__count { color: var(--accent-strong); }
.bulk-bar__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }

/* Checkboxen in Datentabellen (Header + Zeile) */
table.data input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent-strong); cursor: pointer; }
/* Zeile mit gesetzter Checkbox visuell markieren */
table.data tbody tr:has(input[type="checkbox"]:checked) { background: var(--accent-tint); }
.link-btn {
    background: transparent; border: 0; color: var(--text-subtle); cursor: pointer;
    font-size: 15px; padding: 4px 6px; border-radius: 4px; line-height: 1;
}
.link-btn:hover { background: var(--surface-2); color: var(--text); }

/* Icon-only Buttons fuer kompakte Aktionsspalten */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    background: var(--surface); color: var(--text-muted);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn--primary { background: var(--accent-strong); color: #fff; border-color: var(--accent-strong); }
.icon-btn--primary:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.icon-btn--danger  { color: var(--danger); }
.icon-btn--danger:hover { background: var(--danger-tint); color: var(--danger); border-color: var(--danger); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: var(--surface); color: var(--text-muted); border-color: var(--border-strong); }

/* Photon Adress-Autovervollstaendigung */
.photon-wrap { position: relative; }
.photon-list {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(16,24,40,.12);
    max-height: 320px; overflow-y: auto;
    margin-top: 4px;
}
.photon-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 12px; background: transparent; border: 0;
    border-bottom: 1px solid var(--border); cursor: pointer;
    font: inherit;
}
.photon-item:last-child { border-bottom: 0; }
.photon-item:hover, .photon-item:focus { background: var(--accent-tint); outline: none; }
.photon-item__l1 { font-size: 13.5px; font-weight: 600; color: var(--text); }
.photon-item__l2 { font-size: 12.5px; color: var(--text-subtle); margin-top: 2px; }

/* Nutzer-Historie (kompakte Liste in Sidebar) */
.user-history { list-style: none; margin: 0; padding: 0; }
.user-history li {
    padding: 8px 0;
    border-top: 1px solid var(--border);
}
.user-history li:first-child { border-top: 0; padding-top: 4px; }
.user-history__action { font-size: 13px; font-weight: 600; color: var(--text); }
.user-history__meta { font-size: 12px; color: var(--text-subtle); margin-top: 2px; }

/* Ampel-Punkt (Türen-Status) */
.ampel {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: -1px;
    box-shadow: 0 0 0 2px rgba(0,0,0,.04) inset;
    margin-right: 4px;
}
.ampel--rot   { background: var(--danger, #c53030); }
.ampel--gelb  { background: #d69e2e; }
.ampel--gruen { background: var(--ok, #22a06b); }

/* KPI-Karte als klickbarer Link */
.kpi-card {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform .08s ease, border-color .08s ease;
    border: 1px solid var(--border);
}
a.kpi-card:hover { transform: translateY(-1px); border-color: var(--accent, var(--text)); }
.kpi-card__label { color: var(--text-subtle); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card__value { font-family: var(--font-headline); font-size: 28px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.kpi-card__sub   { font-size: 12px; color: var(--text-subtle); margin-top: 6px; }

/* Feld-Diff pro History-Eintrag: Feld · Alt → Neu */
.history-diff {
    list-style: none;
    margin: 6px 0 0;
    padding: 6px 8px;
    background: var(--surface-alt, #f7f8fa);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.5;
}
.history-diff li { padding: 1px 0; word-break: break-word; }
.history-diff__field { font-weight: 600; color: var(--text); margin-right: 4px; }
.history-diff__from { color: var(--text-subtle); text-decoration: line-through; }
.history-diff__arrow { color: var(--text-subtle); margin: 0 4px; }
.history-diff__to { color: var(--text); font-weight: 500; }

/* Autosave-Toast */
.live-toast {
    position: fixed; top: 14px; right: 18px; z-index: 200;
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    background: var(--text); color: #fff;
    box-shadow: 0 6px 18px rgba(16,24,40,.18);
    opacity: 0; transform: translateY(-6px);
    transition: opacity .18s, transform .18s;
    pointer-events: none;
}
.live-toast.is-visible { opacity: 1; transform: translateY(0); }
.live-toast--ok  { background: var(--ok); color: #fff; }
.live-toast--err { background: var(--danger); color: #fff; }

/* ---------- Custom Tooltip (data-tt statt title) ---------- */
[data-tt] { position: relative; }
[data-tt]:hover::after,
[data-tt]:focus-visible::after {
    content: attr(data-tt);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%; transform: translateX(-50%);
    background: #1c2129; color: #fff;
    padding: 5px 9px; border-radius: 4px;
    font-size: 12px; font-weight: 500; line-height: 1.35;
    white-space: nowrap; letter-spacing: .01em;
    pointer-events: none; z-index: 100;
    box-shadow: 0 4px 12px rgba(16,24,40,.18);
    opacity: 0; animation: tt-fade-in .12s ease-out .25s forwards;
}
[data-tt]:hover::before,
[data-tt]:focus-visible::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%; transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1c2129;
    pointer-events: none; z-index: 100;
    opacity: 0; animation: tt-fade-in .12s ease-out .25s forwards;
}
@keyframes tt-fade-in { to { opacity: 1; } }
/* Auf schmalen Screens: Position unten statt oben (mehr Platz) */
[data-tt][data-tt-place="bottom"]:hover::after {
    bottom: auto; top: calc(100% + 6px);
}
[data-tt][data-tt-place="bottom"]:hover::before {
    bottom: auto; top: calc(100% + 2px);
    border-top-color: transparent; border-bottom-color: #1c2129;
}

/* Katalog-Such-Modal */
.ks-item {
    display: flex; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border);
    cursor: pointer; align-items: baseline;
}
.ks-item:hover { background: var(--accent-tint); }
.ks-item__main { flex: 1; min-width: 0; }
.ks-item__title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.ks-item__sub { color: var(--text-subtle); font-size: 12.5px; margin-top: 2px; }
.ks-item__price { font-weight: 700; color: var(--accent-strong); font-size: 13.5px; white-space: nowrap; }

/* Angebots-Positions-Inline-Edit */
.pos-inline { margin: 0; padding: 6px 12px; }
.pos-inline__grid {
    display: flex; gap: 6px; align-items: flex-start;
}
.pos-inline textarea { min-height: 34px; }

/* Positions-Tabelle im Angebot: Zellen vertikal zentriert, alle Zeilen gleich hoch */
.pos-table tbody td { vertical-align: middle !important; padding: 8px 10px; }
.pos-table .crm-input {
    width: 100%; box-sizing: border-box;
    padding: 6px 8px; font-size: 13px; line-height: 1.35;
    height: 32px;
}
/* Textarea passt sich Textinhalt an — Zelle bestimmt die Zeilenhoehe.
   Andere Inputs bleiben kompakt (32px), sitzen dank vertical-align:middle mittig. */
.pos-table textarea.crm-input {
    height: auto; min-height: 32px; resize: vertical;
    font-family: inherit;
}
.badge--bad { background: var(--danger-tint); color: var(--danger); }
.badge--bad::before { background: var(--danger); }
.badge--info { background: var(--accent-tint); color: var(--accent-strong); }
.badge--info::before { background: var(--accent); }
.badge--neutral { background: #f1f3f5; color: var(--text-muted); }
.badge--neutral::before { background: var(--idle); }

/* ---------- Inputs / Buttons ---------- */
/* .input identisch zu .crm-input — konsistenter Look ueberall. */
.input {
    display: block; width: 100%;
    padding: 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; line-height: 1.4;
    color: var(--text);
    outline: none;
    transition: background .12s, border-color .12s, box-shadow .12s;
    box-sizing: border-box;
}
.input::placeholder { color: var(--text-subtle); }
.input:hover:not(:focus) { background: var(--surface); border-color: var(--border-strong); }
.input:focus {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ---------- File-Drop (schlichte Upload-Zone) ---------- */
.file-drop {
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 10px 14px;
    transition: background .12s, border-color .12s;
}
.file-drop:hover, .file-drop.is-dragging { border-color: var(--accent-strong); background: var(--surface-2); }
.file-drop.has-file { border-color: var(--accent-strong); }
.file-drop__input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.file-drop__idle, .file-drop__selected { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.file-drop__idle[hidden], .file-drop__selected[hidden] { display: none !important; }
.file-drop__icon svg, .file-drop__file-icon svg { width: 20px; height: 20px; color: var(--accent-strong); stroke-width: 1.6; display: block; }
.file-drop__title { color: var(--text-muted); font-size: 13px; }
.file-drop__hint  { color: var(--text-subtle); font-size: 12px; margin-left: auto; }
.file-drop__file-meta { flex: 1; min-width: 0; }
.file-drop__name { font-weight: 600; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-drop__size { color: var(--text-subtle); font-size: 12px; }

/* Browser-Spinner (Hoch/Runter-Pfeile) bei Zahleneingaben global ausblenden. */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: var(--radius-sm);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: background .12s, border-color .12s, color .12s;
    line-height: 1.35;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); color: #fff; }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn.is-disabled { pointer-events: none; opacity: .45; }
.btn.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.is-active:hover { background: var(--accent-strong); color: #fff; }

/* ---------- Pagination (Listenseiten) ---------- */
.crm-pagination {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.crm-pagination__info { color: var(--text-muted); font-size: 12.5px; }
.crm-pagination__nav  { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #951b12; color: #fff; }
.btn--sm { padding: 7px 11px; font-size: 13px; }
.btn--icon { padding: 8px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }

.inline-form { display: flex; gap: 7px; align-items: center; }
.inline-form .input { width: 168px; padding: 7px 10px; font-size: 13.5px; }
/* Speichern-Button erst zeigen, wenn der Wert geändert wurde */
.inline-form__save { display: none; }
.inline-form.is-changed .inline-form__save { display: inline-flex; }

/* ---------- Steckdosen-Schalter (Relais) in der Stromtabelle ---------- */
.relay {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 7px; border-radius: var(--radius-sm); cursor: pointer;
    border: 1px solid transparent; transition: background .12s, border-color .12s, filter .12s;
}
.relay .ic { width: 18px; height: 18px; }
.relay--on      { background: var(--ok-tint);     color: var(--ok);     border-color: rgba(21,146,79,.30); }
.relay--off     { background: var(--danger-tint); color: var(--danger); border-color: rgba(180,35,24,.30); }
.relay--unknown { background: var(--surface-2);   color: var(--text-muted); border-color: var(--border); }
.relay:hover { filter: brightness(.96); }

/* ---------- Alerts ---------- */
.alert { padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.alert--ok    { background: var(--ok-tint); border-color: #bfe6cd; color: #11623a; }
.alert--error { background: var(--danger-tint); border-color: #f3c5c0; color: #8a2018; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- Modal (Bestaetigungsdialog, ersetzt window.confirm) ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.55); animation: modalFade .12s ease-out; }
.modal__dialog { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 440px; width: 100%; padding: 22px 24px; box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: modalIn .14s ease-out; }
.modal__title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 10px 0; }
.modal__message { color: var(--text-muted); font-size: 14px; margin: 0 0 20px 0; line-height: 1.5; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Mehrfachauswahl in Tabellen ---------- */
.row-select { width: 36px; }
.row-select input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }

/* ---------- Vertragsbasis (eingebundener Dokument-Inhalt, Admin-Look) ---------- */
.vertrag {
    /* Bruecke: das uebernommene Markup nutzt diese Variablen per Inline-Style -> auf Admin-Werte mappen */
    --gray-50:#f8fafc; --gray-100:#f1f5f9; --gray-200:#e6e8ec; --gray-300:#cbd5e1;
    --gray-400:#8b94a1; --gray-500:#5b6573; --gray-600:#475569; --gray-700:#334155;
    --gray-800:#1e293b; --gray-900:#14181f;
    --primary-50:#eef4fe; --primary-100:#dbe8fc; --primary-200:#cfe0fb;
    --primary-500:#1668e3; --primary-600:#1257c4; --primary-700:#0f49a6;
    --radius:9px; --radius-lg:12px; --radius-xl:14px;
}
.vertrag .contract-section { display: none; }
.vertrag .contract-section.active { display: block; }
.vertrag.vertrag--stacked .contract-section { display: block; } /* Mandanten-Vertrag: alle gewaehlten Abschnitte gestapelt */
.vertrag .section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; margin-bottom: 16px; box-shadow: var(--shadow-card); }
.vertrag h2 { font-size: 19px; font-weight: 700; color: var(--text); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.vertrag .section-desc { font-size: 13.5px; color: var(--text-muted); margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.vertrag .article { margin-bottom: 22px; }
.vertrag .article:last-child { margin-bottom: 0; }
.vertrag h3 { font-size: 15px; font-weight: 650; color: var(--text); margin: 0 0 8px; }
.vertrag h4 { font-size: 14px; font-weight: 600; color: var(--text-muted); margin: 14px 0 6px; }
.vertrag p, .vertrag li { font-size: 14px; line-height: 1.7; color: var(--text-muted); }
.vertrag p { margin: 0 0 8px; }
.vertrag ul, .vertrag ol { margin: 6px 0 10px 22px; }
.vertrag li { margin-bottom: 5px; }
.vertrag ol { list-style: decimal; }
.vertrag ol ol { list-style: lower-alpha; }
.vertrag .highlight { font-weight: 600; color: var(--accent-strong); }
.vertrag .info-box { background: var(--accent-tint); border: 1px solid #cfe0fb; border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0; font-size: 13.5px; color: var(--accent-strong); }
.vertrag .warn-box { background: var(--danger-tint); border: 1px solid #f3c5c0; border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0; font-size: 13.5px; color: #8a2018; }
.vertrag .ok-box { background: var(--ok-tint); border: 1px solid #bfe6cd; border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0; font-size: 13.5px; color: #11623a; }
.vertrag .info-box i, .vertrag .warn-box i, .vertrag .ok-box i, .vertrag h2 i, .vertrag h3 i, .vertrag .print-btn i { display: none; }
.vertrag .table-wrapper { overflow-x: auto; margin: 12px 0; }
.vertrag .contract-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.vertrag .contract-table th, .vertrag .contract-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.vertrag .contract-table th { background: var(--surface-2); font-weight: 600; color: var(--text); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.vertrag .contract-table td { color: var(--text-muted); }
.vertrag .print-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-decoration: none; }
.vertrag .print-btn:hover { background: var(--surface-2); }
/* Abschnitts-Navigation als dezente Tabs */
.vertrag-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 4px; }
.vertrag-nav + .vertrag-nav { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.vertrag-nav__group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); margin-right: 10px; min-width: 92px; }
.vertrag-tab { padding: 5px 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--text-muted); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s; }
.vertrag-tab:hover { background: var(--surface-2); color: var(--text); }
.vertrag-tab.is-active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
.vertrag-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---------- Login ---------- */
.auth {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg); padding: 24px;
}
.auth__card {
    width: 100%; max-width: 380px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 8px 30px rgba(16,24,40,.06);
    padding: 34px 32px;
}
.auth__logo { display: flex; justify-content: center; margin: 0 0 28px; }
.auth__logo img { height: 96px; width: auto; }
.auth__sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.field { margin-top: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.checkrow { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13.5px; color: var(--text-muted); }
.checkrow input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------- Auth-Card: einheitlicher 20-px-Rhythmus ---------- */
.auth .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 0; }
[data-passkey-login] { margin-top: 0; }
.auth #passkey-login-error { margin: 16px 0 0; }
.auth__sep { margin: 24px 0; }
.auth form .field:first-of-type { margin-top: 0; }
.auth form .field { margin-top: 16px; }
.auth form .checkrow { margin-top: 18px; }
.auth form .btn { margin-top: 24px; }

/* ---------- Auth: mobile (bildschirmfuellend, vertikal zentriert) ---------- */
@media (max-width: 520px) {
    html, body { height: 100%; }
    .auth {
        padding: 0;
        min-height: 100svh;
    }
    .auth__card {
        max-width: 100%;
        width: 100%;
        min-height: 100svh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: calc(env(safe-area-inset-top, 0px) + 20px) 22px calc(env(safe-area-inset-bottom, 0px) + 18px);
        display: flex;
        flex-direction: column;
        justify-content: center;         /* vertikal mittig */
    }
    .auth__logo { margin: 0 0 22px; }
    .auth__logo img { height: 60px; }
    .auth__sep { margin: 18px 0 10px; }
    .auth form .field { margin-top: 12px; }
    .auth form .checkrow { margin-top: 14px; font-size: 13px; }
    .auth form .btn { margin-top: 18px; }
    .auth__copy {
        margin-top: 26px;
        padding-top: 18px;
        font-size: 11.5px;
    }
    .auth .btn,
    .auth [data-passkey-login] { padding: 13px; font-size: 15px; }
    .input { padding: 12px; font-size: 16px; } /* 16px verhindert iOS-Zoom */
}

@media (max-width: 720px) {
    .topbar { align-items: center; padding: 16px 18px; }
    .topbar__menu { display: flex; }

    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 30;
        width: min(88vw, 300px);
        height: 100vh;
        height: 100svh;             /* iOS Safari: exkl. URL-Leiste */
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 0 12px 40px rgba(16,24,40,.18);
    }
    .sidebar__brand { min-height: 80px; padding: 14px 22px; }
    .sidebar__brand img { height: 52px; }
    .nav { min-height: 0; }                        /* Flex-Child-Scroll-Fix */
    .sidebar__foot { flex-shrink: 0; }             /* Foot bleibt sicher sichtbar */

    body.nav-open { overflow: hidden; }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .backdrop { opacity: 1; visibility: visible; }

    .content { padding: 20px 16px; }
}

/* ========================================================================
   Dateien-Browser (Kundenportal M2)
   ======================================================================== */
.files {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

/* --- Ordnerbaum (links) --- */
.files__tree {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 100px);
    overflow: auto;
}
.files__tree-toggle { padding: 0; }
.files__tree-head {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px;
    font-weight: 600; font-size: 13.5px; color: var(--text);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    list-style: none;
}
.files__tree-head::-webkit-details-marker { display: none; }
.files__tree-head .ic { width: 16px; height: 16px; color: var(--text-muted); }
.files__tree-count {
    margin-left: auto;
    font-size: 11.5px; font-weight: 500; color: var(--text-subtle);
    background: var(--surface-2);
    padding: 2px 7px; border-radius: 999px;
}
.files__tree-body { padding: 6px 0; }
.files__empty-hint { padding: 10px 14px; color: var(--text-subtle); font-size: 12.5px; margin: 0; }

.folder-tree, .folder-node__children {
    list-style: none;
    margin: 0;
    padding: 0;
}
.folder-node__children { padding-left: 16px; }
.folder-node { }
.folder-node__group[open] > summary .folder-node__chev { transform: rotate(90deg); }

.folder-node__row {
    display: flex; align-items: center; gap: 4px;
    padding: 5px 10px 5px 6px;
    cursor: pointer;
    list-style: none;
    border-radius: 4px;
    margin: 0 6px;
}
.folder-node__row::-webkit-details-marker { display: none; }
.folder-node__row:hover { background: var(--surface-2); }
.folder-node__row.is-active { background: var(--accent-tint); }
.folder-node__row--all { padding-left: 10px; margin: 2px 6px 4px; text-decoration: none; }
.folder-node__row--all > .ic { width: 14px; height: 14px; color: var(--text-muted); }

.folder-node.is-active > .folder-node__group > .folder-node__row,
.folder-node.is-active > .folder-node__row {
    background: var(--accent-tint);
}
.folder-node.is-active > .folder-node__group > .folder-node__row .folder-node__name,
.folder-node.is-active > .folder-node__row .folder-node__name {
    color: var(--accent-strong);
    font-weight: 600;
}

.folder-node__chev {
    width: 12px; height: 12px; color: var(--text-subtle); flex: none;
    transition: transform .12s;
}
.folder-node__chev-spacer { width: 12px; height: 12px; flex: none; }
.folder-node__link {
    display: flex; align-items: center; gap: 6px;
    flex: 1;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    min-width: 0;
}
.folder-node__name {
    flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.folder-node__count {
    font-size: 11px; color: var(--text-subtle);
    background: transparent;
    padding: 0 4px;
    flex: none;
}

/* --- Rechts: Toolbar + Dateiliste --- */
.files__main { min-width: 0; }
.files__toolbar {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.files__headline {
    font-size: 18px; font-weight: 650; letter-spacing: -.01em; color: var(--text);
    margin: 0;
    display: flex; align-items: baseline; gap: 10px;
}
.files__total {
    font-size: 12.5px; font-weight: 500; color: var(--text-subtle);
    background: var(--surface-2);
    padding: 2px 8px; border-radius: 999px;
}
.files__search {
    display: flex; gap: 6px; align-items: center;
    margin-left: auto;
}
.files__search .input {
    width: 260px;
}

.files__list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.file-row {
    display: grid;
    grid-template-columns: 36px 1fr auto auto 32px;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--surface-2); }
.file-row--head {
    background: var(--surface-2);
    font-size: 12px; color: var(--text-muted);
    text-transform: none; letter-spacing: 0;
    padding-top: 8px; padding-bottom: 8px;
}
.file-row--head:hover { background: var(--surface-2); }

.file-row__check {
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.file-row__check input {
    width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}
.file-row__main { min-width: 0; }
.file-row__name {
    display: block;
    font-size: 13.5px; font-weight: 500; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-decoration: none;
}
.file-row__name:hover { color: var(--accent-strong); text-decoration: underline; }
.file-row__meta {
    display: flex; gap: 12px; flex-wrap: wrap;
    font-size: 12px; color: var(--text-subtle); margin-top: 2px;
}
.file-row__date {
    font-size: 12.5px; color: var(--text-muted); white-space: nowrap;
}
.file-row__actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.file-row__action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
}
.file-row__action:hover { background: var(--surface-2); color: var(--accent-strong); }
.file-row__action .ic { width: 16px; height: 16px; }

/* Sticky Auswahl-Aktionsleiste unten */
.files__selection-bar {
    position: sticky;
    bottom: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(16,24,40,.08);
    display: flex; align-items: center; gap: 12px;
    z-index: 10;
}
.files__selection-count {
    font-size: 13px; font-weight: 600; color: var(--text);
    margin-right: auto;
}

/* Status-Pill */
.pill {
    display: inline-block;
    font-size: 11.5px; font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: .01em;
}
.pill--ok      { background: #dcfce7; color: #15803d; }
.pill--mild    { background: #fef3c7; color: #a16207; }
.pill--bad     { background: #fee2e2; color: #b91c1c; }
.pill--unknown { background: var(--surface-2); color: var(--text-muted); }
[data-theme="dark"] .pill--ok      { background: rgba(34,197,94,.15);  color: #4ade80; }
[data-theme="dark"] .pill--mild    { background: rgba(234,179,8,.15);  color: #facc15; }
[data-theme="dark"] .pill--bad     { background: rgba(239,68,68,.15);  color: #f87171; }
[data-theme="dark"] .pill--unknown { background: var(--surface-2);     color: var(--text-subtle); }

/* Pagination */
.files__pagination { margin-top: 14px; }
.pager {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap;
    font-size: 12.5px;
}
.pager__info { color: var(--text-subtle); }
.pager__ctrls { display: flex; gap: 6px; }
.pager__btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    font-size: 12.5px; font-weight: 500;
}
.pager__btn:hover { background: var(--surface-2); }
.pager__btn.is-disabled { color: var(--text-subtle); cursor: default; opacity: .55; }

/* Mobile */
@media (max-width: 900px) {
    .files { grid-template-columns: 1fr; }
    .files__tree {
        position: static;
        max-height: none;
    }
    .files__tree-body { max-height: 42vh; overflow: auto; }
    .files__search { margin-left: 0; width: 100%; }
    .files__search .input { flex: 1; width: auto; }
    .file-row {
        grid-template-columns: 32px 1fr 32px;
        grid-template-areas:
            "check main action"
            "check meta  action";
        row-gap: 2px;
    }
    .file-row--head { display: none; }
    .file-row__check { grid-area: check; align-self: start; margin-top: 4px; }
    .file-row__main  { grid-area: main; }
    .file-row__actions { grid-area: action; align-self: start; }
    .file-row__status, .file-row__date {
        grid-area: meta;
        display: inline-flex; gap: 10px; align-items: center;
        font-size: 12px; color: var(--text-subtle);
    }
}

/* ---------- TOM / Datenschutz-Uebersicht ---------- */
.tom-intro { font-size: 14.5px; line-height: 1.6; color: var(--text-muted); }
.tom-intro strong { color: var(--text); }

.tom-grid { display: grid; gap: 0; }
.tom-item {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 28px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}
.tom-item:first-child { border-top: 0; padding-top: 0; }
.tom-item:last-child { padding-bottom: 0; }
.tom-item__label {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}
.tom-item__text {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}
.tom-item__text code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12.5px;
}

@media (max-width: 720px) {
    .tom-item { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
}

/* ---------- Public Pages (Impressum / Datenschutzerklaerung) ---------- */
body.public {
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.public__header {
    background: var(--accent-strong);
    padding: 22px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.public__brand img { display: block; }
.public__main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 48px;
}
.public__title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: 28px;
    margin: 0 0 20px;
    color: var(--text);
    letter-spacing: .01em;
}
.public__footer {
    padding: 20px 24px 30px;
    text-align: center;
}
.public__nav {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 13.5px;
    color: var(--text-subtle);
}
.public__nav a { color: var(--text-muted); }
.public__nav a:hover { color: var(--accent-strong); }

/* ---------- Login-Page Footer + Sidebar-Fusszeile ---------- */
.auth__footer {
    margin-top: 22px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-subtle);
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}
.auth__footer a { color: var(--text-muted); }
.auth__footer a:hover { color: var(--accent-strong); }
.auth__copy {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-subtle);
    line-height: 1.6;
}
.auth__copy > div + div { margin-top: 2px; }
.auth__copy a { color: var(--text-muted); }
.auth__copy a:hover { color: var(--accent-strong); }

.sidebar__legal {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-subtle);
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
.sidebar__legal a { color: var(--text-muted); }
.sidebar__legal a:hover { color: var(--accent-strong); }
.sidebar__copy {
    padding: 4px 12px 8px;
    text-align: center;
    font-size: 10.5px;
    color: var(--text-subtle);
    opacity: .7;
}
.sidebar__copy a { color: inherit; text-decoration: none; }
.sidebar__copy a:hover { color: var(--accent-strong); opacity: 1; }

/* ---------- Passkeys ---------- */
.auth__sep {
    display: flex; align-items: center; gap: 10px;
    margin: 18px 0 6px;
    color: var(--text-subtle); font-size: 12.5px;
}
.auth__sep::before, .auth__sep::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}
.passkey-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.passkey-item {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.passkey-item__name { font-weight: 600; color: var(--text); font-size: 14px; }
.passkey-item__sub { color: var(--text-subtle); font-size: 12.5px; margin-top: 2px; }
/* (btn--sm zentral in Zeile 1130 definiert) */


/* ==========================================================================
   Dashboard v2 — hochwertige KPIs, Charts, Live-Kacheln
   ========================================================================== */

/* KPI-Kacheln (Row 1) */
.grid--kpi {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.kpi {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px 18px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.kpi:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16,24,40,.08);
    border-color: var(--border-strong);
}
.kpi__ico {
    position: absolute; top: 18px; right: 18px;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--accent-tint);
    color: var(--accent-strong);
}
.kpi--ok .kpi__ico { background: var(--ok-tint); color: var(--ok); }

.kpi__label {
    font-size: 12.5px; font-weight: 550; letter-spacing: .02em;
    color: var(--text-muted); text-transform: uppercase;
}
.kpi__value {
    font-size: 34px; font-weight: 700; letter-spacing: -.02em;
    margin-top: 10px; line-height: 1; color: var(--text);
}
.kpi__slash { color: var(--text-subtle); font-weight: 500; font-size: 22px; margin-left: 2px; }
.kpi__hint  { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }
.kpi__hint a { color: var(--accent); text-decoration: none; }
.kpi__hint a:hover { text-decoration: underline; }

/* Chart-Karten (Row 2) */
.grid--dash-charts {
    display: grid; gap: 16px; margin-top: 20px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid--dash-charts .chart-card--wide { grid-column: span 2; }
.chart-card {
    display: flex; flex-direction: column;
    border-radius: 12px;
    transition: box-shadow .18s ease;
}
.chart-card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.06); }
.chart-card__head { margin-bottom: 12px; }
.chart-card__sub { font-size: 12px; color: var(--text-subtle); margin-top: 2px; }
.chart-wrap { position: relative; height: 260px; flex: 1; }

@media (max-width: 1200px) {
    .grid--dash-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--dash-charts .chart-card--wide { grid-column: span 2; }
}
@media (max-width: 720px) {
    .grid--dash-charts { grid-template-columns: 1fr; }
    .grid--dash-charts .chart-card--wide { grid-column: auto; }
    .chart-wrap { height: 240px; }
}

/* Section-Header zwischen den Bereichen */
.dashboard-section {
    margin-top: 26px; margin-bottom: 10px;
    font-size: 13.5px; font-weight: 640;
    letter-spacing: .04em; text-transform: uppercase;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 12px;
}
.dashboard-section::after {
    content: ""; flex: 1;
    height: 1px; background: var(--border);
}

/* Live-Verbrauch-Kacheln (Row 3) */
.grid--power-live {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.live-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, box-shadow .16s ease;
}
.live-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,24,40,.07); }

.live-tile__ico {
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--accent-tint); color: var(--accent-strong);
}
.live-tile__body { flex: 1; min-width: 0; }
.live-tile__name { font-size: 12.5px; color: var(--text-muted); font-weight: 550; }
.live-tile__val  { font-size: 24px; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; margin-top: 3px; color: var(--text); }
.live-tile__unit { font-size: 14px; color: var(--text-muted); font-weight: 550; margin-left: 3px; }
.live-tile__meta { margin-top: 6px; font-size: 11.5px; color: var(--text-subtle); display: flex; gap: 8px; align-items: center; }
.live-tile__seen { color: var(--text-subtle); }

/* Legacy: stat__slash bleibt fuer Fallbacks */
.stat__slash { color: var(--text-subtle); font-weight: 500; }
.stat__unit  { font-size: 18px; color: var(--text-muted); font-weight: 550; margin-left: 2px; }

/* Status-Pills */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .01em;
    line-height: 1.55;
    text-transform: uppercase;
}
.pill--both_on  { background: var(--ok-tint);      color: var(--ok); }
.pill--pc_only  { background: var(--accent-tint);  color: var(--accent-strong); }
.pill--tv_idle  { background: #fdf1dd;             color: #a56b0a; }
.pill--both_off { background: #eef0f3;             color: var(--text-muted); }
.pill--stale    { background: #f2eafd;             color: #6c48b7; }
.pill--unknown  { background: #eef0f3;             color: var(--text-subtle); }

