/* ==========================================================================
   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: Topbar oben full-width, darunter Sidebar+Main ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.app__body { display: flex; flex: 1; min-height: 0; }

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: sticky;
    /* Unter der sticky Topbar kleben, damit die Unterkante der Sidebar
       immer genau am Viewport-Boden sitzt (nicht 104px drueber). */
    top: var(--topbar-h, 104px);
    align-self: flex-start;
    height: calc(100vh - var(--topbar-h, 104px));
    /* Dynamic viewport height fuer mobile Browser-Chrome (Safari/Chrome Mobile) */
    height: calc(100dvh - var(--topbar-h, 104px));
}

/* Kundenportal: Sidebar waechst mit laengstem Ordnernamen (bis Max). */
body.has-folder-tree:not(.nav-collapsed) .sidebar {
    width: auto;
    min-width: var(--sidebar-w);
    max-width: 420px;
}
body.has-folder-tree:not(.nav-collapsed) .folder-node__name {
    overflow: visible;
    text-overflow: unset;
}

/* Eingeklappte Sidebar: Ordnerbaum komplett ausblenden, nur Icon-Nav bleibt */
@media (min-width: 721px) {
    body.nav-collapsed .folder-tree,
    body.nav-collapsed .folder-node__row--all,
    body.nav-collapsed .nav .nav__label {
        display: none;
    }
}
.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: 12px; font-weight: 600;
    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); }

/* Rotes Badge-Variant (fuer "Offene Aufträge"-Counter im Service) */
.nav__badge--red {
    background: #dc2626;         /* red-600 */
    color: #fff;
    border-radius: 999px;        /* rund wie im Original */
    min-width: 22px; height: 22px;
    padding: 0 7px;
    box-shadow: 0 1px 2px rgba(220,38,38,.3);
}
.nav__link.is-active .nav__badge--red { background: #b91c1c; }

/* 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); }

/* Roter Dot im geschlossenen Hauptmenü, wenn Sub-Items Badges haben.
   Zeigt an, dass im eingeklappten Zweig Benachrichtigungen vorliegen. */
.nav__dot {
    display: inline-block;
    width: 8px; height: 8px;
    margin-left: auto;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 0 2px var(--surface);
    flex-shrink: 0;
}
.nav__group[open] > summary .nav__dot { display: none; }
/* Chevron rechts bleibt, Dot sitzt direkt davor */
.nav__group > summary .nav__dot + .nav__group-chev { margin-left: 6px; }
.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; }

/* "Noch nicht verfügbar"-Nav-Items: subtil ausgegraut, Cursor zeigt an dass nicht aktiv */
.nav__link--todo {
    color: var(--text-subtle);
    cursor: not-allowed;
    opacity: .7;
    white-space: nowrap;         /* keine Zeilenumbruch zwischen Label und "bald"-Pill */
    overflow: hidden;
}
.nav__link--todo > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav__link--todo:hover {
    color: var(--text-subtle);
    background: transparent;
}
.nav__link--todo::after {
    content: "bald";
    margin-left: auto;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--text-subtle);
    background: var(--surface-2);
    border-radius: 10px;
    opacity: .7;
    flex: none;                  /* Pill nie quetschen */
}

.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-Hoehe global, damit Sidebar sie als sticky-offset lesen kann */
:root { --topbar-h: 104px; }
@media (max-width: 720px) {
    :root { --topbar-h: 68px; }
}
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px 14px 20px;
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 20;
    min-height: var(--topbar-h);
}
.topbar__brand {
    display: inline-flex; align-items: center;
    text-decoration: none;
    flex: none;
}
.topbar__brand img { height: 76px; width: auto; display: block; }
@media (max-width: 720px) {
    .topbar { --topbar-h: 68px; padding: 8px 14px 8px 10px; min-height: var(--topbar-h); }
    .topbar__brand img { height: 48px; }
}
.topbar__brand .logo--dark { display: none; }
[data-theme="dark"] .topbar__brand .logo--light { display: none; }
[data-theme="dark"] .topbar__brand .logo--dark  { display: block; }
.topbar__title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: var(--text); margin-right: auto; flex: 1; min-width: 0; }
.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: 8px;
    padding: 4px 10px 4px 4px; border-radius: 999px;
    transition: background .12s;
    max-width: 320px;
}
.user--compact:hover { background: var(--surface-2); }
.user--compact .user__avatar { width: 32px; height: 32px; font-size: 12.5px; flex: none; }
.user--compact .user__chev {
    width: 14px !important; height: 14px !important;
    margin: 0; color: var(--text-subtle); flex: none;
}
.user__topbar-meta {
    display: flex; flex-direction: column;
    line-height: 1.25;
    min-width: 0;
    text-align: left;
}
.user__topbar-name {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 220px;
}
.user__topbar-sub {
    font-size: 11.5px; color: var(--text-subtle);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user__kundennr {
    font-size: 11.5px; color: var(--text-muted); margin-top: 2px;
}
@media (max-width: 720px) {
    .user__topbar-meta { display: none; } /* auf Mobile nur Avatar */
}
.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%; }

/* ============================================================
   Breadcrumbs · global · wird vom Layout gerendert wenn @section('breadcrumbs') vorhanden
   ============================================================ */
