/* ==========================================================================
   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: 500; 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: 500; 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: 600; 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: 600; 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: 700; 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: 700; 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;

    /* Markenfarbe (Gassert-Gruen) — Hell-Gruen dominiert, Dunkel-Gruen fuer hover/aktiv */
    --accent:       #A6C63C;
    --accent-strong:#2F7546;
    --accent-tint:  #F1F7DA;
    --accent-ring:  rgba(166,198,60,.22);

    /* Status */
    --ok:           #2F7546;
    --ok-tint:      #E4F0E8;
    --idle:         #98a1ad;
    --danger:       #b42318;
    --danger-tint:  #fdecea;

    --radius:       9px;
    --radius-sm:    7px;
    --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;
}

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

* { box-sizing: border-box; }

html, body { height: 100%; }

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

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

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

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

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

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

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav__label {
    font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-subtle); padding: 6px 12px 8px;
}
/* Abstand vor weiteren Gruppen-Ueberschriften (zweite, dritte ...) */
.nav__label:not(:first-child) { margin-top: 16px; }
.nav__link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin: 2px 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500; font-size: 14px;
    position: relative; transition: background .12s, color .12s;
}
.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link.is-active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
.nav__link.is-active::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.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: 999px;
    font-variant-numeric: tabular-nums;
}
.nav__link.is-active .nav__badge { background: var(--accent-strong); }

.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: 8px;
    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__logout {
    margin-left: auto; flex: none; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
    color: var(--text-muted); cursor: pointer;
}
.user__logout:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 18px 30px;
    display: flex; align-items: baseline; gap: 12px;
}
.topbar__title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: var(--text); }
.topbar__sub { font-size: 13px; color: var(--text-subtle); }
.topbar__menu {
    display: none; /* nur in der mobilen Ansicht sichtbar */
    flex: none; align-self: center;
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    margin: -6px 6px -6px -8px;
    border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-muted); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.topbar__menu .ic { width: 22px; height: 22px; }
.topbar__menu:hover, .topbar__menu:active { background: var(--surface-2); color: var(--text); }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
    text-align: left; padding: 11px 16px;
    font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-subtle); background: var(--surface-2);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
/* Einheitliche Tabellenschrift: gleiche Familie/Größe/Farbe; Hervorhebung nur via Fett.
   Platzsparend: keine Umbrüche; bei Überbreite scrollt .table-wrap horizontal. */
table.data tbody td {
    padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle;
    color: var(--text); font-size: 14px; white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
.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 ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 10px 4px 8px; border-radius: 999px;
    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--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 {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
    outline: none; transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--text-subtle); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px; border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: background .12s, border-color .12s, color .12s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); color: #fff; }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn.is-disabled { pointer-events: none; opacity: .45; }
.btn--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; 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: 14px;
    box-shadow: 0 8px 30px rgba(16,24,40,.06);
    padding: 34px 32px;
}
.auth__logo { display: flex; justify-content: center; margin-bottom: 8px; }
.auth__logo { margin-bottom: 24px; }
.auth__logo img { height: 96px; width: auto; filter: brightness(0) opacity(.78); }
.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 .btn--primary { width: 100%; justify-content: center; margin-top: 22px; padding: 11px; }

@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;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 0 12px 40px rgba(16,24,40,.18);
    }
    body.nav-open { overflow: hidden; }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .backdrop { opacity: 1; visibility: visible; }

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

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

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

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

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

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

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

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

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

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

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

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

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