.elexx-breadcrumbs {
    background: var(--gray-50);
    border-bottom: 1px solid var(--border);
    padding: 6px 30px;
}
[data-theme="dark"] .elexx-breadcrumbs { background: #1a1a2e; }
.elexx-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    line-height: 1.4;
}
.elexx-breadcrumbs__item { display: inline-flex; align-items: center; }
.elexx-breadcrumbs__item a {
    color: var(--primary-500);
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.elexx-breadcrumbs__item a:hover {
    background: var(--surface);
    text-decoration: underline;
}
.elexx-breadcrumbs__item[aria-current="page"] span {
    color: var(--text);
    font-weight: 600;
    padding: 2px 6px;
}
.elexx-breadcrumbs__sep {
    color: var(--text-subtle);
    font-size: 11px;
    padding: 0 2px;
    user-select: none;
}
@media (max-width: 720px) {
    .elexx-breadcrumbs { padding: 5px 16px; }
}

/* ---------- 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: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--secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--surface); border-color: var(--accent); color: var(--accent-strong); }
.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; }
}

/* ========================================================================
   Kundenportal Statistiken (M5): Filter, KPI, Monatscharts, Device-Stack
   ======================================================================== */
.stats__filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.stats__filter { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.stats__filter--grow { flex: 1; min-width: 220px; }
.stats__filter--actions { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; }
.stats__filter .field__label { font-size: 12px; margin-bottom: 0; }

/* KPI */
.stats__kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.stats__kpi {
    position: relative;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stats__kpi-icon {
    position: absolute;
    top: 14px; right: 14px;
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.stats__kpi-icon .ic { width: 16px; height: 16px; }
.stats__kpi--info .stats__kpi-icon { background: #0ea5e9; }
.stats__kpi--ok   .stats__kpi-icon { background: #16a34a; }
.stats__kpi--mild .stats__kpi-icon { background: #d97706; }
.stats__kpi--bad  .stats__kpi-icon { background: #dc2626; }
.stats__kpi-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.stats__kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats__kpi-sub   { font-size: 12.5px; color: var(--text-subtle); margin-top: 4px; }

/* Charts-Grid */
.stats__charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 900px) {
    .stats__charts { grid-template-columns: 1fr; }
}
.stats__chart {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stats__chart-title {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 12px;
    font-size: 14px; font-weight: 600; color: var(--text);
}
.stats__chart-title .ic { width: 16px; height: 16px; color: var(--accent-strong); }

/* Monatsbalken */
.stats__bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 220px;
    padding: 8px 4px 0;
    overflow-x: auto;
}
.stats__bar {
    flex: 1; min-width: 28px;
    display: flex; flex-direction: column; align-items: center;
    height: 100%;
    gap: 4px;
    position: relative;
}
.stats__bar-num { font-size: 10.5px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.stats__bar-stack {
    width: 100%; max-width: 28px;
    display: flex; flex-direction: column;
    border-radius: 3px 3px 0 0; overflow: hidden;
    background: var(--surface-2);
    min-height: 1px;
}
.stats__bar-seg--ok      { background: #16a34a; }
.stats__bar-seg--mild    { background: #d97706; }
.stats__bar-seg--bad     { background: #dc2626; }
.stats__bar-seg--unknown { background: #94a3b8; }
.stats__bar-lbl {
    font-size: 10.5px; color: var(--text-subtle); margin-top: 4px;
    writing-mode: horizontal-tb; white-space: nowrap;
}

/* Device-Stack */
.stats__devices { display: flex; flex-direction: column; gap: 10px; }
.stats__device-head {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 13px; color: var(--text);
    margin-bottom: 4px;
}
.stats__device-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: calc(100% - 60px);
}
.stats__device-total { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.stats__device-stack {
    display: flex;
    width: 100%; height: 10px;
    background: var(--surface-2);
    border-radius: 999px; overflow: hidden;
}
.stats__device-seg--ok      { background: #16a34a; }
.stats__device-seg--mild    { background: #d97706; }
.stats__device-seg--bad     { background: #dc2626; }
.stats__device-seg--unknown { background: #94a3b8; }

/* ========================================================================
   Kundenportal: Barcode-Scanner (M6) + Passwort-Modal (M7)
   ======================================================================== */
.scan-fab {
    display: none;
    position: fixed; left: 20px; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent); color: #fff; border: 0;
    box-shadow: 0 6px 20px rgba(16,24,40,.25);
    align-items: center; justify-content: center;
    cursor: pointer; z-index: 25;
}
.scan-fab:hover { transform: scale(1.04); }
.scan-fab .ic { width: 24px; height: 24px; }
@media (max-width: 720px) {
    .scan-fab { display: inline-flex; }
}

.scan-overlay {
    position: fixed; inset: 0;
    background: rgba(10,15,25,.92);
    z-index: 50;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.scan-overlay[hidden] { display: none; }
.scan-card {
    background: #0f172a; color: #e2e8f0;
    border-radius: var(--radius);
    padding: 20px;
    max-width: 420px; width: 100%;
    display: flex; flex-direction: column; gap: 12px;
}
.scan-title { font-size: 17px; font-weight: 650; margin: 0; color: #fff; }
.scan-sub   { font-size: 13px; margin: 0; color: #94a3b8; }
.scan-status {
    font-size: 12.5px; padding: 8px 10px; border-radius: 6px;
    text-align: center; font-weight: 500;
}
.scan-status--info    { background: rgba(59,130,246,.18); color: #93c5fd; }
.scan-status--success { background: rgba(16,185,129,.18); color: #6ee7b7; }
.scan-status--error   { background: rgba(239,68,68,.18);  color: #fca5a5; }
.scan-reader {
    width: 100%; min-height: 280px;
    background: #000; border-radius: 8px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.scan-reader video { object-fit: cover !important; max-width: 100% !important; }
.scan-controls { display: flex; gap: 8px; justify-content: flex-end; }

/* Passwort-Modal */
.pw-overlay {
    position: fixed; inset: 0;
    background: rgba(10,15,25,.5);
    z-index: 45;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.pw-overlay[hidden] { display: none; }
.pw-card {
    background: var(--surface);
    border-radius: var(--radius);
    max-width: 460px; width: 100%;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(16,24,40,.3);
}
.pw-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.pw-title {
    display: flex; align-items: center; gap: 10px;
    margin: 0; font-size: 16px; font-weight: 650; color: var(--text);
}
.pw-title .ic { width: 16px; height: 16px; color: var(--accent-strong); }
.pw-close {
    width: 32px; height: 32px; border-radius: 50%;
    background: transparent; border: 0; color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pw-close:hover { background: var(--surface-2); color: var(--text); }
.pw-close .ic { width: 14px; height: 14px; }
.pw-form { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.pw-form .field { display: flex; flex-direction: column; gap: 6px; }
.pw-form .field__label { font-size: 13px; font-weight: 600; color: var(--text); }
.pw-criteria {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 12px; color: var(--text-muted);
}
.pw-criteria__head { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.pw-criteria ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.pw-criteria__sub { padding-left: 14px !important; margin-top: 4px !important; }
.pw-criteria li::before {
    content: "•"; display: inline-block; width: 14px; color: var(--text-subtle);
}
.pw-criteria li.is-ok  { color: #16a34a; }
.pw-criteria li.is-ok::before  { content: "✓"; color: #16a34a; }
.pw-criteria li.is-bad { color: #dc2626; }
.pw-criteria li.is-bad::before { content: "×"; color: #dc2626; }
.pw-match { font-size: 12px; font-weight: 500; }
.pw-match--ok { color: #16a34a; }
.pw-match--bad { color: #dc2626; }
.pw-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.alert { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.alert--success { background: rgba(22,163,74,.08); color: #16a34a; border: 1px solid rgba(22,163,74,.3); }
.alert--error   { background: rgba(220,38,38,.08); color: #dc2626; border: 1px solid rgba(220,38,38,.3); }
.alert--info    { background: rgba(14,165,233,.08); color: #0369a1; border: 1px solid rgba(14,165,233,.3); }

/* Datenschutz-Einwilligung — Vollbild-Modal */
body.consent-page {
    margin: 0; min-height: 100vh;
    background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.consent-overlay { width: 100%; display: flex; justify-content: center; }
.consent-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(16,24,40,.18);
    max-width: 640px; width: 100%;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.consent-modal__head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 24px;
    background: var(--accent-tint);
    border-bottom: 1px solid var(--border);
}
.consent-modal__head .ic { width: 22px; height: 22px; color: var(--accent-strong); flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.consent-modal__title { margin: 0; font-size: 18px; font-weight: 650; color: var(--text); }
.consent-modal__body { padding: 20px 24px 10px; }
.consent-modal__lead { margin: 0 0 18px; color: var(--text); font-size: 14px; line-height: 1.6; }
.consent-modal__lead a { color: var(--accent-strong); text-decoration: underline; }
.consent-modal__facts { display: flex; flex-direction: column; gap: 10px; }
.consent-modal__fact {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.consent-modal__fact h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text); }
.consent-modal__fact p, .consent-modal__fact ul { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.consent-modal__fact ul { padding-left: 18px; }
.consent-modal__form { padding: 10px 24px 22px; border-top: 1px solid var(--border); }
.consent-modal__check {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 14px 0 16px;
    font-size: 14px; color: var(--text); cursor: pointer;
}
.consent-modal__check input {
    margin-top: 2px; width: 16px; height: 16px;
    accent-color: var(--accent); flex: none;
}
.consent-modal__actions {
    display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
@media (max-width: 520px) {
    .consent-modal__head { padding: 14px 18px; }
    .consent-modal__body { padding: 16px 18px 8px; }
    .consent-modal__form { padding: 8px 18px 18px; }
    .consent-modal__actions { flex-direction: column-reverse; }
    .consent-modal__actions .btn { width: 100%; justify-content: center; }
}

/* ZIP-Download-Progress-Modal (erscheint beim Submit, verschwindet nach 4s) */
.zip-overlay {
    position: fixed; inset: 0;
    background: rgba(10,15,25,.5);
    z-index: 60;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity .18s ease;
}
.zip-overlay.is-open { opacity: 1; pointer-events: auto; }
.zip-overlay__card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 420px; width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(16,24,40,.3);
}
.zip-overlay__icon {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent-tint); color: var(--accent-strong);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
    animation: zip-bounce 1s ease-in-out infinite;
}
.zip-overlay__icon .ic { width: 28px; height: 28px; }
@keyframes zip-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.zip-overlay__title { margin: 0 0 6px; font-size: 17px; font-weight: 650; color: var(--text); }
.zip-overlay__text  { margin: 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }

/* ========================================================================
   Kundenportal Startseite — Welcome, Hero (Donut+KPIs), Datestrip, Kontakt
   ======================================================================== */

/* Scope-Badge wenn ein Ordner-Filter aktiv ist */
.scope-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: var(--accent-tint);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px; color: var(--text);
    margin-bottom: 16px;
}
.scope-badge .ic { width: 16px; height: 16px; color: var(--accent-strong); flex: none; }
.scope-badge__clear {
    margin-left: auto;
    font-size: 12.5px; color: var(--accent-strong); font-weight: 500;
}
.scope-badge__clear:hover { text-decoration: underline; }

/* =========================================================================
   Techniker-Portal: Auftrag-Karten + Team-Chips
   ========================================================================= */
.auftrag-section { margin-bottom: 24px; }

/* Service-Dashboard: Action-Cards (Aufträge/Daten, Hochladen, Projektvorbereitung) */
.service-actions { margin-bottom: 24px; }
.service-actions__grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.service-action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px 20px;
    display: flex; flex-direction: column; gap: 10px;
}
.service-action-card__icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--surface-2);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-muted); flex: none;
}
.service-action-card__icon .ic { width: 20px; height: 20px; }
.service-action-card__title {
    margin: 0; font-size: 15px; font-weight: 650; color: var(--text);
    letter-spacing: -0.005em;
}
.service-action-card__desc {
    margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5;
    flex: 1 1 auto;
}
.service-action-card__btns {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.service-action-card__badge {
    position: absolute; top: 12px; right: 12px;
    min-width: 28px; height: 28px; padding: 0 8px;
    background: #d97706; color: #fff;
    border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
    font-variant-numeric: tabular-nums;
}
.service-action-card__btn-nodata {
    background: #8b5cf6; color: #fff; border-color: #7c3aed;
}
.service-action-card__btn-nodata:not(:disabled):hover { background: #7c3aed; }

.auftrag-section__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 10px;
}
.auftrag-section__title {
    display: inline-flex; align-items: center; gap: 10px;
    margin: 0; font-size: 17px; font-weight: 650; color: var(--text);
}
.auftrag-section__title .ic { width: 18px; height: 18px; color: var(--accent-strong); }
.auftrag-section__count {
    font-size: 12.5px; font-weight: 600;
    color: var(--text-subtle);
    background: var(--surface-2);
    padding: 2px 10px; border-radius: 999px;
    min-width: 24px; text-align: center;
    font-variant-numeric: tabular-nums;
}
.auftrag-section__link {
    padding: 6px 12px; font-size: 13px;
}

.auftrag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    grid-auto-rows: 1fr;                 /* Alle Rows gleich hoch */
    gap: 12px;
    align-items: stretch;
}
.auftrag-grid__item { height: 100%; }

.auftrag-card {
    display: flex; align-items: stretch; gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    transition: border-color .15s ease, box-shadow .15s ease;
    height: 100%;                        /* Volle Zellenhoehe fuellen */
}
.auftrag-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.auftrag-card--dp:hover { border-color: #7c3aed; }

/* Teilweise ausgeblendete Auftrag-Karten (Initial-Limit = 3) */
.auftrag-grid__item.is-hidden { display: none; }

/* "N weitere anzeigen"-Button */
.auftrag-more {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 10px; padding: 8px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    cursor: pointer; user-select: none;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.auftrag-more:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-strong); }
.auftrag-more .ic { width: 14px; height: 14px; transition: transform .2s ease; }
.auftrag-more.is-expanded { display: none; }

.auftrag-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
/* Mitteilung sitzt immer unten in der Karte, damit alle Karten optisch gleich aussehen */
.auftrag-card__mitteilung { margin-top: auto; }
.auftrag-card__head {
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.auftrag-card__kunde {
    font-size: 15px; font-weight: 650; color: var(--text);
    letter-spacing: -0.01em;
}
.auftrag-card__standort {
    font-size: 13px; color: var(--text-muted);
}
.auftrag-card__meta {
    display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.auftrag-card__badge {
    display: inline-block;
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
    padding: 2px 8px; border-radius: 3px;
    background: var(--accent-tint); color: var(--accent-strong);
    font-variant-numeric: tabular-nums;
}
.auftrag-card__badge--dp {
    background: rgba(139,92,246,.12);
    color: #6d28d9;
}
.auftrag-card__projekttitel {
    font-size: 12.5px; color: var(--text-subtle);
}
.auftrag-card__adresse-row {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px;
}
.auftrag-card__adresse-row .ic {
    width: 13px; height: 13px; color: var(--text-subtle); flex: none;
}
.auftrag-card__adresse { color: var(--text-muted); text-decoration: none; }
.auftrag-card__adresse:hover { color: var(--accent-strong); text-decoration: underline; }
.auftrag-card__termin {
    font-size: 13px; color: var(--text);
    line-height: 1.5;
}
.auftrag-card__termin strong { color: var(--text-muted); font-weight: 600; margin-right: 6px; }
.auftrag-card__termin-leer { color: var(--text-subtle); font-style: italic; }
.auftrag__tag {
    display: inline-block;
    font-size: 11px; font-weight: 700;
    padding: 1px 6px; border-radius: 3px;
    background: var(--surface-2); color: var(--text-muted);
    letter-spacing: .02em;
}
/* Wochentag-farben pro Tag — editorial, dezent, aber unterscheidbar */
.auftrag__tag--mo { background: #dbeafe; color: #1e40af; }
.auftrag__tag--di { background: #dcfce7; color: #15803d; }
.auftrag__tag--mi { background: #fef3c7; color: #92400e; }
.auftrag__tag--do { background: #ede9fe; color: #6d28d9; }
.auftrag__tag--fr { background: #fce7f3; color: #be185d; }
.auftrag__tag--sa { background: #ffedd5; color: #c2410c; }
.auftrag__tag--so { background: #fee2e2; color: #b91c1c; }
[data-theme="dark"] .auftrag__tag--mo { background: rgba(59,130,246,.18); color: #93c5fd; }
[data-theme="dark"] .auftrag__tag--di { background: rgba(34,197,94,.18); color: #86efac; }
[data-theme="dark"] .auftrag__tag--mi { background: rgba(234,179,8,.18); color: #fde047; }
[data-theme="dark"] .auftrag__tag--do { background: rgba(139,92,246,.18); color: #c4b5fd; }
[data-theme="dark"] .auftrag__tag--fr { background: rgba(236,72,153,.18); color: #f9a8d4; }
[data-theme="dark"] .auftrag__tag--sa { background: rgba(249,115,22,.18); color: #fdba74; }
[data-theme="dark"] .auftrag__tag--so { background: rgba(239,68,68,.18); color: #fca5a5; }
.auftrag__arrow { color: var(--text-subtle); margin: 0 2px; }
.auftrag__uhrzeit {
    font-size: 12px; color: var(--text-muted); margin-left: 4px;
    font-variant-numeric: tabular-nums;
}
.auftrag-card__abschnitt-sep {
    display: inline-block; width: 1px; height: 10px;
    background: var(--border); margin: 0 8px; vertical-align: middle;
}
.auftrag-card__mitteilung {
    display: flex; align-items: flex-start; gap: 6px;
    font-size: 12.5px;
    padding: 8px 10px;
    background: rgba(217,119,6,.08);
    border-radius: 3px;
    color: #78350f;
    margin-top: 2px;
}
.auftrag-card__mitteilung .ic {
    width: 13px; height: 13px; color: #d97706; flex: none; margin-top: 2px;
}
.auftrag-card__actions {
    display: flex; align-items: center; flex: none;
}
.auftrag-card__open {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: background .15s ease, color .15s ease;
}
.auftrag-card__open:hover { background: var(--accent-tint); color: var(--accent-strong); }
.auftrag-card__open[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.auftrag-card__open .ic { width: 16px; height: 16px; }

/* =========================================================================
   Service: Offene-Aufträge-Liste (4-Spalten-Tabelle, mobile-friendly)
   ========================================================================= */
.auftrag-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auftrag-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.3fr) 44px;
    gap: 16px;
    align-items: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auftrag-row:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.auftrag-row--hist { opacity: .78; }

.auftrag-row__col { min-width: 0; }

.auftrag-row__nr {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
    margin-bottom: 4px;
}
.auftrag-row__badge {
    display: inline-block;
    font-size: 12px; font-weight: 700; letter-spacing: .02em;
    padding: 2px 8px; border-radius: 3px;
    background: var(--accent-tint); color: var(--accent-strong);
    font-variant-numeric: tabular-nums;
}
.auftrag-row__badge--dp {
    background: rgba(139,92,246,.12);
    color: #6d28d9;
    font-weight: 600;
}
.auftrag-row__kunde {
    font-size: 14.5px; font-weight: 650; color: var(--text);
    letter-spacing: -0.01em;
    overflow: hidden; text-overflow: ellipsis;
}
.auftrag-row__meta {
    font-size: 12px; color: var(--text-subtle); margin-top: 2px;
}
.auftrag-row__assigned {
    display: flex; flex-direction: column; gap: 1px;
    margin-top: 6px;
}
.auftrag-row__assigned-label {
    font-size: 11px; font-weight: 600; letter-spacing: .02em;
    color: var(--text-muted);
}
.auftrag-row__assigned-value {
    font-size: 12.5px; color: var(--text);
    font-variant-numeric: tabular-nums;
}

.auftrag-row__projekt {
    font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px;
    overflow: hidden; text-overflow: ellipsis;
}
.auftrag-row__standort {
    font-size: 13.5px; color: var(--text-muted); margin-bottom: 4px;
    overflow: hidden; text-overflow: ellipsis;
}
.auftrag-row__adresse {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; color: var(--text-muted); text-decoration: none;
}
.auftrag-row__adresse:hover { color: var(--accent-strong); text-decoration: underline; }
.auftrag-row__adresse .ic { width: 12px; height: 12px; flex: none; }

.auftrag-row__zeit-label {
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
    color: var(--text-muted); margin-bottom: 3px;
}
.auftrag-row__zeit-value {
    font-size: 13.5px; color: var(--text); line-height: 1.5;
}
.auftrag-row__zeit-sep {
    display: inline-block; width: 1px; height: 10px;
    background: var(--border); margin: 0 8px; vertical-align: middle;
}
.auftrag-row__zeit-leer { font-size: 13px; color: var(--text-subtle); font-style: italic; }
.auftrag-row__zeit-hint { font-size: 11.5px; color: var(--text-subtle); margin-top: 2px; }
.auftrag-row__mitteilung {
    display: flex; align-items: flex-start; gap: 6px;
    font-size: 12.5px;
    padding: 6px 10px;
    background: rgba(217,119,6,.08);
    border-radius: 3px;
    color: #78350f;
    margin-top: 8px;
}
.auftrag-row__mitteilung .ic { width: 12px; height: 12px; color: #d97706; flex: none; margin-top: 2px; }

.auftrag-row__open {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: var(--accent); color: #fff;
    opacity: .9;
    transition: opacity .15s ease, background .15s ease;
}
.auftrag-row__open:hover { opacity: 1; background: var(--accent-strong); }
.auftrag-row__open .ic { width: 16px; height: 16px; color: #fff; }
.auftrag-row__open[aria-disabled="true"] { background: var(--surface-2); opacity: .55; cursor: not-allowed; }
.auftrag-row__open[aria-disabled="true"] .ic { color: var(--text-muted); }
.auftrag-row__open--archiv { background: var(--surface-2); }
.auftrag-row__open--archiv .ic { color: var(--text-subtle); }

/* Mobile: Spalten stapeln */
@media (max-width: 820px) {
    .auftrag-row {
        grid-template-columns: 1fr 36px;
        grid-template-areas:
            "auftrag  action"
            "standort action"
            "zeit     zeit";
        gap: 10px;
    }
    .auftrag-row__col--auftrag  { grid-area: auftrag; }
    .auftrag-row__col--standort { grid-area: standort; }
    .auftrag-row__col--zeit     { grid-area: zeit; border-top: 1px dashed var(--border); padding-top: 10px; }
    .auftrag-row__col--action   { grid-area: action; justify-self: end; align-self: start; }
}

/* Mitteilungen von der Dispo (eigener Block oben) */
.mitteilungen { display: flex; flex-direction: column; gap: 8px; }
.mitteilung {
    display: flex; flex-direction: column; gap: 10px;
    padding: 14px 16px;
    background: rgba(217,119,6,.06);
    border: 1px solid rgba(217,119,6,.3);
    border-radius: var(--radius-sm);
}
.mitteilung__text {
    font-size: 13.5px; font-weight: 500; color: #78350f;
    line-height: 1.5;
}
.mitteilung__refs { display: flex; flex-wrap: wrap; gap: 6px; }
.mitteilung__chip {
    display: inline-flex; align-items: baseline; gap: 4px;
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid rgba(217,119,6,.3);
    border-radius: 999px;
    font-size: 12px; color: var(--text);
}
.mitteilung__chip strong { color: #92400e; font-weight: 700; font-variant-numeric: tabular-nums; }
.mitteilung__chip-kunde { color: var(--text-subtle); }

/* Historie: collapsible */
.auftrag-history { }
.auftrag-history__summary {
    cursor: pointer; user-select: none;
    list-style: none;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0;
}
.auftrag-history__summary::-webkit-details-marker { display: none; }
.auftrag-history__hint {
    margin-left: auto;
    font-size: 12px; color: var(--text-subtle);
}
.auftrag-history__hint--hide { display: none; }
.auftrag-history[open] .auftrag-history__hint--show { display: none; }
.auftrag-history[open] .auftrag-history__hint--hide { display: inline; }
.auftrag-history__pager { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }

/* =========================================================================
   Service: Auftrag-Detail (Hero, Block, Standort, Positionen, Verlauf)
   ========================================================================= */

/* ---- Firmen-Scope: Accent-Variablen pro Firma globalisieren ---------- */
.auftrag-firma.firma-elexx {
    --accent:          #E28913;
    --accent-strong:   #B86C0A;
    --accent-tint:     #FEF3E2;
}
.auftrag-firma.firma-lexxcontrol {
    --accent:          #3A728B;
    --accent-strong:   #2F5A70;
    --accent-tint:     #f0f7fa;
}
.auftrag-firma.firma-mida {
    --accent:          #EAB308;
    --accent-strong:   #CA8A04;
    --accent-tint:     #FEFCE8;
}

/* ---- HERO (1:1 Original-Struktur mit Firmen-Accent-Variablen) ---------- */
.auftrag-hero {
    /* Firmen-Accent: Default elexx (orange), Overrides pro Firma unten */
    --firma-accent:   #E28913;
    --firma-accent-d: #c2740f;
    --firma-accent-t: #fef3e3;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 18px;
}
.auftrag-hero.firma-lexxcontrol {
    --firma-accent:   #3A728B; --firma-accent-d: #2F5A70; --firma-accent-t: #f0f7fa;
}
.auftrag-hero.firma-mida {
    --firma-accent:   #EAB308; --firma-accent-d: #CA8A04; --firma-accent-t: #FEFCE8;
}

.auftrag-hero__top {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.auftrag-hero__id { display: flex; flex-direction: column; min-width: 0; }
.auftrag-hero__label {
    font-size: 11px; font-weight: 600; letter-spacing: .04em;
    color: var(--text-muted); margin-bottom: 2px;
}
.auftrag-hero__nr {
    font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
    line-height: 1.15; color: var(--text);
    font-variant-numeric: tabular-nums;
}
@media (min-width: 768px) { .auftrag-hero__nr { font-size: 24px; } }

.auftrag-hero__typ {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 6px;
    background: var(--firma-accent-t); color: var(--firma-accent-d);
    font-size: 11px; font-weight: 700; letter-spacing: .02em;
    flex: none;
}

.auftrag-hero__kunde {
    display: flex; align-items: center; gap: 8px;
    margin-top: 10px;
    font-size: 15px; font-weight: 700; color: var(--firma-accent-d);
}
.auftrag-hero__kunde .ic { width: 16px; height: 16px; flex: none; }
.auftrag-hero__kunde-kd {
    font-weight: 400; font-size: 12px; color: var(--text-subtle);
    margin-left: 4px;
}

.auftrag-hero__proj {
    display: flex; align-items: center; gap: 8px;
    margin-top: 4px;
    font-size: 13px; color: var(--text-muted);
}
.auftrag-hero__proj .ic { width: 14px; height: 14px; flex: none; color: var(--text-subtle); }

.auftrag-hero__meta {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 12px;
}
.auftrag-hero__chip {
    display: inline-flex; align-items: baseline; gap: 4px;
    padding: 3px 10px; border-radius: 6px;
    background: var(--surface-2); color: var(--text-muted);
    font-size: 11.5px;
}
.auftrag-hero__chip-k { font-weight: 600; color: var(--text-subtle); }

.auftrag-hero__prog {
    margin-top: 14px; padding-top: 12px;
    border-top: 1px solid var(--border);
}
.auftrag-hero__prog-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 6px;
}
.auftrag-hero__prog-l {
    font-size: 11px; font-weight: 600; letter-spacing: .04em;
    color: var(--text-muted);
}
.auftrag-hero__prog-v {
    font-size: 17px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.auftrag-hero__prog-track {
    height: 9px; border-radius: 5px;
    background: var(--surface-2); overflow: hidden;
}
.auftrag-hero__prog-fill {
    height: 100%; border-radius: 5px;
    transition: width .35s ease;
}
.auftrag-hero__prog-meta {
    margin-top: 4px;
    font-size: 11.5px; color: var(--text-subtle);
    font-variant-numeric: tabular-nums;
}

/* ---- BLOCK (allgemein) ---------- */
.auftrag-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 20px 20px;
    margin-bottom: 16px;
}
.auftrag-block__title {
    display: flex; align-items: center; gap: 10px;
    margin: 0 -20px 16px;
    padding: 11px 20px;
    background: var(--accent-tint);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 14px; font-weight: 650; color: var(--accent-strong);
    letter-spacing: -0.005em;
}
.auftrag-block__empty {
    padding: 20px; text-align: center;
    color: var(--text-muted); font-size: 13.5px;
    background: var(--surface-2); border-radius: var(--radius-sm);
}
.auftrag-block__grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;
}

/* Kontakt-Boxen */
.auftrag-kontakt {
    padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm);
}
.auftrag-kontakt__head {
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
    color: var(--text-muted); margin-bottom: 6px;
}
.auftrag-kontakt__row {
    display: grid; grid-template-columns: 95px 1fr; gap: 10px;
    font-size: 13px; padding: 3px 0;
}
.auftrag-kontakt__row > span { color: var(--text-subtle); font-weight: 500; }
.auftrag-kontakt__row a { color: var(--accent-strong); text-decoration: none; }
.auftrag-kontakt__row a:hover { text-decoration: underline; }
.auftrag-kontakt__empty { padding: 20px; text-align: center; color: var(--text-subtle); font-style: italic; font-size: 13px; }

/* Info-Blöcke (Projektinfo etc.) — Rich-Text aus Admin-Editor */
.auftrag-info { margin-bottom: 16px; }
.auftrag-info__label {
    font-family: var(--font-headline);
    font-size: 14.5px; font-weight: 500; letter-spacing: 0.2pt;
    color: var(--text); margin: 0 0 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}
.auftrag-info__text {
    font-size: 13.5px; line-height: 1.55; color: var(--text);
    padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm);
    /* Lange Rich-Texte scrollen (Hinweis-Felder vom Admin können sehr lang werden).
       KEIN overscroll-behavior:contain — sonst "verschluckt" das Textfeld
       das Wheel-Event und die Seite scrollt nicht weiter wenn Textfeld-Ende erreicht. */
    max-height: 320px;
    overflow-y: auto;
}
.auftrag-info__text::-webkit-scrollbar        { width: 6px; }
.auftrag-info__text::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }
.auftrag-info__text::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }
/* Rich-Text aus HTML-Editor sauber rendern (div align, font color, lists, b/u/i) */
.auftrag-info__text p,
.auftrag-info__text div { margin: 0 0 6px; }
.auftrag-info__text p:last-child,
.auftrag-info__text div:last-child { margin-bottom: 0; }
.auftrag-info__text br + br { content: ""; display: block; margin-top: 6px; }
.auftrag-info__text ul,
.auftrag-info__text ol {
    margin: 6px 0 10px;
    padding-left: 22px;
}
.auftrag-info__text ul { list-style: disc; }
.auftrag-info__text ol { list-style: decimal; }
.auftrag-info__text li { margin: 3px 0; }
.auftrag-info__text b,
.auftrag-info__text strong { font-weight: 700; }
.auftrag-info__text i,
.auftrag-info__text em { font-style: italic; }
.auftrag-info__text u { text-decoration: underline; }
.auftrag-info__text a { color: var(--accent-strong); text-decoration: none; }
.auftrag-info__text a:hover { text-decoration: underline; }
.auftrag-info__text font[color],
.auftrag-info__text [style*="color"] { /* bestehende Inline-Farben respektieren */ }
.auftrag-info__text [align="center"] { text-align: center; }
.auftrag-info__text [align="right"]  { text-align: right; }
.auftrag-info__text [align="left"]   { text-align: left; }

/* Dateianhänge */
.auftrag-files { }
.auftrag-files__title {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 600; color: var(--text);
    padding: 8px 0; list-style: none;
}
.auftrag-files__title::-webkit-details-marker { display: none; }
.auftrag-files__count {
    padding: 2px 8px; background: var(--surface-2); border-radius: 999px;
    font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.auftrag-files__hint { font-size: 11.5px; color: var(--text-subtle); font-style: italic; margin-left: auto; }
.auftrag-files__grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px;
    margin-top: 8px;
}
.auftrag-files__grid--two { grid-template-columns: repeat(2, 1fr); }

/* File-Zeile mit zusaetzlichen Aktion-Buttons (z.B. Mail bei Montagebericht) */
.auftrag-file--with-actions {
    display: flex; align-items: stretch; padding: 0; overflow: hidden;
}
.auftrag-file--with-actions .auftrag-file__main {
    flex: 1 1 auto; display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; text-decoration: none; color: inherit; min-width: 0;
}
.auftrag-file--with-actions .auftrag-file__main:hover { background: var(--surface); }
.auftrag-file__btn {
    flex: none; width: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; border-left: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.auftrag-file__btn:hover { background: var(--surface); color: var(--accent-strong); }
.auftrag-file__btn .ic { width: 16px; height: 16px; }
.auftrag-file__mail-sent { color: #16a34a; font-weight: 600; }

/* Dry-Run-Banner im Mail-Modal (wenn MONTAGEBERICHT_MAIL_LIVE != 1) */
.mb-mail-drybanner {
    padding: 10px 12px;
    background: #fef3c7; border: 1px solid #f59e0b; border-radius: var(--radius-sm);
    color: #78350f; font-size: 12.5px; line-height: 1.5;
}
.mb-mail-drybanner strong { color: #78350f; font-weight: 700; }
.mb-mail-drybanner code { background: rgba(255,255,255,.5); padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 11.5px; }

/* Fehlende-Kollegen-Liste im Warn-Modal */
.mb-missing-list {
    margin: 10px 0; padding: 10px 14px 10px 32px;
    background: #fef3c7; border: 1px solid #f59e0b; border-radius: var(--radius-sm);
    color: #78350f; font-size: 13.5px;
}
.mb-missing-list li { margin: 2px 0; }

/* Inline-Signature-Pad: Klick -> oeffnet Fullscreen-Overlay. Zeigt Preview nach Capture. */
.mb-sig {
    position: relative;
    border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
    background: #fff; height: 120px;
    overflow: hidden; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.mb-sig:hover { border-color: var(--accent); background: var(--accent-tint); }
.mb-sig__preview { max-width: 90%; max-height: 100px; object-fit: contain; }
.mb-sig__hint {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-subtle); font-size: 13px; pointer-events: none;
}
.mb-sig__hint .ic { width: 16px; height: 16px; }
.mb-sig.is-drawn .mb-sig__hint { display: none; }
.mb-sig__clear {
    position: absolute; top: 6px; right: 6px;
    width: 28px; height: 28px; border-radius: 4px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    z-index: 2;
}
.mb-sig__clear:hover { color: var(--danger); border-color: var(--danger); }
.mb-sig__clear .ic { width: 14px; height: 14px; }

/* Signature-Overlay: Desktop = kompaktes zentriertes Modal, Mobile = Fullscreen */
.sigfs {
    position: fixed; inset: 0; z-index: 25000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10, 15, 25, 0.72);
    user-select: none; -webkit-user-select: none;
    padding: 20px;
}
.sigfs[hidden] { display: none; }
.sigfs__box {
    display: flex; flex-direction: column;
    width: 100%; max-width: 720px;
    max-height: calc(100vh - 40px);
    background: #0f141b; border-radius: 8px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.sigfs__bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: #1f2836; color: #fff; font-size: 15px; font-weight: 600;
    flex-shrink: 0;
}
.sigfs__title { display: inline-flex; align-items: center; gap: 8px; }
.sigfs__title .ic { width: 18px; height: 18px; }
.sigfs__x {
    width: 36px; height: 36px; border-radius: 4px;
    background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.2);
    font-size: 22px; line-height: 1; cursor: pointer;
}
.sigfs__rotate {
    padding: 6px 12px; background: #2a3446; color: #a1adbd;
    font-size: 11.5px; text-align: center;
    display: none; align-items: center; justify-content: center; gap: 6px;
    flex-shrink: 0;
}
.sigfs__rotate .ic { width: 12px; height: 12px; }
.sigfs__wrap { position: relative; background: #fff; height: 320px; }
.sigfs__canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; display: block; }
.sigfs__ph {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #c7cad1; font-size: 15px; pointer-events: none;
}
.sigfs.is-drawn .sigfs__ph { display: none; }
.sigfs__line {
    position: absolute; left: 10%; right: 10%; bottom: 24%;
    height: 1px; background: #e5e7eb; pointer-events: none;
}
.sigfs__actions {
    display: flex; gap: 10px; padding: 12px 16px;
    background: #1f2836; flex-shrink: 0;
}
.sigfs__btn {
    flex: 1; padding: 10px 16px; border-radius: 6px;
    background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25);
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.sigfs__btn .ic { width: 16px; height: 16px; }
.sigfs__btn:hover { background: rgba(255,255,255,.08); }
.sigfs__btn--save { background: #16a34a; border-color: #16a34a; }
.sigfs__btn--save:hover { background: #15803d; }

/* Mobile: Fullscreen-Variante (statt Modal), inkl. safe-area */
@media (max-width: 720px) {
    .sigfs { padding: 0; background: #0f141b; }
    .sigfs__box {
        max-width: none; max-height: none;
        width: 100%; height: 100%; border-radius: 0;
    }
    .sigfs__bar { padding-top: calc(12px + env(safe-area-inset-top)); }
    .sigfs__actions { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .sigfs__wrap { flex: 1 1 auto; height: auto; min-height: 0; }
    .sigfs__rotate { display: flex; }
    .sigfs__btn { padding: 14px 16px; font-size: 15px; }
}
@media (max-width: 720px) and (orientation: landscape) {
    .sigfs__rotate { display: none; }
}

/* Overlay darf nicht gescrollt werden */
body.sigfs-open { overflow: hidden; }

/* KI-Aktionen (Mistral) am Bemerkungs-Textarea */
.mb-ki-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.mb-ki-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: var(--radius-sm);
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; font: inherit; font-size: 11.5px;
}
.mb-ki-btn:hover:not(:disabled) { background: var(--accent-tint); color: var(--accent-strong); border-color: var(--accent); }
.mb-ki-btn:disabled { opacity: 0.5; cursor: wait; }

/* Berichtszeitraum-Hinweis (KW) unter den Datumsfeldern */
.mb-berichtszeitraum {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 2px 0 10px; padding: 6px 10px;
    font-size: 12.5px; color: var(--text-muted);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.mb-berichtszeitraum[hidden] { display: none; }
.mb-berichtszeitraum .ic { width: 14px; height: 14px; flex-shrink: 0; color: var(--accent); }
.mb-berichtszeitraum strong { color: var(--text); font-weight: 600; }

/* mb_mail_config-Editor (Admin-Modal) */
.mb-cfg-list {
    display: flex; flex-direction: column; gap: 4px;
    max-height: 300px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px; background: var(--surface-2);
    margin-bottom: 12px;
}
.mb-cfg-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    cursor: pointer; background: var(--surface);
}
.mb-cfg-item:hover { background: var(--accent-tint); }
.mb-cfg-item input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); }
.mb-cfg-item__body { flex: 1; min-width: 0; }
.mb-cfg-item__name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.mb-cfg-item__email { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mb-cfg-item__badge {
    display: inline-block; margin-left: 8px; padding: 1px 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; font-size: 10.5px; font-weight: 600; color: var(--text-muted);
}
.mb-cfg-item__badge--mb { color: #16a34a; border-color: rgba(22,163,74,.3); background: #ecfdf3; }

/* Image-Thumbnail als File-Icon */
.ic.ic--thumb {
    width: 42px; height: 42px; object-fit: cover; border-radius: 4px;
    border: 1px solid var(--border); background: var(--surface-2);
    flex: none;
}
.auftrag-file[data-lightbox-src] { cursor: zoom-in; }

/* Lightbox-Overlay (fuer Bild-Preview) */
.lightbox {
    position: fixed; inset: 0; z-index: 20000;
    background: rgba(10, 15, 25, 0.88);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: lbIn 0.18s ease-out;
}
.lightbox[hidden] { display: none; }
.lightbox__img {
    max-width: 92vw; max-height: 92vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    background: #fff;
}
.lightbox__caption {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    padding: 6px 14px; background: rgba(0,0,0,.6); color: #fff;
    border-radius: 999px; font-size: 12.5px; white-space: nowrap;
    max-width: 80vw; overflow: hidden; text-overflow: ellipsis;
}
.lightbox__close {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.1); color: #fff;
    border: none; font-size: 22px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.lightbox__close:hover { background: rgba(255,255,255,.2); }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 560px) { .auftrag-files__grid--two { grid-template-columns: 1fr; } }
.auftrag-file.is-hidden { display: none; }

/* Pager fuer Montageberichte-Section */
.auftrag-pager {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 12px; padding: 6px 0;
    font-size: 13px; color: var(--text-muted);
}
.auftrag-pager__btn {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    font-size: 16px; line-height: 1; cursor: pointer; font-family: inherit;
}
.auftrag-pager__btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); color: var(--accent-strong); }
.auftrag-pager__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.auftrag-pager__info { font-variant-numeric: tabular-nums; }
.auftrag-file {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--surface-2);
    border-radius: var(--radius-sm);
}
.auftrag-file > .ic { width: 20px; height: 20px; color: var(--text-muted); flex: none; }
.auftrag-file__body { flex: 1; min-width: 0; }
.auftrag-file__name { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auftrag-file__meta { font-size: 11.5px; color: var(--text-subtle); margin-top: 2px; }
.auftrag-file__action {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.auftrag-file__action[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.auftrag-file__action .ic { width: 14px; height: 14px; }

/* Terminbuchungen */
.auftrag-booking-list { display: flex; flex-direction: column; gap: 8px; }
.auftrag-booking {
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px; padding: 10px 12px; background: var(--surface-2);
    border-radius: var(--radius-sm); font-size: 13px;
}
.auftrag-booking--storniert { opacity: .55; text-decoration: line-through; }
.auftrag-booking__name    { font-weight: 500; }
.auftrag-booking__abteilung { color: var(--text-muted); font-weight: 400; }
.auftrag-booking__tag     { font-size: 11px; padding: 1px 6px; background: #fee2e2; color: #991b1b; border-radius: 3px; margin-left: 6px; }
.auftrag-booking__time    { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.auftrag-booking__wd {
    display: inline-block; min-width: 20px; padding: 1px 6px;
    background: var(--surface-2); border-radius: var(--radius-sm);
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    margin-right: 2px;
}
.auftrag-block__count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 20px; padding: 0 8px;
    background: #fff; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    border-radius: 999px;
    font-size: 11.5px; font-weight: 700; color: var(--accent-strong);
    font-variant-numeric: tabular-nums;
}
.auftrag-booking__mail    { color: var(--accent-strong); text-decoration: none; }
.auftrag-booking__mail:hover { text-decoration: underline; }

/* ---- STANDORT-CARD (mit Farb-Akzent links je Status) ---------- */
.auftrag-standort {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
}
.auftrag-standort--done { background: #f6fdf8; border-color: rgba(22,163,74,.3); }

.auftrag-standort__head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; cursor: pointer; user-select: none;
    list-style: none;
}
.auftrag-standort__head::-webkit-details-marker { display: none; }
.auftrag-standort__head:hover { background: var(--surface-2); }
.auftrag-standort--done .auftrag-standort__head:hover { background: #ecfdf3; }
.auftrag-standort__head-main { flex: 1; min-width: 0; }
.auftrag-standort__title { margin: 0 0 2px; font-size: 15px; font-weight: 650; color: var(--text); }
.auftrag-standort__addr  { font-size: 12.5px; color: var(--text-muted); }
.auftrag-standort__head-side { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.auftrag-standort__done-at { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.auftrag-standort__chev { width: 14px; height: 14px; color: var(--text-muted); transition: transform .15s ease; }
.auftrag-standort[open] .auftrag-standort__chev { transform: rotate(180deg); }

.auftrag-pill {
    display: inline-flex; align-items: center;
    padding: 2px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
}
.auftrag-pill--open   { background: rgba(234,179,8,.15); color: #a16207; }
.auftrag-pill--done   { background: rgba(22,163,74,.15); color: #166534; }
.auftrag-pill--interrupted { background: rgba(239,68,68,.14); color: #991b1b; }

.auftrag-standort__body {
    padding: 0 16px 16px;
    display: flex; flex-direction: column; gap: 14px;
}
.auftrag-standort__notice {
    padding: 10px 12px; background: #fef3c7; color: #92400e; border-radius: var(--radius-sm); font-size: 13px;
}
/* Standort-Kontakte nebeneinander wenn mehrere APs */
.auftrag-standort__contacts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

/* === Standort-Infos-Block (neu gegliedert) === */
.auftrag-infos {
    display: flex; flex-direction: column; gap: 12px;
}
.auftrag-infos__alert {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; margin-bottom: 10px;
    background: #fef2f2; color: #991b1b;
    border: 1px solid rgba(220,38,38,.25);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.auftrag-infos__alert .ic { width: 18px; height: 18px; flex: none; }
.auftrag-infos__alert strong { font-weight: 700; }

/* Fakten-Kacheln (Adresse / Stückzahl) */
.auftrag-infos__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}
.auftrag-fact {
    padding: 10px 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}
.auftrag-fact__label {
    font-size: 11px; font-weight: 600; letter-spacing: .04em;
    color: var(--text-subtle); margin-bottom: 4px;
}
.auftrag-fact__value {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13.5px; color: var(--text); font-weight: 500;
    line-height: 1.4;
}
.auftrag-fact__value--link { color: var(--accent-strong); text-decoration: none; }
.auftrag-fact__value--link:hover { text-decoration: underline; }
.auftrag-fact__value .ic { width: 13px; height: 13px; flex: none; color: var(--text-subtle); }
.auftrag-fact__value--num { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.auftrag-fact--address { grid-column: 1 / -1; }

/* Standort-Hinweis-Text als eigener Call-out */
.auftrag-infos__note {
    padding: 12px 14px;
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    border-radius: var(--radius-sm);
}
.auftrag-infos__note-label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
    color: var(--accent-strong);
    margin-bottom: 4px;
}
.auftrag-infos__note-label .ic { width: 13px; height: 13px; }
.auftrag-infos__note-text {
    font-size: 13.5px; line-height: 1.55; color: var(--text);
    white-space: pre-wrap;
}

/* Kontakte-Grid: 2-spaltig wenn beide, sonst volle Breite */
.auftrag-infos__contacts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}
.auftrag-kontakt .ic { width: 13px; height: 13px; flex: none; }
.auftrag-kontakt__head {
    display: inline-flex; align-items: center; gap: 6px;
}
.auftrag-kontakt--primary {
    background: var(--accent-tint);
    border: 1px solid var(--accent);
}
.auftrag-kontakt--primary .auftrag-kontakt__head {
    color: var(--accent-strong);
}
.auftrag-kontakt--primary .ic { color: var(--accent-strong); }
/* Standort-Aktionsleiste (Abschließen / Wiedereröffnen) */
.auftrag-standort__actions {
    display: flex; gap: 8px; align-items: center;
    padding-top: 10px; margin-top: 4px;
    border-top: 1px dashed var(--border);
}
.auftrag-standort__action-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font: inherit; font-size: 13px; font-weight: 600; line-height: 1.35;
    text-decoration: none; cursor: pointer; user-select: none;
    border: 1px solid transparent;
    transition: background .12s ease, border-color .12s ease;
}
.auftrag-standort__action-btn--finish {
    background: #16a34a; color: #fff;
}
.auftrag-standort__action-btn--finish:hover { background: #15803d; }
.auftrag-standort__action-btn--report {
    background: var(--surface); color: var(--text);
    border-color: var(--border);
}
.auftrag-standort__action-btn--report:hover {
    background: var(--surface-2); border-color: var(--accent); color: var(--accent-strong);
}
.auftrag-standort__action-btn--reopen {
    background: var(--surface); color: var(--text-muted);
    border-color: var(--border);
}
.auftrag-standort__action-btn--reopen:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent-strong); }
.auftrag-standort__action-btn .ic { width: 14px; height: 14px; }

/* Sub-Section-Action-Button (z.B. "Eintragen" in Einsatzzeiten-Head) */
.auftrag-sub__action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; margin-left: auto;
    border: 1px solid var(--accent); background: var(--accent-tint);
    color: var(--accent-strong); border-radius: var(--radius-sm);
    font-size: 11.5px; font-weight: 600;
    cursor: pointer; user-select: none;
    transition: background .12s ease;
}
.auftrag-sub__action-btn:hover { background: var(--accent); color: #fff; }
.auftrag-sub__action-btn .ic { width: 12px; height: 12px; }

/* Edit-Button in Tagesmeldungs-Tabelle */
.auftrag-table__action { width: 36px; text-align: right; }
.auftrag-table__edit {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 4px;
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    cursor: pointer; transition: all .12s ease;
}
.auftrag-table__edit:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-strong); }
.auftrag-table__edit .ic { width: 13px; height: 13px; }

/* === Modal via <dialog> === */
.auftrag-modal {
    border: none; border-radius: var(--radius);
    padding: 0; max-width: 480px; width: calc(100% - 40px);
    background: var(--surface); color: var(--text);
    box-shadow: 0 20px 60px rgba(16,24,40,.3);
    overflow: visible;
}
.auftrag-modal::backdrop { background: rgba(10,15,25,.55); backdrop-filter: blur(2px); }
.auftrag-modal__form { display: flex; flex-direction: column; }
.auftrag-modal__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.auftrag-modal__head h3 { margin: 0; font-size: 16px; font-weight: 650; color: var(--text); }
.auftrag-modal__close {
    width: 32px; height: 32px; border-radius: 4px;
    background: transparent; border: none; color: var(--text-muted);
    font-size: 22px; line-height: 1; cursor: pointer;
}
.auftrag-modal__close:hover { background: var(--surface-2); color: var(--text); }

.auftrag-modal__body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; overflow: visible; }
/* `[hidden]`-Attribut-Override: `.auftrag-modal__*` setzen display:flex, was native `hidden`
   (equiv display:none) ueberschreibt. Hier wieder zurueckholen. */
.auftrag-modal__body[hidden],
.auftrag-modal__foot[hidden],
.auftrag-modal__field[hidden] { display: none !important; }
.auftrag-modal__row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.auftrag-modal__field { display: flex; flex-direction: column; gap: 4px; }
.auftrag-modal__field label {
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
    color: var(--text-muted);
}
.auftrag-modal__field input,
.auftrag-modal__field select {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 14px; color: var(--text); background: var(--surface);
    font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
.auftrag-modal__field select {
    appearance: none; -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 6 6 11 1'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}
.auftrag-modal__field input:focus,
.auftrag-modal__field select:focus {
    outline: none; border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Caret global ausblenden - User-Wunsch. In echten Text-Eingaben re-aktivieren,
   damit man beim Tippen sieht wo man ist. Contenteditable bleibt sichtbar
   (siehe memory project_caret_color_style_css.md). */
* { caret-color: transparent; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
textarea,
[contenteditable],
[contenteditable="true"] {
    caret-color: auto;
}
/* Datepicker-Felder trotz type="text" bewusst ohne Caret (nicht wirklich text-editable) */
.mb-date__wrap input { caret-color: transparent; }

/* Placeholder verschwindet bei Focus (statt wie sonst erst beim Tippen) */
input:focus::placeholder,
textarea:focus::placeholder { color: transparent; }
input:focus::-webkit-input-placeholder,
textarea:focus::-webkit-input-placeholder { color: transparent; }

/* Datumsfeld im MB-Modal mit explizitem Kalender-Icon-Button */
.mb-date { position: relative; }
.mb-date__wrap {
    position: relative;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.mb-date__wrap:hover { border-color: var(--accent); }
.mb-date__wrap:focus-within {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.mb-date__wrap input {
    display: block; width: 100%;
    appearance: none; -webkit-appearance: none;
    padding: 9px 44px 9px 12px;
    border: none; outline: none; background: transparent;
    font-size: 14px; font-family: inherit; color: var(--text);
    cursor: pointer;
}
.mb-date__btn {
    position: absolute; right: 0; top: 0; bottom: 0; width: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; border-left: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer;
    transition: color .15s ease, background .15s ease;
}
.mb-date__btn:hover { color: var(--accent-strong); background: var(--surface-2); }
.mb-date__btn svg { width: 16px; height: 16px; }

/* Eigener Datepicker (dp) — popup unter mb-date__wrap */
.dp {
    position: absolute; top: calc(100% + 4px); left: 0;
    z-index: 10000;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(16,24,40,.18);
    padding: 10px; min-width: 260px;
    font-family: inherit; font-size: 13px; color: var(--text);
    user-select: none;
}
.dp--up { top: auto; bottom: calc(100% + 4px); box-shadow: 0 -12px 40px rgba(16,24,40,.18); }
.dp[hidden] { display: none; }
.dp__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.dp__title { font-weight: 600; font-size: 13.5px; }
.dp__nav {
    width: 28px; height: 28px; border-radius: 4px;
    background: transparent; border: none; color: var(--text-muted);
    font-size: 18px; line-height: 1; cursor: pointer;
}
.dp__nav:hover { background: var(--surface-2); color: var(--text); }
.dp__grid {
    display: grid; grid-template-columns: 28px repeat(7, 1fr);
    gap: 2px;
}
.dp__wd {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    text-align: center; padding: 4px 0;
}
.dp__wd--kw { color: var(--text-subtle); }
.dp__kw {
    font-size: 11px; color: var(--text-subtle); font-weight: 600;
    text-align: center; padding: 6px 0;
    border-right: 1px solid var(--border); margin-right: 4px;
}
.dp__d {
    width: 32px; height: 32px; line-height: 32px;
    text-align: center; border-radius: 4px;
    cursor: pointer; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.dp__d:hover:not(.dp__d--disabled) { background: var(--accent-tint); color: var(--accent-strong); }
.dp__d--out { color: var(--text-subtle); opacity: 0.5; }
.dp__d--today { border: 1px solid var(--accent); color: var(--accent-strong); font-weight: 700; }
.dp__d--sel, .dp__d--sel:hover { background: var(--accent); color: #fff; }
.dp__d--disabled { color: var(--text-subtle); opacity: 0.4; cursor: not-allowed; }
.auftrag-modal__static {
    padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm);
    font-size: 13px; color: var(--text-muted);
}
.auftrag-modal__alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; margin-bottom: 12px;
    background: #fef2f2; border: 1px solid #dc2626; border-left-width: 4px;
    border-radius: var(--radius-sm);
    color: #991b1b; font-size: 13px; line-height: 1.45;
    animation: shake .35s ease-out;
}
.auftrag-modal__alert .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; color: #dc2626; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
/* Auto-Open bei errors: dialog bleibt open wenn Fehler da */
.auftrag-modal__hint {
    margin: 0; padding: 8px 10px;
    background: var(--surface-2); border-radius: var(--radius-sm);
    font-size: 11.5px; color: var(--text-subtle); font-style: italic;
}
.auftrag-modal__foot {
    display: flex; justify-content: flex-start; gap: 8px;
    padding: 14px 20px; border-top: 1px solid var(--border);
}
@media (max-width: 520px) {
    .auftrag-modal__row { grid-template-columns: 1fr; }
}

/* Aufwand-Modal: breiter + Trigger-Hint + Textarea */
.auftrag-modal--wide { max-width: 580px; }
.auftrag-modal__intro { margin: 0 0 10px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.auftrag-modal__trigger-hint {
    padding: 8px 12px; margin-bottom: 12px;
    background: #fef3c7; color: #92400e;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}
.auftrag-modal__trigger-hint strong { margin-right: 6px; }
.auftrag-modal__trigger-hint span { font-weight: 700; font-variant-numeric: tabular-nums; }
.auftrag-modal__field textarea {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 14px; color: var(--text); background: var(--surface);
    font-family: inherit; resize: vertical; min-height: 72px;
}
.auftrag-modal__field textarea:focus {
    outline: none; border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Subhead (Gruppen-Überschrift innerhalb Standort-Body) */
.auftrag-subhead {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    color: var(--text-subtle);
    text-transform: none;
    padding: 10px 0 2px;
    border-top: 1px dashed var(--border);
    margin-top: 4px;
}
.auftrag-subhead:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

/* Rückmeldungs-Section hervorgehoben als "Hauptinhalt" */
.auftrag-sub--highlight {
    background: linear-gradient(180deg, var(--surface-2) 0%, transparent 100%);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 0 -2px;
}
.auftrag-sub--highlight .auftrag-sub__title {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text);
}
.auftrag-sub__title-ic { width: 15px; height: 15px; color: var(--text-muted); }

/* Flash-Messages (Legacy, bleibt fuer andere Views) */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; }
.flash--ok  { background: #ecfdf3; border: 1px solid rgba(22,163,74,.3); color: #166534; }
.flash--err { background: #fef2f2; border: 1px solid rgba(220,38,38,.3); color: #991b1b; }

/* Toast-Stack rechts unten mit Auto-Fadeout */
.toast-stack {
    position: fixed; right: 20px; bottom: 20px; z-index: 10001;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}
.toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 10px;
    min-width: 260px; max-width: 420px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(16,24,40,.18);
    font-size: 13.5px; line-height: 1.4; color: var(--text);
    animation: toastIn .22s ease-out, toastOut .35s ease-in 5s forwards;
}
.toast .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast--ok  { border-left: 4px solid #16a34a; }
.toast--ok  .ic { color: #16a34a; }
.toast--err { border-left: 4px solid #dc2626; }
.toast--err .ic { color: #dc2626; }
.toast--warn { border-left: 4px solid #d97706; }
.toast--warn .ic { color: #d97706; }
.toast--info { border-left: 4px solid var(--accent); }
.toast--info .ic { color: var(--accent); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(20px); visibility: hidden; } }
@media (max-width: 520px) {
    .toast-stack { right: 10px; left: 10px; bottom: 10px; }
    .toast { min-width: 0; width: 100%; max-width: none; }
}

/* Auftrag-Lock-Banner (wenn auftraege.abgeschlossen=1) */
.auftrag-lock-banner {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; margin-bottom: 16px;
    background: #fef3c7; border: 1px solid #f59e0b; border-radius: var(--radius-sm);
    color: #78350f; font-size: 13.5px; line-height: 1.4;
}
.auftrag-lock-banner .ic { width: 20px; height: 20px; color: #b45309; flex: none; }
.auftrag-lock-banner strong { color: #78350f; font-weight: 700; }

/* Rückmeldungs-Formular: Input, Textarea, Checkbox, Save-Button */
.auftrag-rueckmeldung-form { }
.auftrag-pos__input-col { grid-column: 1; grid-row: 1; min-width: 0; }
.auftrag-pos__input {
    width: 100%; height: 36px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0 10px;
    font-size: 14px; font-weight: 600; color: var(--text);
    text-align: center;
    background: var(--surface);
    font-family: inherit;
    -webkit-appearance: none; appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.auftrag-pos__input:focus {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-muted) 25%, transparent);
}
.auftrag-pos__input.filled {
    border-color: var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
}
.auftrag-pos__input::placeholder { color: var(--text-subtle); font-weight: 400; }

/* Position heute bereits gemeldet: statt Input ein "Heute gemeldet"-Badge */
.auftrag-pos__reported-badge {
    display: inline-flex; align-items: center; gap: 6px;
    width: 100%; height: 36px; padding: 0 10px;
    border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text-muted);
    font-size: 12px; font-weight: 600; justify-content: center;
    user-select: none;
}
.auftrag-pos__reported-badge .ic { width: 14px; height: 14px; color: #16a34a; flex: none; }
.auftrag-pos__info-head {
    display: flex; align-items: baseline; gap: 10px;
    margin-bottom: 2px;
}

.auftrag-rueckmeldung__accordion {
    margin-top: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.auftrag-rueckmeldung__accordion > summary {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    cursor: pointer; user-select: none;
    list-style: none;
    font-size: 13px; font-weight: 600; color: var(--text-muted);
}
.auftrag-rueckmeldung__accordion > summary::-webkit-details-marker { display: none; }
.auftrag-rueckmeldung__accordion > summary:hover { background: var(--surface-2); }
.auftrag-rueckmeldung__accordion > summary .ic { width: 14px; height: 14px; color: var(--text-subtle); flex: none; }
.auftrag-rueckmeldung__accordion > summary .ic--note { color: #3b82f6; width: 16px; height: 16px; }
.auftrag-rueckmeldung__accordion > summary .ic--moon { color: #ca8a04; width: 16px; height: 16px; fill: rgba(234, 179, 8, 0.25); }
.auftrag-rueckmeldung__chev { margin-left: auto; transition: transform .15s ease; }
.auftrag-rueckmeldung__accordion[open] .auftrag-rueckmeldung__chev { transform: rotate(180deg); color: var(--accent-strong); }
.auftrag-rueckmeldung__accordion-body { padding: 10px 14px 14px; border-top: 1px solid var(--border); }

.auftrag-rueckmeldung__hint {
    padding: 8px 10px; margin-bottom: 8px;
    background: #fef3c7; color: #92400e;
    border-radius: 4px;
    font-size: 12px; line-height: 1.5;
}

.auftrag-rueckmeldung__textarea {
    width: 100%; min-height: 72px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 13px; color: var(--text); background: var(--surface);
    font-family: inherit; resize: vertical;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auftrag-rueckmeldung__textarea:focus {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.auftrag-rueckmeldung__checkbox {
    display: flex; align-items: flex-start; gap: 10px;
    cursor: pointer; user-select: none;
    font-size: 13px; color: var(--text);
}
.auftrag-rueckmeldung__checkbox input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: var(--accent-strong);
    cursor: pointer; margin-top: 1px;
}
.auftrag-rueckmeldung__checkbox-title {
    display: block; font-weight: 600; color: var(--text);
}
.auftrag-rueckmeldung__checkbox-sub {
    display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px;
}

.auftrag-rueckmeldung__actionbar {
    display: flex; justify-content: flex-end;
    margin-top: 14px;
}
.auftrag-rueckmeldung__save {
    padding: 8px 16px;
    font-weight: 600; font-size: 13px;
}
.auftrag-rueckmeldung__save:disabled {
    opacity: .5; cursor: not-allowed;
}

/* Projektbezogene Dokumente: farblich hervorheben wenn vorhanden */
.auftrag-files--has .auftrag-files__title {
    background: var(--accent-tint);
    color: var(--accent-strong);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
}
.auftrag-files--has .auftrag-files__title:hover {
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}
.auftrag-files--has .auftrag-files__count {
    background: var(--surface); color: var(--accent-strong);
}
.auftrag-files--has .auftrag-files__hint { color: var(--accent-strong); font-style: normal; font-weight: 600; }
.auftrag-files__title-ic { width: 15px; height: 15px; color: var(--accent-strong); flex: none; }

/* Sub-Section innerhalb des Standorts */
.auftrag-sub { padding-top: 6px; }
.auftrag-sub__head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px;
}
.auftrag-sub__title {
    margin: 0; font-size: 13.5px; font-weight: 650; color: var(--text);
    flex: 1 1 auto; min-width: 0;
}
.auftrag-sub__head .auftrag-sub__chev { margin-left: auto; }
.auftrag-sub__meta { font-size: 12px; color: var(--text-muted); }
.auftrag-sub__meta b { color: var(--text); font-weight: 700; }
.auftrag-sub__count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; padding: 1px 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.auftrag-sub__hint  { font-size: 11.5px; color: var(--text-subtle); margin: 4px 0 0; font-style: italic; }
.auftrag-sub__empty { font-size: 12.5px; color: var(--text-subtle); margin: 0; padding: 8px 0; font-style: italic; }

/* Collapsible Sub-Sections (default: zugeklappt wie im Original) */
.auftrag-sub--collapsible { padding: 0; }
.auftrag-sub__head--toggle {
    cursor: pointer; user-select: none; list-style: none;
    padding: 10px 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 0; transition: background .12s ease;
}
.auftrag-sub__head--toggle::-webkit-details-marker { display: none; }
.auftrag-sub__head--toggle:hover { background: var(--surface-2); border-color: var(--accent); }
.auftrag-sub__chev {
    width: 14px; height: 14px; color: var(--text-muted);
    transition: transform .15s ease; flex: none;
}
.auftrag-sub--collapsible[open] .auftrag-sub__head--toggle {
    border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.auftrag-sub--collapsible[open] .auftrag-sub__chev { transform: rotate(180deg); color: var(--accent-strong); }
.auftrag-sub--collapsible > *:not(.auftrag-sub__head--toggle) {
    padding: 12px; background: var(--surface);
    border: 1px solid var(--border); border-top: 0;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.auftrag-sub--empty .auftrag-sub__head--toggle { opacity: .7; }

/* Positionen-Liste (Rückmeldung-Vorschau)
   Mobile: Cards vertikal gestapelt
   Desktop (≥ 768px): 3-Spalten-Grid analog zum Original (Status | Info/Progress | Stats) */
.auftrag-pos-list {
    display: flex; flex-direction: column; gap: 10px;
}
.auftrag-pos {
    padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column; gap: 6px;
}
.auftrag-pos__status-col {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px;
    min-height: 36px;
}
.auftrag-pos__artnr { font-size: 12.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.auftrag-pos__pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600; letter-spacing: .02em;
    padding: 2px 10px; border-radius: 999px;
    white-space: nowrap;
}
.auftrag-pos__pill::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: currentColor; flex-shrink: 0;
}
.auftrag-pos__pill--open         { background: rgba(234,179,8,.12);  color: #a16207; }
.auftrag-pos__pill--in_progress  { background: rgba(59,130,246,.12); color: #1e40af; }
.auftrag-pos__pill--complete     { background: rgba(22,163,74,.12);  color: #166534; }
.auftrag-pos__pill--over         { background: rgba(239,68,68,.12);  color: #991b1b; }

.auftrag-pos__info { min-width: 0; }
.auftrag-pos__artbez { font-size: 13.5px; color: var(--text); font-weight: 500; }
.auftrag-pos__hinweis { font-size: 11.5px; color: var(--text-subtle); font-style: italic; margin-top: 2px; }
.auftrag-pos__prog {
    height: 4px; margin-top: 6px; border-radius: 999px;
    background: var(--surface-2); overflow: hidden;
}
.auftrag-pos__prog-fill { height: 100%; transition: width .25s ease; }
.auftrag-pos__prog-fill--open        { background: #94a3b8; }
.auftrag-pos__prog-fill--in_progress { background: #3b82f6; }
.auftrag-pos__prog-fill--complete    { background: #16a34a; }
.auftrag-pos__prog-fill--over        { background: #dc2626; }

.auftrag-pos__stats {
    display: flex; gap: 6px; min-width: 0;
}
.auftrag-pos__stats > div {
    flex: 1 1 0; min-width: 0;
    background: var(--surface-2); border-radius: 6px;
    padding: 6px 4px; text-align: center;
}
.auftrag-pos__stats label {
    display: block;
    font-size: 10.5px; font-weight: 500; color: var(--text-subtle);
    margin-bottom: 1px;
}
.auftrag-pos__stats b {
    font-size: 15px; font-weight: 700; color: var(--text);
    font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
    .auftrag-pos {
        display: grid;
        grid-template-columns: 140px minmax(0, 1fr) 240px;
        gap: 10px 16px; align-items: center;
        padding: 10px 14px;
    }
    .auftrag-pos__status-col { grid-column: 1; grid-row: 1; min-height: 0; }
    .auftrag-pos__info       { grid-column: 2; grid-row: 1; }
    .auftrag-pos__stats      { grid-column: 3; grid-row: 1; }
}

/* Info-Grid (Standort-Infos) */
.auftrag-info-grid { display: flex; flex-direction: column; gap: 4px; }
.auftrag-info-grid__row {
    display: grid; grid-template-columns: 150px 1fr; gap: 10px;
    padding: 4px 0; font-size: 13px;
}
.auftrag-info-grid__row > span { color: var(--text-subtle); font-weight: 500; }
.auftrag-info-grid__row a { color: var(--accent-strong); text-decoration: none; }
.auftrag-info-grid__row a:hover { text-decoration: underline; }

/* Techniker-Chips */
.auftrag-tech-list { display: flex; flex-wrap: wrap; gap: 8px; }
.auftrag-tech-chip {
    display: inline-flex; align-items: baseline; gap: 8px;
    padding: 6px 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 12.5px;
}
.auftrag-tech-chip--dauerprojekt { background: rgba(139,92,246,.08); border-color: rgba(139,92,246,.3); }
.auftrag-tech-chip__name { font-weight: 600; color: var(--text); }
.auftrag-tech-chip__kind {
    font-size: 10px; font-weight: 600; padding: 1px 6px;
    background: rgba(139,92,246,.14); color: #6d28d9; border-radius: 3px; letter-spacing: .02em;
}
.auftrag-tech-chip__meta { font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

/* Tabellen (Tagesmeldungen, Einsatzzeiten) */
.auftrag-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.auftrag-table th {
    text-align: left; padding: 8px 10px; font-size: 11.5px; font-weight: 600;
    color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
    letter-spacing: .02em;
}
.auftrag-table td {
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    color: var(--text);
}
.auftrag-table tbody tr:last-child td { border-bottom: 0; }
.auftrag-table tbody tr:hover { background: var(--surface-2); }
.auftrag-table__num { font-variant-numeric: tabular-nums; }
.auftrag-table__artnr { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.auftrag-table__artbez { font-size: 13px; color: var(--text); }

/* Bemerkungen */
.auftrag-note-list { display: flex; flex-direction: column; gap: 8px; }
.auftrag-note {
    padding: 10px 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.auftrag-note__text { font-size: 13px; color: var(--text); line-height: 1.5; }
.auftrag-note__meta { font-size: 11.5px; color: var(--text-subtle); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Team-Chips (Teamleiter-Ansicht) */
.team-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.team-chip {
    display: inline-flex; align-items: center;
    padding: 7px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px; font-weight: 500; color: var(--text);
    cursor: pointer; user-select: none;
    transition: background .12s ease, border-color .12s ease;
}
.team-chip:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-strong); }
.team-chip:focus-visible {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Team-Chip Popover (PLZ/Ort/Mobil) — wird via JS positioniert */
.team-pop {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    z-index: 1000;
    font-size: 13px;
}
.team-pop__name { font-weight: 650; margin-bottom: 4px; color: var(--text); }
.team-pop__row {
    display: flex; align-items: center; gap: 6px;
    margin: 2px 0; color: var(--text-muted);
}
.team-pop__row .ic { width: 12px; height: 12px; color: var(--text-subtle); flex: none; }
.team-pop__row a { color: var(--accent-strong); text-decoration: none; }
.team-pop__row a:hover { text-decoration: underline; }
.team-pop__empty { color: var(--text-subtle); font-style: italic; font-size: 12px; }

/* Welcome: Text + kleiner Badge rechts oben */
.welcome {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.welcome__text    { flex: 1 1 auto; min-width: 0; }
.welcome__eyebrow { margin: 0 0 2px; color: var(--text); font-weight: 600; font-size: 14px; }
.welcome__greeting { margin: 0 0 2px; color: var(--text-muted); font-weight: 500; font-size: 15px; }
.welcome__name    { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -.015em; color: var(--text); font-family: var(--font-headline, inherit); }
.welcome__sub     { margin: 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.5; max-width: 760px; }

/* Neue-Dokumente Badge — editorial, Zahl mit Textmarker-Highlight (Amber) */
.welcome__badge {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 6px 2px 6px 2px;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    transition: color .15s ease;
}
.welcome__badge:hover .welcome__badge-sub { color: #92400e; } /* amber-800 */
.welcome__badge:focus-visible {
    outline: 2px solid #d97706;
    outline-offset: 4px;
    border-radius: 2px;
}
.welcome__badge-num {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #78350f; /* amber-900 fuer besseren Kontrast auf gelbem Grund */
    font-variant-numeric: tabular-nums;
    font-family: var(--font-headline, inherit);
    /* Gelbes Marker-Rechteck hinter der Zahl */
    display: inline-block;
    background: #fef08a; /* amber-200 */
    padding: 6px 10px;
    border-radius: 3px;
    min-width: 36px;
    text-align: center;
}
.welcome__badge-txt {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.25;
}
.welcome__badge-main {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}
.welcome__badge-sub {
    font-size: 12px;
    color: var(--text-muted);
    transition: color .15s ease;
}
@media (max-width: 640px) {
    .welcome { flex-direction: column; align-items: stretch; }
    .welcome__badge { align-self: flex-start; }
}

/* Hero */
.hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px 20px;
    margin-bottom: 20px;
}
.hero__docs { margin: 0 0 16px; color: var(--text-muted); font-size: 14px; }
.hero__docs strong { color: var(--text); font-weight: 700; }

.hero__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: center;
}
.hero__left {
    display: flex;
    gap: 24px;
    align-items: center;
}
.hero__donut { flex: none; }
.hero__stats { flex: 1; min-width: 0; }
@media (max-width: 900px) {
    .hero__body { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 520px) {
    .hero__left { flex-direction: column; align-items: center; }
    .hero__stats { width: 100%; max-width: 420px; }
}

/* Donut */
.hero__donut {
    position: relative;
    width: 160px; height: 160px;
    justify-self: center;
}
.hero__donut svg { width: 100%; height: 100%; display: block; }
.hero__donut-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    pointer-events: none;
}
.hero__donut-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.hero__donut-label { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; letter-spacing: .02em; }

/* KPI-Zeilen */
.hero__stats {
    display: flex; flex-direction: column; gap: 6px;
}
.hero__stat {
    display: grid;
    grid-template-columns: 20px 1fr auto 70px;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
}
.hero__stat:hover { background: var(--surface-2); }
.hero__stat-swatch {
    width: 14px; height: 14px; border-radius: 3px;
    display: inline-block;
}
.hero__stat-swatch--check {
    width: 20px; height: 20px; border-radius: 999px;
    background: #16a34a; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
.hero__stat-swatch--check .ic { width: 12px; height: 12px; }
.hero__stat-label { color: var(--text); }
.hero__stat-num { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hero__stat-pct { font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.hero__stat--success { background: rgba(22,163,74,.08); }
.hero__stat--success .hero__stat-label { font-weight: 600; }
.hero__stat--success .hero__stat-pct { color: #16a34a; font-size: 15px; }
[data-theme="dark"] .hero__stat--success { background: rgba(22,163,74,.14); }

/* CTAs: rechte Spalte im Hero, 2 Buttons untereinander mittig */
.hero__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    align-self: center;
}
.hero__cta {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    justify-content: flex-start;
    text-align: left;
    min-width: 260px;
}
.hero__cta .ic { width: 16px; height: 16px; flex: none; }
.hero__cta-arrow { margin-left: auto; }
.hero__cta[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.hero__cta-main {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0; flex: 1;
    line-height: 1.2;
}
.hero__cta-title {
    font-size: 14px; font-weight: 600;
    letter-spacing: -0.005em;
}
.hero__cta-sub {
    font-size: 11.5px; font-weight: 400;
    opacity: .85;
}
.btn--primary .hero__cta-sub { color: rgba(255,255,255,.9); }
.btn--ghost   .hero__cta-sub { color: var(--text-muted); }
.hero__cta-sub strong { font-weight: 700; }

/* "Neue Dokumente"-CTA mit gelbem Zahl-Marker links statt Icon */
.hero__cta--new { border-color: #f59e0b; }
.hero__cta--new:hover { border-color: #d97706; background: #fffbeb; }
.hero__cta-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px 8px;
    background: #fef08a;        /* amber-200 */
    color: #78350f;             /* amber-900 */
    border-radius: 3px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-headline, inherit);
    flex: none;
}
/* Grosse Variante: dicker Zahl-Marker, prominenter */
.hero__cta-num--large {
    min-width: 44px;
    padding: 10px 10px;
    font-size: 26px;
    border-radius: 4px;
}

/* Ordner-Scope-Form oberhalb der Hero-Buttons */
.hero__folder {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.hero__folder-lbl {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: .02em;
    color: var(--text-muted);
}
.hero__folder-lbl .ic { width: 13px; height: 13px; color: var(--accent-strong); }
.hero__folder .ck-dd { width: 100%; max-width: none; min-width: 0; }
.hero__folder .ck-dd__btn { padding: 10px 12px; font-size: 13.5px; }

/* Pruefdaten-Mini-Cards (unter den Buttons) */
.hero__dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}
.hero__date {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    min-width: 0;
}
.hero__date--past { border-left-color: #3b82f6; }
.hero__date--next { border-left-color: #8b5cf6; }
.hero__date-head {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .02em;
}
.hero__date-head .ic { width: 13px; height: 13px; }
.hero__date--past .ic { color: #3b82f6; }
.hero__date--next .ic { color: #8b5cf6; }
.hero__date-avg {
    font-size: 17px; font-weight: 700; color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    letter-spacing: -0.01em;
}
.hero__date-range {
    display: flex; align-items: center; gap: 6px;
    font-size: 11.5px; color: var(--text-subtle);
    font-variant-numeric: tabular-nums;
    flex-wrap: wrap;
}
.hero__date-sep { color: var(--text-subtle); opacity: .55; }
.hero__dates-empty {
    margin: 10px 0 0;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12.5px;
    text-align: center;
}
@media (max-width: 520px) {
    .hero__dates { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .hero__actions {
        padding-top: 10px; border-top: 1px solid var(--border);
    }
}
@media (max-width: 520px) {
    .hero__actions { align-items: stretch; }
    .hero__cta { width: 100%; min-width: 0; justify-content: flex-start; }
}

/* Hinweis-Text */
.hero__note {
    display: flex; gap: 8px; align-items: flex-start;
    margin: 14px 0 0;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    font-size: 12.5px; color: var(--text-muted);
    line-height: 1.5;
}
.hero__note .ic { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--text-subtle); }
.hero__note > span { flex: 1; min-width: 0; }
.hero__note strong { color: var(--text); font-weight: 600; }

/* Datestrip */
.datestrip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px 20px;
    margin-bottom: 20px;
}
.datestrip__head {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.datestrip__head-text { flex: 1 1 320px; min-width: 0; }
.datestrip__title {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 4px; font-size: 17px; font-weight: 650; color: var(--text);
}
.datestrip__title .ic { width: 18px; height: 18px; color: var(--accent-strong); }
.datestrip__desc { margin: 0; color: var(--text-muted); font-size: 13.5px; }

.datestrip__hint {
    margin: 4px 0 0;
    color: var(--text-subtle);
    font-size: 12.5px;
    font-style: italic;
}

/* Ordner-Dropdown rechts im Header */
.datestrip__folder {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
    position: relative;
}
.datestrip__folder-lbl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.datestrip__folder-lbl .ic {
    width: 14px; height: 14px;
    color: var(--accent-strong);
}

/* ---- Custom Dropdown (ck-dd-*) — ersetzt natives <select>,
       weil Mobile-Browser CSS auf <option> ignorieren.
       .ck-dd--block = volle Breite (fuer Modals/Formulare). ---- */
.ck-dd {
    position: relative;
    display: inline-block;
    min-width: 220px;
    max-width: 320px;
}
.ck-dd--block {
    display: block;
    min-width: 0;
    max-width: 100%;
    width: 100%;
}
.ck-dd__btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    /* Dimensions MATCH .btn so ck-dd + .btn are same height when placed side-by-side.
       Siehe feedback_ckdd_mbdate_pflicht.md: Auswahllisten immer so hoch wie der Button daneben. */
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    text-align: left;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.ck-dd__btn:hover { border-color: var(--accent); }
.ck-dd.is-open .ck-dd__btn,
.ck-dd__btn:focus-visible {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.ck-dd__btn-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}
.ck-dd__btn-chev {
    width: 14px; height: 14px; flex: none;
    color: var(--text-muted);
    transition: transform .15s ease;
}
.ck-dd.is-open .ck-dd__btn-chev { transform: rotate(180deg); color: var(--accent-strong); }

.ck-dd__panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 100%;
    max-width: min(420px, 90vw);
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
    padding: 4px;
    z-index: 50;
}
/* Panel oeffnet nach OBEN (Default): */
.ck-dd--up .ck-dd__panel {
    top: auto;
    bottom: calc(100% + 4px);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .12), 0 -2px 6px rgba(0, 0, 0, .06);
}
.ck-dd--up .ck-dd__btn-chev { transform: rotate(180deg); }
.ck-dd--up.is-open .ck-dd__btn-chev { transform: rotate(0); }
.ck-dd__opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px 7px calc(10px + var(--depth, 0) * 14px);
    font-size: 13px;
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background .1s ease, color .1s ease;
}
.ck-dd__opt:hover,
.ck-dd__opt.is-focused { background: var(--surface-2); }
.ck-dd__opt.is-active {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent-strong);
    font-weight: 600;
}
.ck-dd__opt-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}
.ck-dd__opt-count {
    flex: none;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-subtle);
    font-variant-numeric: tabular-nums;
}
.ck-dd__opt.is-active .ck-dd__opt-count { color: var(--accent-strong); }

.datestrip__empty {
    margin: 6px 0 0;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
}

@media (max-width: 640px) {
    .datestrip__head { align-items: stretch; }
    .datestrip__folder { width: 100%; }
    .ck-dd { width: 100%; max-width: none; }
    .ck-dd__panel { right: auto; left: 0; }
}

.datestrip__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
.datestrip__card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.datestrip__card-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 10px;
}
.datestrip__card-icon {
    width: 28px; height: 28px; border-radius: 6px;
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.datestrip__card--past .datestrip__card-icon { color: #0ea5e9; }
.datestrip__card--next .datestrip__card-icon { color: #d97706; }
.datestrip__card-icon .ic { width: 14px; height: 14px; }
.datestrip__card-title { font-weight: 600; font-size: 14px; color: var(--text); }
.datestrip__card-rows { display: flex; flex-direction: column; gap: 4px; }
.datestrip__card-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px;
}
.datestrip__card-k { color: var(--text-subtle); }
.datestrip__card-v { color: var(--text); font-variant-numeric: tabular-nums; }
.datestrip__card-row--primary {
    padding: 4px 0; margin: 2px 0;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border);
    font-weight: 600;
}
.datestrip__card-row--primary .datestrip__card-k,
.datestrip__card-row--primary .datestrip__card-v { color: var(--text); }

/* Kontakt-Banner */
.contact-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.contact-banner__head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    list-style: none;
    color: var(--text);
    font-size: 14px;
}
.contact-banner__head::-webkit-details-marker { display: none; }
.contact-banner__head:hover { background: var(--surface-2); border-radius: var(--radius); }
.contact-banner__icon {
    width: 28px; height: 28px; border-radius: 999px;
    background: #d97706; color: #fff;
    display: flex; align-items: center; justify-content: center; flex: none;
}
.contact-banner__icon .ic { width: 16px; height: 16px; }
.contact-banner__chev {
    margin-left: auto; width: 16px; height: 16px; color: var(--text-subtle);
    transition: transform .15s;
}
.contact-banner[open] .contact-banner__chev { transform: rotate(180deg); }
.contact-banner__body {
    padding: 4px 20px 16px;
    display: flex; flex-direction: column; gap: 10px;
}
.contact-banner__row {
    display: flex; align-items: center; gap: 10px;
    font-size: 13.5px; color: var(--text-muted);
    padding-left: 40px;
}
.contact-banner__row .ic { width: 14px; height: 14px; color: var(--text-subtle); flex: none; }
.contact-banner__row a { color: var(--accent-strong); font-weight: 500; margin-left: auto; }
.contact-banner__row a:hover { text-decoration: underline; }
.contact-banner__row strong { color: var(--text); }

/* KPI-Leiste oben auf /kundenportal/dateien */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.kpi {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px 12px;
}
.kpi__icon {
    position: absolute; top: 10px; right: 10px;
    width: 28px; height: 28px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    background: var(--surface-2);
}
.kpi__icon .ic { width: 14px; height: 14px; }
.kpi__icon--ok   { color: #16a34a; background: rgba(22,163,74,.1); }
.kpi__icon--mild { color: #d97706; background: rgba(217,119,6,.1); }
.kpi__icon--bad  { color: #dc2626; background: rgba(220,38,38,.1); }
.kpi__icon--past { color: #0ea5e9; background: rgba(14,165,233,.1); }
.kpi__icon--next { color: #a855f7; background: rgba(168,85,247,.1); }
.kpi__label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; padding-right: 32px; font-weight: 500; }
.kpi__value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi__sub   { font-size: 11.5px; color: var(--text-subtle); margin-top: 4px; }
.kpi--ok   { background: linear-gradient(180deg, rgba(22,163,74,.05), var(--surface)); }
.kpi--mild { background: linear-gradient(180deg, rgba(217,119,6,.05), var(--surface)); }
.kpi--bad  { background: linear-gradient(180deg, rgba(220,38,38,.05), var(--surface)); }

/* Rotations-Dots fuer Datums-Karten */
.kpi__dots {
    display: flex; gap: 4px; margin-top: 6px;
}
.kpi__dots span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--border);
    transition: background .18s;
}
.kpi__dots span.is-active { background: var(--accent-strong); }
[data-rotate-card] { cursor: pointer; user-select: none; }

/* Globale Regel: interaktive Elemente zeigen immer Pointer-Cursor + verhindern Text-Selektion
   (so taucht der Text-Cursor nirgends in Sidebar/Nav/Buttons auf — nur in Tabelleninhalten) */
.btn, .filter-btn, .nav__link, .nav__label,
.folder-node__row, .folder-node__link, .folder-node__chev,
.user-menu__item, .user--compact, .sidebar__phone,
.sidebar__collapse, .sidebar__legal a,
.file-row__action, .file-row__check,
.pager__btn, .topbar__menu, .topbar__brand,
summary, button {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.btn *, .filter-btn *, .nav__link *, .nav__label *,
.folder-node__row *, .folder-node__link *,
.user-menu__item *, .user--compact *, .sidebar__phone *,
.sidebar__collapse *, .sidebar__legal a *,
.file-row__action *, .file-row__check *,
.pager__btn *, .topbar__menu *, .topbar__brand *,
summary *, button * {
    cursor: inherit;
    user-select: inherit;
    -webkit-user-select: inherit;
}
[data-rotate-card]:hover { background: var(--surface-2); }
[data-rotate-card].is-paused { outline: 1px dashed var(--border); }

/* Crossfade-Container: zwei Layer koennen sich zeitgleich ueberlagern */
.kpi__slide {
    position: relative;
    display: block;
    min-height: 1em;
}
.kpi__slide .layer {
    display: block;
    opacity: 0;
    transition: opacity .9s ease;
    position: absolute; inset: 0;
    white-space: nowrap;
}
.kpi__slide .layer.is-active {
    opacity: 1;
    position: relative;         /* der aktive Layer bestimmt die Container-Hoehe */
}

/* Filter-Buttons unter Toolbar */
.files__filters {
    display: flex; gap: 6px; flex-wrap: wrap;
    width: 100%;
    margin-top: 6px;
}
.filter-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12.5px; font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
}
.filter-btn:hover { background: var(--surface-2); color: var(--text); }
.filter-btn.is-active { background: var(--accent-tint); color: var(--accent-strong); border-color: transparent; font-weight: 600; }
.filter-btn .ic { width: 12px; height: 12px; flex: none; }
.filter-btn--ok.is-active   { background: rgba(22,163,74,.1);  color: #16a34a; }
.filter-btn--mild.is-active { background: rgba(217,119,6,.1);  color: #d97706; }
.filter-btn--bad.is-active  { background: rgba(220,38,38,.1);  color: #dc2626; }
.filter-btn--new.is-active  { background: rgba(245,158,11,.12); color: #d97706; }
.filter-btn--zip {
    background: var(--accent); color: #fff; border-color: var(--accent);
    cursor: pointer;
}
.filter-btn--zip:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.files__zip-form { display: inline-flex; margin-left: auto; }

/* ========================================================================
   Dateien-Browser (Kundenportal M2/M3)
   ======================================================================== */
.files {
    display: block;
}

/* Ordnerbaum lebt jetzt in der Sidebar (siehe layouts/app.blade.php) */
.folder-tree, .folder-node__children {
    list-style: none;
    margin: 0;
    padding: 0;
}
.folder-node__children { padding-left: 14px; }
.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-muted);
    font-size: 14px;
    font-weight: 500;
    min-width: 0;
}
.folder-node__name {
    flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.folder-node__count {
    font-size: 12px; 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: stretch;
}
.files__search-input {
    position: relative;
    display: flex;
    width: 320px;
    max-width: 100%;
}
.files__search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px;
    fill: none; stroke: var(--text-subtle); stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
    pointer-events: none;
}
.files__search-input .input {
    width: 100%;
    padding-left: 32px;
}
.files__search-btn {
    padding: 8px 14px;          /* gleiche Höhe wie .input (7px + 1px Border = ~8px fuer visuelle Parität) */
    line-height: 1.4;
    font-size: 13px;
    align-self: stretch;
}
/* Chromes native Search-Clear-Icon abschalten, damit nur unser X-Button bleibt */
.files__search input[type="search"]::-webkit-search-cancel-button { display: none; }

.files__list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
/* .files__list als echte <table>: Default-Table-Rendering ausschalten,
   damit das Grid-Layout auf .file-row (= <tr>) weiter wirkt. */
table.files__list { width: 100%; border-collapse: separate; border-spacing: 0; }
table.files__list, table.files__list thead, table.files__list tbody { display: block; }
table.files__list th, table.files__list td {
    padding: 0; border: 0; vertical-align: middle;
    text-align: left; font-weight: inherit; font-size: inherit; color: inherit;
}

/* Toggle-Switch (iOS-Style). Portal-weite Konvention — Markup:
     <label class="toggle">
         <input type="checkbox">
         <span class="toggle__switch"></span>
         <span class="toggle__label">Beschriftung</span>
     </label>
   Bereichs-Varianten (.abm-toggle, .auo-toggle, .kdn-toggle, .pr-toggle, .rkd-toggle)
   leben noch in ihren eigenen CSS-Dateien — die werden nachgezogen. */
.toggle {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 0 14px 0 10px; height: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px; font-weight: 500; color: var(--text-muted);
    cursor: pointer; user-select: none;
    transition: border-color 0.18s, color 0.18s, background 0.18s, box-shadow 0.18s;
}
.toggle:hover { border-color: var(--gray-400); background: var(--surface-2); color: var(--text); }
.toggle:focus-within { box-shadow: 0 0 0 3px rgba(22,104,227,0.18); border-color: var(--primary-500); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.toggle__switch {
    position: relative; width: 36px; height: 20px;
    background: var(--gray-300);
    border-radius: 999px;
    transition: background 0.22s cubic-bezier(.4,0,.2,1);
    flex-shrink: 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}
.toggle__switch::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
    background: #fff; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.04);
    transition: transform 0.22s cubic-bezier(.4,0,.2,1), box-shadow 0.18s;
}
.toggle:hover .toggle__switch::after { box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.06); }
.toggle:has(input:checked) {
    background: rgba(22,104,227,0.08);
    color: var(--primary-500);
    border-color: var(--primary-500);
    font-weight: 600;
}
.toggle:has(input:checked) .toggle__switch {
    background: var(--primary-500);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.14);
}
.toggle:has(input:checked) .toggle__switch::after { transform: translateX(16px); }
[data-theme="dark"] .toggle:has(input:checked) { background: rgba(22,104,227,0.18); }

/* Negative Geldbetraege: wie im Original rot (konsequente Konvention portal-weit). */
.amount { font-variant-numeric: tabular-nums; }
.amount--neg { color: #dc2626; }

/* Generische Spalten-Sortierung (siehe public/js/sortable.js). */
.sortable-th { cursor: pointer; user-select: none; position: relative; }
.sortable-th:hover { color: var(--text); background: var(--surface-2); }
.sortable-th.is-sorted-asc, .sortable-th.is-sorted-desc { color: var(--text); background: var(--surface-2); }
.sort-ind {
    display: inline-block; margin-left: 6px;
    font-size: 9px; font-weight: 700;
    color: var(--accent-strong, var(--primary-500, #075985));
    min-width: 10px;
}
.file-row {
    display: grid;
    grid-template-columns: 32px minmax(220px, 1.6fr) 100px minmax(180px, 2fr) 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;
}

/* Datei-Zelle: Status-Dot + Icon + Name (+ optional Stern) */
.file-row__name-cell {
    display: flex; align-items: center; gap: 8px;
    min-width: 0;
}
.file-row__name-cell .ic { width: 18px; height: 18px; flex: none; }
.file-row__status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex: none;
    display: inline-block;
}
.file-row__status-dot--ok      { background: #16a34a; }
.file-row__status-dot--mild    { background: #d97706; }
.file-row__status-dot--bad     { background: #dc2626; }
.file-row__status-dot--unknown { background: #94a3b8; }
.file-row__status-dot--none    { background: transparent; }

.file-row__name {
    display: inline-flex; align-items: center; gap: 6px;
    min-width: 0; flex: 1;
    font-size: 13.5px; font-weight: 500; color: var(--text);
    text-decoration: none;
}
.file-row__name-text {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}
.file-row__name:hover .file-row__name-text { color: var(--accent-strong); text-decoration: underline; }

.file-row__new-star {
    display: inline-flex; width: 14px; height: 14px;
    color: #f59e0b; flex: none;
}
.file-row__new-star svg { width: 100%; height: 100%; }

.file-row__date {
    font-size: 12.5px; color: var(--text-muted); white-space: nowrap;
}
.file-row__folder {
    font-size: 12.5px; color: var(--text-subtle);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}
.file-row__name-head { font-weight: 600; }
.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; }
.files__perpage { margin-top: 10px; text-align: right; font-size: 12.5px; color: var(--text-muted); }
.files__perpage label { display: inline-flex; align-items: center; gap: 8px; }
.files__perpage select {
    padding: 4px 32px 4px 10px;
    font-size: 12.5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}
/* Dropdown oeffnet sich nach oben — der Selector sitzt am unteren Seitenrand. */
.files__perpage .cs__menu { top: auto; bottom: calc(100% + 4px); }
.pager {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap;
    font-size: 12.5px;
    /* Fuer #pagination-Anker: Topbar nicht ueber den Pager scrollen lassen */
    scroll-margin-top: 80px;
}
.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: 640px) {
    .files__search { margin-left: 0; width: 100%; }
    .files__search .input { flex: 1; width: auto; }
    .file-row {
        grid-template-columns: 28px 1fr 32px;
        grid-template-areas:
            "check name   action"
            ".     date   action"
            ".     folder action";
        row-gap: 2px;
        column-gap: 10px;
    }
    .file-row--head { display: none; }
    .file-row__check     { grid-area: check; align-self: start; margin-top: 4px; }
    .file-row__name-cell { grid-area: name; }
    .file-row__date      { grid-area: date; font-size: 12px; color: var(--text-subtle); }
    .file-row__folder    { grid-area: folder; font-size: 12px; color: var(--text-subtle); }
    .file-row__actions   { grid-area: action; align-self: center; }
}

/* ---------- 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__phone {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    margin: 0 6px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px; font-weight: 500;
    text-decoration: none;
    background: var(--surface-2);
    transition: background .12s, color .12s;
}
.sidebar__phone:hover { background: var(--accent-tint); color: var(--accent-strong); }
.sidebar__phone .ic { width: 14px; height: 14px; flex: none; }
@media (min-width: 721px) {
    body.nav-collapsed .sidebar__phone {
        padding: 10px 0;
        justify-content: center;
        margin: 0 6px 4px;
    }
    body.nav-collapsed .sidebar__phone > span { display: none; }
}

.sidebar__legal {
    margin-top: 6px;
    padding: 6px 12px;
    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; }
/* Im eingeklappten Zustand: Copyright + Legal-Links komplett weg + untere Trennlinie weg */
@media (min-width: 721px) {
    body.nav-collapsed .sidebar__copy,
    body.nav-collapsed .sidebar__legal { display: none; }
    body.nav-collapsed .sidebar__foot { border-top: 0; padding: 6px; }
}

/* ---------- 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));
}
/* (Alte Admin-Dashboard-KPIs entfernt - nicht mehr genutzt, kollidierte mit Portal-KPI) */

/* 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); }



/* --------------- Upload-Modal (Pr�fdaten) --------------- */
.upload-flash {
    position: fixed; bottom: 20px; right: 20px; z-index: 9999;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; max-width: 400px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-left: 3px solid #16a34a;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    font-size: 13px;
    transition: opacity .4s ease, transform .4s ease;
}
.upload-flash .ic { width: 16px; height: 16px; color: #16a34a; flex-shrink: 0; }
.upload-flash.is-hiding { opacity: 0; transform: translateY(10px); }

.upload-filelist { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.upload-filelist__item {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius-sm);
    font-size: 12.5px; color: var(--text);
}
.upload-filelist__name { font-weight: 500; word-break: break-all; }
.upload-filelist__size { color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.upload-hint { margin: 6px 0 0; font-size: 11.5px; color: var(--text-subtle); }

.upload-history { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.upload-history__title {
    margin: 0 0 12px; font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: none; letter-spacing: .01em;
}
.upload-history__day {
    margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); overflow: hidden;
}
.upload-history__day:last-child { margin-bottom: 0; }
.upload-history__date {
    display: block;
    padding: 8px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 600; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.upload-history__files { display: flex; flex-direction: column; }
.upload-history__item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--border);
}
.upload-history__item:last-child { border-bottom: 0; }
.upload-history__item:hover { background: var(--surface-2); }
.upload-history__filename { flex: 1; word-break: break-all; color: var(--text); }
.upload-history__time {
    color: var(--text-subtle); font-variant-numeric: tabular-nums;
    font-size: 11.5px; flex-shrink: 0;
}
.upload-history__del {
    padding: 4px 6px; background: transparent; border: 0; cursor: pointer;
    color: var(--text-subtle); border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.upload-history__del:hover { background: rgba(239,68,68,.1); color: #dc2626; }
.upload-history__del .ic { width: 14px; height: 14px; }

/* ─────────────── Dokumentenscan ─────────────── */
.scan-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.scan-actions .btn { flex: 1; min-width: 160px; }
.scan-pages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.scan-pages:empty { display: none; }
.scan-page {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
}
.scan-page img { width: 100%; height: 100%; object-fit: contain; display: block; }
.scan-page__num {
    position: absolute; top: 4px; left: 4px;
    padding: 2px 7px; font-size: 11px; font-weight: 600;
    background: rgba(0,0,0,.6); color: #fff;
    border-radius: 999px;
}
.scan-page__del {
    position: absolute; top: 4px; right: 4px;
    width: 24px; height: 24px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.6); color: #fff;
    border: 0; border-radius: 999px; cursor: pointer;
}
.scan-page__del:hover { background: #dc2626; }
.scan-page__del svg { width: 14px; height: 14px; }

/* ─────────────── Einsatzbericht ─────────────── */
.einsatz-page { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.einsatz-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; margin-bottom: 20px; min-height: 44px; flex-wrap: wrap;
}
.einsatz-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.einsatz-head__title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
.einsatz-head__actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.einsatz-head__actions .btn { white-space: nowrap; }
.einsatz-head__sub { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.einsatz-head__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.einsatz-flash {
    padding: 10px 14px; margin-bottom: 16px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    font-size: 13px;
}
.einsatz-flash--success { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.einsatz-flash--error   { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }

.einsatz-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 6px; padding: 32px 20px;
}
.einsatz-empty__icon { width: 40px; height: 40px; color: var(--text-subtle); margin-bottom: 2px; }
.einsatz-empty__title { margin: 0; font-size: 14.5px; color: var(--text); }
.einsatz-empty__sub   { margin: 0; color: var(--text-muted); font-size: 13.5px; }

.einsatz-list { display: flex; flex-direction: column; gap: 10px; }
.einsatz-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
}
.einsatz-card__head {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.einsatz-card__date { font-size: 13.5px; display: inline-flex; align-items: baseline; gap: 6px; }
.einsatz-card__wd {
    display: inline-block; padding: 1px 6px; background: var(--accent-tint);
    color: var(--accent-strong); border-radius: 4px;
    font-size: 11px; font-weight: 700;
}
.einsatz-card__dateval { font-weight: 600; font-variant-numeric: tabular-nums; }
.einsatz-card__time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.einsatz-card__meta { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.einsatz-card__badge {
    display: inline-block; padding: 2px 8px;
    background: var(--surface-2); border-radius: 999px;
    font-size: 11.5px; font-weight: 600; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.einsatz-card__standort { color: var(--text-muted); }
.einsatz-card__text {
    margin: 0 0 10px; color: var(--text); font-size: 13.5px;
    line-height: 1.55; white-space: pre-wrap;
}
.einsatz-card__foot {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 12.5px;
}
.einsatz-card__stunden { color: var(--text); }
.einsatz-card__stunden strong { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.einsatz-card__kst { color: var(--text-muted); }
.einsatz-card__status {
    padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.einsatz-card__status--geprueft     { background: #dbeafe; color: #1e40af; }
.einsatz-card__status--abgeschlossen{ background: #dcfce7; color: #15803d; }
.einsatz-card__actions { margin-left: auto; display: inline-flex; gap: 6px; }
.einsatz-card__delform { display: inline; margin: 0; }
.btn--sm { padding: 4px 10px !important; font-size: 12px !important; }
.btn--sm .ic { width: 13px; height: 13px; }
.einsatz-card__delbtn:hover { color: #dc2626; }

/* ─────────────── OF-Aufmaß ─────────────── */
.aufmass-list { display: flex; flex-direction: column; gap: 12px; }
.aufmass-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
}
.aufmass-card__head {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.aufmass-card__date { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13.5px; }
.aufmass-card__meta { display: inline-flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; align-items: baseline; }
.aufmass-card__status {
    padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
}
.aufmass-card__status--freigegeben { background: #dcfce7; color: #15803d; }
.aufmass-card__body {
    display: flex; flex-wrap: wrap; gap: 10px 16px;
    margin-bottom: 10px; font-size: 12.5px; color: var(--text-muted);
}
.aufmass-card__body strong { color: var(--text); font-weight: 600; margin-right: 4px; }
.aufmass-card__bem {
    width: 100%; padding: 6px 10px; background: var(--surface-2);
    border-radius: 3px;
    color: var(--text); white-space: pre-wrap;
}
.aufmass-card__foot {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: 12.5px;
}
.aufmass-card__positionen { color: var(--text); font-variant-numeric: tabular-nums; }
.aufmass-card__tech { color: var(--text-subtle); }
.aufmass-card__actions { margin-left: auto; display: inline-flex; gap: 6px; }

/* Edit-Seite */
.aufmass-edit-page { max-width: 1400px; }
.aufmass-section__title {
    margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--text);
    display: inline-flex; align-items: center; gap: 6px;
}
.aufmass-section__title .ic { width: 16px; height: 16px; color: var(--accent); }
.aufmass-meta { margin-bottom: 12px; }
.aufmass-meta__grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}
.aufmass-meta__bem { margin-top: 10px; }
.aufmass-meta__grid input,
.aufmass-meta__bem textarea {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 14px; color: var(--text); background: var(--surface);
    font-family: inherit; width: 100%;
}
.aufmass-meta__bem textarea { resize: vertical; min-height: 60px; }

.aufmass-standort { margin-bottom: 12px; }
.aufmass-standort__addr { margin-left: 6px; color: var(--text-subtle); font-weight: 400; font-size: 12.5px; }
.aufmass-grid {
    display: grid;
    grid-template-columns: 90px 1fr 90px 90px 110px;
    gap: 0;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 12.5px;
}
.aufmass-grid__einheit { color: var(--text-subtle); font-size: 11.5px; margin-left: 4px; }
.aufmass-grid__thead {
    display: contents;
}
.aufmass-grid__thead .aufmass-grid__cell {
    background: var(--surface-2); font-weight: 600; color: var(--text-muted);
    padding: 6px 8px; font-size: 11px; letter-spacing: .02em;
}
.aufmass-grid__row { display: contents; }
.aufmass-grid__row .aufmass-grid__cell { padding: 7px 8px; border-top: 1px solid var(--border); display: flex; align-items: center; }
.aufmass-grid__row:hover .aufmass-grid__cell { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.aufmass-grid__cell--artnr { font-weight: 600; font-variant-numeric: tabular-nums; }
.aufmass-grid__cell--artbez { color: var(--text); }
.aufmass-grid__cell--einheit { color: var(--text-muted); font-size: 11.5px; }
.aufmass-grid__cell--soll,
.aufmass-grid__cell--gemeldet { justify-content: flex-start; }
.aufmass-grid__num { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.aufmass-grid__cell--menge { padding: 4px 6px !important; }
.aufmass-grid__input {
    width: 100%; padding: 5px 8px;
    border: 1px solid var(--border); border-radius: 4px;
    text-align: left; font-variant-numeric: tabular-nums;
    font-size: 13px; background: var(--surface); color: var(--text);
}
.aufmass-grid__input:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.aufmass-grid__input.is-filled { background: #fef3c7; border-color: #d97706; font-weight: 600; }

@media (max-width: 900px) {
    .aufmass-grid { grid-template-columns: 1fr; }
    .aufmass-grid__thead { display: none; }
    .aufmass-grid__row { display: block; border-top: 1px solid var(--border); padding: 8px; }
    .aufmass-grid__cell { padding: 2px 0 !important; border: 0 !important; }
    .aufmass-grid__cell--menge { padding-top: 6px !important; }
    .aufmass-grid__cell--einheit { display: inline; }
    .aufmass-grid__cell--soll::before { content: 'Soll: '; color: var(--text-muted); }
    .aufmass-grid__cell--gemeldet::before { content: 'Bisher: '; color: var(--text-muted); }
}

.aufmass-footer {
    position: sticky; bottom: 0; z-index: 10;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 14px;
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-top: 16px; flex-wrap: wrap;
    box-shadow: 0 -4px 12px rgba(0,0,0,.04);
}
.aufmass-footer__summary {
    display: inline-flex; gap: 16px; font-size: 13px; color: var(--text-muted);
}
.aufmass-footer__summary strong {
    color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums;
}
.aufmass-footer__actions { display: inline-flex; gap: 8px; margin-left: auto; }
.aufmass-footer__actions .btn .ic { width: 14px; height: 14px; }

/* ─────────────── Dashboard-Schnellzugriff (3 Slots, user-konfigurierbar) ─────────────── */
.shortcuts-section { margin: 20px 0; }
.shortcuts-section__title {
    margin: 0 0 10px; font-size: 13px; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
}
.shortcuts {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin: 0;
}
@media (max-width: 720px) { .shortcuts { grid-template-columns: 1fr; } }
.shortcut {
    position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: border-color .12s, transform .12s;
}
.shortcut:hover { border-color: var(--accent); }
.shortcut__link {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px; text-decoration: none; color: var(--text);
}
.shortcut__icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; }
.shortcut__icon .ic { width: 22px; height: 22px; }
.shortcut__label { font-size: 15px; font-weight: 600; }
.shortcut__edit {
    position: absolute; top: 6px; right: 6px;
    width: 24px; height: 24px; padding: 0;
    background: transparent; border: 0; border-radius: 999px;
    color: var(--text-subtle); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .12s, background .12s;
}
.shortcut:hover .shortcut__edit { opacity: 1; }
.shortcut__edit:hover { background: var(--surface-2); color: var(--text); }
.shortcut__edit .ic { width: 13px; height: 13px; }
.shortcut--empty {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 16px 18px; min-height: 68px;
    background: transparent; border: 1px dashed var(--border);
    color: var(--text-muted); font-size: 14px; cursor: pointer;
    font-family: inherit;
}
.shortcut--empty:hover { border-color: var(--accent); color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 4%, transparent); }
.shortcut--empty .ic { width: 18px; height: 18px; }

.shortcut-picker {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px;
}
.shortcut-picker__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 16px 10px; text-align: center;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; font-family: inherit; color: var(--text); font-size: 13px;
    transition: background .12s, border-color .12s;
}
.shortcut-picker__item:hover { background: var(--surface); border-color: var(--accent); color: var(--accent-strong); }
.shortcut-picker__icon .ic { width: 24px; height: 24px; color: var(--accent); }
.shortcut-picker__label { font-weight: 600; }

/* Geburtstagswidget (im Welcome rechts, kollabiert) */
.welcome { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
/* Geburtstags-Welcome fuer den User selbst */
.welcome.is-birthday {
    background: linear-gradient(135deg, #fff7ed 0%, #fce7f3 100%);
    border: 1px solid #fdba74;
    border-radius: var(--radius);
    padding: 18px 22px;
}
[data-theme="dark"] .welcome.is-birthday {
    background: linear-gradient(135deg, rgba(234,88,12,.1) 0%, rgba(219,39,119,.1) 100%);
    border-color: rgba(234,88,12,.4);
}
.welcome__greeting--birthday {
    color: #c2410c !important; font-weight: 700 !important; font-size: 17px !important;
    letter-spacing: -.01em;
    animation: birthdayGreeting 2.5s ease-in-out infinite;
}
@keyframes birthdayGreeting {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px) rotate(-.5deg); }
    75% { transform: translateX(2px) rotate(.5deg); }
}
.welcome.is-birthday .welcome__name { color: #9a3412; }
.bday-widget { position: relative; }
.bday-widget__btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 4px;
    width: 44px; height: 44px; padding: 0;
    border: 1px solid var(--border); background: var(--surface);
    border-radius: 999px; cursor: pointer;
    color: var(--text-subtle); transition: all .15s;
    position: relative;
}
.bday-widget__btn:hover { border-color: var(--accent); color: var(--accent); }
.bday-widget__btn .ic { width: 20px; height: 20px; }
.bday-widget__count {
    position: absolute; top: -6px; right: -6px;
    min-width: 20px; height: 20px; padding: 0 6px;
    background: var(--text-subtle); color: #fff;
    font-size: 11px; font-weight: 700;
    border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
    font-variant-numeric: tabular-nums;
}
.bday-widget.is-soon .bday-widget__btn { color: #d97706; border-color: #fbbf24; }
.bday-widget.is-soon .bday-widget__count { background: #d97706; }
.bday-widget.is-today .bday-widget__btn {
    color: #dc2626; border-color: #ef4444; background: #fef2f2;
    animation: bdayPulse 1.8s ease-in-out infinite;
}
.bday-widget.is-today .bday-widget__count { background: #dc2626; }
@keyframes bdayPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.bday-widget__panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 260px; max-width: 320px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
    padding: 12px 14px;
    z-index: 50;
}
.bday-widget__panel[hidden] { display: none; }
.bday-widget__title {
    margin: 0 0 8px; font-size: 11.5px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .05em;
}
.bday-widget__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bday-widget__item {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 4px 0; font-size: 12.5px;
}
.bday-widget__item.is-today { color: #dc2626; font-weight: 600; }
.bday-widget__name { color: var(--text); }
.bday-widget__when { color: var(--text-muted); font-size: 12px; }
.bday-widget__item.is-today .bday-widget__when { color: #d97706; }

/* ─────────────── Hotelbuchung ─────────────── */
.photon-field { position: relative; }
.photon-suggest {
    position: absolute; left: 0; right: 0; top: calc(100% + 2px);
    z-index: 50;
    max-height: 300px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
    padding: 4px;
}
.photon-suggest[hidden] { display: none; }
.photon-item {
    display: flex; flex-direction: column; gap: 2px;
    width: 100%; padding: 8px 10px; text-align: left;
    background: transparent; border: 0; border-radius: 4px;
    cursor: pointer; font: inherit; color: var(--text);
}
.photon-item:hover,
.photon-item.is-focused { background: var(--surface-2); }
.photon-item__name { font-size: 13px; font-weight: 600; color: var(--text); }
.photon-item__addr { font-size: 12px; color: var(--text-muted); }


.hotel-divider { text-align: center; margin: 14px 0; position: relative; }
.hotel-divider::before, .hotel-divider::after {
    content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border);
}
.hotel-divider::before { left: 0; }
.hotel-divider::after  { right: 0; }
.hotel-divider span { background: var(--bg); padding: 0 12px; color: var(--text-muted); font-size: 12.5px; }
.hotel-footer { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ─────────────── Vergleichsmessung (Dropzone + Liste) ─────────────── */
.vms-upload-form { display: flex; flex-direction: column; gap: 10px; }
.vms-dropzone {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 24px 20px;
    border: 2px dashed var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text-muted);
    cursor: pointer; transition: border-color .12s, background .12s;
    text-align: center;
}
.vms-dropzone:hover,
.vms-dropzone.is-drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface-2)); }
.vms-dropzone .ic { width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }
.vms-dropzone__hint { font-size: 14px; color: var(--text); font-weight: 500; }
.vms-dropzone__sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.vms-selected-files { display: flex; flex-direction: column; gap: 4px; }
.vms-selected-file {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius-sm);
    font-size: 12.5px;
}
.vms-selected-file__name { flex: 1; word-break: break-all; }
.vms-selected-file__size { color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.vms-selected-file__del {
    width: 22px; height: 22px; padding: 0;
    background: transparent; border: 0; color: var(--text-subtle);
    border-radius: 999px; cursor: pointer; font-size: 16px; line-height: 1;
}
.vms-selected-file__del:hover { background: rgba(239,68,68,.1); color: #dc2626; }

.vms-upload-row {
    display: flex; gap: 8px; align-items: center;
}
.vms-upload-row input[type="text"] {
    flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 13.5px; background: var(--surface); color: var(--text);
    font-family: inherit;
}
.vms-list { display: flex; flex-direction: column; gap: 8px; }

/* ─────────────── Bestellkatalog-Shop ─────────────── */
.bk-freitext-input {
    width: 100%; min-height: 60px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 14px; color: var(--text); background: var(--surface);
    font-family: inherit; resize: vertical;
}
.bk-freitext-foto {
    margin-top: 10px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.bk-freitext-foto__hint { font-size: 11.5px; color: var(--text-subtle); }
.bk-freitext-foto__preview {
    position: relative;
    width: 100px; height: 100px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    overflow: hidden; background: var(--surface-2);
}
.bk-freitext-foto__preview[hidden] { display: none; }
.bk-freitext-foto__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-freitext-foto__remove {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; padding: 0;
    background: rgba(220,38,38,.9); color: #fff;
    border: 0; border-radius: 999px; cursor: pointer;
    font-size: 14px; line-height: 1; font-weight: 700;
}
.bk-freitext-foto__remove:hover { background: #dc2626; }
.bk-divider { text-align: center; margin: 18px 0; position: relative; }
.bk-divider::before, .bk-divider::after {
    content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border);
}
.bk-divider::before { left: 0; }
.bk-divider::after { right: 0; }
.bk-divider span { background: var(--bg); padding: 0 12px; color: var(--text-muted); font-size: 12.5px; }
.bk-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bk-search {
    position: relative; flex: 1 1 240px; min-width: 220px;
    display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface);
}
.bk-search .ic { width: 16px; height: 16px; margin: 0 8px; color: var(--text-muted); flex-shrink: 0; }
.bk-search input {
    flex: 1; border: 0; outline: none; padding: 9px 10px 9px 0; background: transparent;
    font: inherit; color: var(--text);
}
.bk-filter { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bk-filter .btn.is-active { background: var(--accent-strong); color: #fff; border-color: var(--accent-strong); }

.bk-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.bk-item {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
    transition: border-color .12s, box-shadow .12s;
}
.bk-item { cursor: pointer; }
.bk-item:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.06); transform: translateY(-1px); }
.bk-item:active { transform: translateY(0); }
.bk-item__actions { cursor: default; }
.bk-item__minus, .bk-item__plus, .bk-item__menge { cursor: pointer; }
.bk-item__menge { cursor: text; }
.bk-item[hidden] { display: none !important; }
.bk-item.is-in-cart {
    border-color: var(--accent-strong);
    background: color-mix(in srgb, var(--accent) 6%, var(--surface));
    box-shadow: 0 0 0 1px var(--accent-strong), 0 2px 8px rgba(226,137,19,.15);
}
.bk-item.is-in-cart .bk-item__name { color: var(--accent-strong); }
.bk-item.is-in-cart .bk-item__menge { background: #fff; border-color: var(--accent-strong); font-weight: 700; }
.bk-item__img {
    aspect-ratio: 16/10; background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; border-bottom: 1px solid var(--border);
}
.bk-item__img img { width: 100%; height: 100%; object-fit: contain; }
.bk-item__img .ic { width: 48px; height: 48px; color: var(--text-subtle); }
.bk-item__body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.bk-item__name { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.bk-item__desc { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.bk-item__foot { font-size: 11.5px; color: var(--text-subtle); margin-top: auto; }
.bk-item__kat { text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.bk-item__actions {
    display: flex; align-items: center; gap: 4px;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
}
.bk-item__minus, .bk-item__plus {
    width: 28px; height: 28px; padding: 0;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 16px; font-weight: 700; color: var(--text);
    font-family: inherit;
}
.bk-item__minus:hover, .bk-item__plus:hover { border-color: var(--accent); color: var(--accent-strong); }
.bk-item__menge {
    flex: 1; min-width: 0; text-align: center;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 4px 6px; font-size: 14px; color: var(--text); background: var(--surface);
    font-variant-numeric: tabular-nums;
    appearance: textfield; -moz-appearance: textfield;
}
.bk-item__menge::-webkit-outer-spin-button,
.bk-item__menge::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.bk-cart-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 100; display: flex; justify-content: space-between; align-items: center;
    gap: 12px; padding: 12px 20px;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.bk-cart-bar[hidden] { display: none !important; }
.bk-cart-bar__info { font-size: 13.5px; }
.bk-cart-bar__info strong { font-size: 18px; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.bk-cart-bar__actions { display: inline-flex; gap: 8px; }

.bk-summary { display: flex; flex-direction: column; gap: 4px; }
.bk-summary__item {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm);
    font-size: 13px;
}
.bk-summary__item strong { color: var(--accent-strong); font-variant-numeric: tabular-nums; }

/* ─────────────── Etiketten & Material (Status) ─────────────── */
.em-list { display: flex; flex-direction: column; gap: 10px; }
.em-card {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 14px;
}
.em-card.is-hidden { display: none; }
.em-card__head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 12.5px; margin-bottom: 8px;
}
.em-card__tech { font-weight: 600; color: var(--text); }
.em-card__date { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.em-tag { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.em-tag--intern { background: #e0e7ff; color: #4338ca; }
.em-tag--abholung { background: #fef3c7; color: #92400e; }
.em-tag--dringend { background: #fee2e2; color: #991b1b; }
.em-card__items { display: flex; flex-direction: column; gap: 4px; }
.em-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; background: var(--surface); border-radius: var(--radius-sm);
    font-size: 13px;
}
.em-item__icon { font-size: 15px; flex-shrink: 0; }
.em-card__foot {
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
    font-size: 12.5px; color: var(--text-muted);
}
.em-card__foot code {
    background: var(--surface); padding: 1px 6px; border-radius: 3px;
    font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
}

/* ─────────────── Rücksendungen ─────────────── */
.rs-filter {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    overflow: visible;
}
.rs-filter .mb-date { position: relative; }
.rs-filter .mb-date .dp {
    /* Datepicker-Popup darf aus der Filter-Section rausragen */
    z-index: 100;
}
.rs-filter .auftrag-modal__field { margin: 0; min-width: 160px; }
.rs-filter input[type="date"],
.rs-filter input[type="text"] {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 14px; color: var(--text); background: var(--surface);
    font-family: inherit; width: 100%;
}
.rs-filter__actions { display: inline-flex; gap: 6px; }
.rs-list { display: flex; flex-direction: column; gap: 8px; }
.rs-success {
    text-align: center; padding: 24px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.rs-success .ic { width: 40px; height: 40px; }
.rs-success p { margin: 0; font-size: 14px; color: var(--text); }
.rs-success p.rs-timer { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }
.rs-success .btn { margin-top: 4px; }
.rs-dhl-btn { background: #FFCC00 !important; color: #D40511 !important; border-color: #FFCC00 !important; font-weight: 700; }
.rs-dhl-btn:hover { background: #e6b800 !important; border-color: #e6b800 !important; }
.rs-dhl-logo { width: 36px; height: 12px; display: inline-block; vertical-align: middle; border-radius: 2px; margin-right: 6px; }

/* ─────────────── Dokumentenkorb ─────────────── */
/* Section-Varianten (shared mit anderen Service-Seiten) */
.ms-section--padded { padding: 16px 18px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: visible; }
.ms-section__title {
    margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--text);
    display: inline-flex; align-items: center; gap: 8px;
}
.ms-section__title .ic { width: 16px; height: 16px; }
.ms-section__count {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700; margin-left: 2px;
    font-variant-numeric: tabular-nums;
}
.ms-section__count--pending { background: #fef3c7; color: #92400e; }
.ms-section__count--signed  { background: #dcfce7; color: #065f46; }

.dk-list { display: flex; flex-direction: column; gap: 8px; }
.dk-card {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 14px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.dk-card__info { flex: 1 1 60%; min-width: 0; }
.dk-card__title { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.dk-card__meta {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 12px; color: var(--text-muted);
}
.dk-card__actions { display: inline-flex; gap: 6px; flex-shrink: 0; }

/* Signatur-Modal */
.dk-sig-wrap {
    position: relative;
    background: #fafafa; border: 1px solid var(--border); border-radius: var(--radius-sm);
    height: 180px; margin-top: 6px;
}
.dk-sig-canvas {
    width: 100%; height: 100%; display: block;
    touch-action: none; cursor: crosshair;
}
.dk-sig-line {
    position: absolute; left: 10%; right: 10%; bottom: 20%;
    height: 1px; background: #d1d5db; pointer-events: none;
}
.dk-sig-ph {
    position: absolute; left: 0; right: 0; top: 50%;
    transform: translateY(-50%); text-align: center;
    color: #9ca3af; font-size: 13px; pointer-events: none;
}
.dk-sig-sub { display: flex; justify-content: flex-end; margin-top: 4px; }

[data-theme="dark"] .dk-sig-wrap { background: var(--surface-2); }
[data-theme="dark"] .dk-sig-line { background: var(--border); }

/* ─────────────── Meine Überstunden-Anfragen ─────────────── */
.ms-page { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.ms-hero { text-align: center; padding: 16px 0 12px; }
.ms-hero h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.015em; }
.ms-hero p { margin: 0; color: var(--text-muted); font-size: 13.5px; }

.ms-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-bottom: 16px;
}
.ms-stats--3 { grid-template-columns: repeat(3, 1fr); }
.ms-stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px; text-align: center;
}
.ms-stat__value {
    font-size: 24px; font-weight: 700;
    font-variant-numeric: tabular-nums; line-height: 1.15;
}
.ms-stat__value--gesamt      { color: var(--text); }
.ms-stat__value--offen       { color: #d97706; }
.ms-stat__value--freigegeben { color: #15803d; }
.ms-stat__value--abgelehnt   { color: #dc2626; }
.ms-stat__label { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }

.ms-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}
/* Padded-Variante enthaelt Filter mit Datepicker-Popup → overflow MUSS sichtbar bleiben,
   sonst wird das dp-Popup abgeschnitten. Nach .ms-section stehen, damit die Kaskade greift. */
.ms-section.ms-section--padded { overflow: visible; }
.ms-tabs {
    display: flex; border-bottom: 1px solid var(--border);
    background: var(--surface-2); overflow-x: auto;
}
.ms-tab {
    padding: 10px 16px; cursor: pointer; border: 0; background: transparent;
    border-bottom: 3px solid transparent;
    font-weight: 500; color: var(--text-muted); font-size: 12.5px;
    white-space: nowrap; font-family: inherit;
}
.ms-tab:hover:not(.is-active) { color: var(--text); background: var(--surface); }
.ms-tab.is-active {
    color: var(--accent-strong); border-bottom-color: var(--accent-strong);
    background: var(--surface);
}

.ms-table-wrap { overflow-x: auto; }
.ms-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.ms-table th {
    background: var(--surface-2); padding: 9px 12px; text-align: left;
    font-weight: 600; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-size: 11px; text-transform: uppercase; letter-spacing: .025em;
}
.ms-table td {
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    vertical-align: top; font-size: 12.5px; color: var(--text);
}
.ms-table tr:hover td { background: var(--surface-2); }
.ms-sub { font-size: 11.5px; color: var(--text-muted); }
.ms-hours { font-weight: 600; color: var(--accent-strong); font-size: 14px; font-variant-numeric: tabular-nums; }
.ms-begr { max-width: 300px; word-wrap: break-word; line-height: 1.45; }
.ms-bem { max-width: 240px; word-wrap: break-word; color: var(--text-muted); font-style: italic; }

.ms-status {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 500;
}
.ms-status .ic { width: 11px; height: 11px; }
.ms-status--offen       { background: #fef3c7; color: #92400e; }
.ms-status--freigegeben { background: #d1fae5; color: #065f46; }
.ms-status--abgelehnt   { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .ms-status--offen       { background: rgba(245,158,11,.15); color: #fbbf24; }
[data-theme="dark"] .ms-status--freigegeben { background: rgba(16,185,129,.15); color: #34d399; }
[data-theme="dark"] .ms-status--abgelehnt   { background: rgba(239,68,68,.15); color: #f87171; }

.ms-empty {
    text-align: center; padding: 40px 16px; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.ms-empty__icon { width: 36px; height: 36px; color: var(--text-subtle); }
.ms-empty h3 { margin: 0; font-size: 15px; color: var(--text); }
.ms-empty p { margin: 0; font-size: 13px; }

/* Mobile */
.ms-mobile { display: none; }
.ms-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden;
}
.ms-card__head {
    padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.ms-card__title { font-weight: 600; font-size: 13px; }
.ms-card__body { padding: 10px 12px; }
.ms-card__row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; font-size: 12.5px; }
.ms-card__label { font-weight: 500; color: var(--text-muted); min-width: 80px; font-size: 11.5px; }
.ms-card__value { flex: 1; margin-left: 8px; text-align: right; }
.ms-card__full { margin-bottom: 6px; font-size: 12.5px; }
.ms-card__full .ms-card__label { display: block; margin-bottom: 2px; }
.ms-card__full .ms-card__value { text-align: left; margin-left: 0; }

@media (max-width: 768px) {
    .ms-stats { grid-template-columns: repeat(2, 1fr); }
    .ms-table-wrap { display: none; }
    .ms-mobile { display: block; padding: 10px; }
}

/* Historie: "Bereits erstellte Aufmaße" (wie im Original <details> ge-card) */
.aufmass-history {
    margin-top: 20px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}
.aufmass-history > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 14px; font-weight: 600; font-size: 13.5px;
    width: 100%; background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.aufmass-history > summary::-webkit-details-marker { display: none; }
.aufmass-history > summary::after {
    content: '▸'; margin-left: auto; color: var(--text-muted);
    transition: transform .15s ease; display: inline-block;
}
.aufmass-history[open] > summary::after { transform: rotate(90deg); }
.aufmass-history .ic { width: 16px; height: 16px; color: var(--accent); }
.aufmass-history__cnt {
    display: inline-block; padding: 1px 7px; margin-left: 4px;
    background: var(--accent-tint); color: var(--accent-strong);
    border-radius: 999px; font-size: 11px; font-weight: 700;
}
.aufmass-history__wrap { overflow-x: auto; }
.aufmass-history__table {
    width: 100%; border-collapse: collapse; font-size: 12.5px;
}
.aufmass-history__table th,
.aufmass-history__table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.aufmass-history__table th { background: var(--surface); font-weight: 600; color: var(--text-muted); font-size: 11.5px; }
.aufmass-history__table tr:last-child td { border-bottom: 0; }
.aufmass-history__table tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.aufmass-history__code {
    font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
    background: var(--surface-2); padding: 1px 6px; border-radius: 3px;
    font-size: 11.5px;
}
.aufmass-history__actions { display: inline-flex; gap: 4px; }
.aufmass-history__actions .btn--sm { padding: 3px 6px !important; }

/* Live-Kamera-Overlay (Desktop/Web) */
.scan-cam {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; flex-direction: column;
    background: #000;
}
.scan-cam[hidden] { display: none; }
body.scan-cam-open { overflow: hidden; }
.scan-cam__frame {
    position: relative; flex: 1 1 auto;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background: #000;
}
.scan-cam__video {
    width: 100%; height: 100%; object-fit: contain;
    background: #000;
}
.scan-cam__canvas { display: none; }
.scan-cam__hint {
    position: absolute;
    padding: 10px 16px; background: rgba(0,0,0,.6); color: #fff;
    border-radius: var(--radius-sm); font-size: 13px;
}
.scan-cam__bar {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    gap: 20px; padding: 16px 20px;
    background: #111; color: #fff;
    border-top: 1px solid #222;
}
.scan-cam__bar .btn { color: #fff; }
.scan-cam__bar .btn--ghost { background: transparent; border-color: #333; }
.scan-cam__bar .btn--secondary { background: #222; border-color: #333; }
.scan-cam__shutter {
    width: 68px; height: 68px; padding: 0;
    border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: #111; border-color: #fff;
}
.scan-cam__shutter:hover { background: #f3f4f6; }
.scan-cam__shutter svg { width: 44px; height: 44px; }
.scan-cam--flash .scan-cam__frame::after {
    content: ''; position: absolute; inset: 0;
    background: #fff; opacity: .85;
    animation: scanCamFlash .16s linear;
    pointer-events: none;
}
@keyframes scanCamFlash {
    0% { opacity: .85; }
    100% { opacity: 0; }
}