/* ==========================================================================
   TMail – Oberfläche
   --------------------------------------------------------------------------
   Gestaltungsgrundsätze:

   1. Die Daten sind das Design. Struktur (Linien, Abstände, Ausrichtung)
      trägt Bedeutung; alles andere fällt weg.
   2. Status hat genau drei Farben und genau eine Form – ein Punkt. Wer die
      Zuordnung einmal gelernt hat, liest sie überall wieder.
   3. Technische Werte (IP-Adressen, Schlüssel, Queue-Kennungen, Logzeilen)
      sind dicktengleich gesetzt und markierbar. Fließtext niemals.
   4. Zahlen, die untereinander verglichen werden, laufen auf
      Tabellenziffern – sonst tanzen die Spalten.
   5. Keine Karte, wo eine Zeile genügt.
   ========================================================================== */

/* --- Farben und Maße ---------------------------------------------------- */

:root {
    color-scheme: light dark;

    /* Hell: kühles Papier, kein Cremeton – das Panel soll nach Werkzeug
       aussehen, nicht nach Zeitschrift. */
    --paper:        #eef1f5;
    --surface:      #ffffff;
    --surface-sunk: #f7f9fb;
    --ink:          #141b26;
    --ink-muted:    #5a6779;
    --ink-faint:    #8593a6;
    --line:         #d6dce5;
    --line-strong:  #b9c3d0;

    --accent:       #1a54a8;
    --accent-hover: #16467f;
    --accent-soft:  #e7eefa;
    --accent-ink:   #ffffff;

    /* Statusfarben tragen Bedeutung und werden nirgends dekorativ genutzt. */
    --ok:        #1f7a4d;
    --ok-soft:   #e3f3ea;
    --warn:      #8f6413;
    --warn-soft: #fbf0d8;
    --fail:      #b23127;
    --fail-soft: #fbe6e4;
    --info:      #3b5f8a;
    --info-soft: #e9eff7;

    /* Diagrammserien. Diese Werte sind gegen Helligkeitsband, Sättigung,
       Farbfehlsichtigkeit und Flächenkontrast geprüft – nicht nach Gefühl
       gewählt. Serie 3 ist der Fehlerfall und trägt deshalb bewusst die
       Signalfarbe. */
    --series-1: #1a54a8;
    --series-2: #0a8a73;
    --series-3: #b23127;

    --shadow-menu: 0 6px 24px rgb(20 27 38 / 14%);

    --radius:       6px;
    --radius-small: 4px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --sidebar-width: 224px;
    --signal-height: 34px;

    /* Eine Familie für alles Gelesene. Der Systemstapel laedt nichts nach –
       ein Verwaltungswerkzeug soll auch ohne Internetzugang sofort da sein. */
    --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
               "Noto Sans", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono",
                 Menlo, Consolas, "Liberation Mono", monospace;

    --step--1: 0.8125rem;  /* 13px – Tabellen, Hilfstexte */
    --step-0:  0.9375rem;  /* 15px – Grundtext */
    --step-1:  1.0625rem;  /* 17px – Abschnitt */
    --step-2:  1.3125rem;  /* 21px – Seitentitel */
    --step-3:  1.6875rem;  /* 27px – Kennzahlen */
}

/* Dunkel: Tintenblau statt Schwarz. Reines Schwarz lässt die Statusfarben
   flimmern und ermüdet bei langer Betrachtung. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper:        #0f1620;
        --surface:      #161f2c;
        --surface-sunk: #121a25;
        --ink:          #e4e9f0;
        --ink-muted:    #93a1b5;
        --ink-faint:    #6d7d93;
        --line:         #27323f;
        --line-strong:  #384453;

        --accent:       #5b9bea;
        --accent-hover: #7bb0f0;
        --accent-soft:  #1a2b42;
        --accent-ink:   #0f1620;

        --ok:        #43b581;
        --ok-soft:   #16301f;
        --warn:      #d9a441;
        --warn-soft: #332713;
        --fail:      #e06a5f;
        --fail-soft: #36191a;
        --info:      #7fa8d8;
        --info-soft: #17273a;

        --series-1: #4a8fdb;
        --series-2: #12a58c;
        --series-3: #dc5a4f;

        --shadow-menu: 0 6px 24px rgb(0 0 0 / 50%);
    }
}

:root[data-theme="dark"] {
    --paper:        #0f1620;
    --surface:      #161f2c;
    --surface-sunk: #121a25;
    --ink:          #e4e9f0;
    --ink-muted:    #93a1b5;
    --ink-faint:    #6d7d93;
    --line:         #27323f;
    --line-strong:  #384453;

    --accent:       #5b9bea;
    --accent-hover: #7bb0f0;
    --accent-soft:  #1a2b42;
    --accent-ink:   #0f1620;

    --ok:        #43b581;
    --ok-soft:   #16301f;
    --warn:      #d9a441;
    --warn-soft: #332713;
    --fail:      #e06a5f;
    --fail-soft: #36191a;
    --info:      #7fa8d8;
    --info-soft: #17273a;

    --series-1: #4a8fdb;
    --series-2: #12a58c;
    --series-3: #dc5a4f;

    --shadow-menu: 0 6px 24px rgb(0 0 0 / 50%);
}

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

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: var(--step-0);
    line-height: 1.5;
    /* Zahlen sollen in Spalten übereinanderstehen. */
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1 { font-size: var(--step-2); }
h2 { font-size: var(--step-1); }
h3 { font-size: var(--step-0); }

p { margin: 0 0 var(--space-3); max-width: 72ch; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover { color: var(--accent-hover); }

code, kbd, samp, .mono {
    font-family: var(--font-mono);
    font-size: 0.9em;
    font-variant-ligatures: none;
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-small);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.noscript {
    margin: var(--space-5);
    padding: var(--space-4);
    border: 1px solid var(--fail);
    border-radius: var(--radius);
    background: var(--fail-soft);
}

/* --- Ladezustand vor dem ersten Rendern ---------------------------------- */

.boot-screen {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.boot-spinner {
    width: 26px;
    height: 26px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

/* ==========================================================================
   Signalband – die obere Kante der Anwendung
   --------------------------------------------------------------------------
   Kein Kaestchen auf einer Seite, sondern eine durchgehende Kante: der
   Serverzustand ist die eine Angabe, die immer sichtbar sein muss. Im
   Normalfall bleibt sie ruhig; bei einem Problem färbt sie sich und trägt
   die konkrete Meldung samt Weg zur Behebung.
   ========================================================================== */

.signal {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--signal-height);
    padding: 0 var(--space-4);
    padding-top: env(safe-area-inset-top, 0);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    font-size: var(--step--1);
    color: var(--ink-muted);
}

.signal::before {
    content: "";
    width: 3px;
    align-self: stretch;
    margin: 6px 0;
    border-radius: 2px;
    background: var(--ok);
}

.signal[data-state="warning"] { background: var(--warn-soft); color: var(--ink); }
.signal[data-state="warning"]::before { background: var(--warn); }
.signal[data-state="critical"] { background: var(--fail-soft); color: var(--ink); }
.signal[data-state="critical"]::before { background: var(--fail); }

/* Der Meldungstext darf die Kante nicht aufblähen: eine Zeile, der Rest
   wird abgeschnitten. Die vollständige Meldung steht in der Uebersicht. */
.signal__text {
    font-weight: 500;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.signal__facts {
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--space-4);
    margin-left: auto;
}
.signal__fact { white-space: nowrap; }
.signal__fact b { font-weight: 600; color: var(--ink); }

/* --- Grundgerüst ---------------------------------------------------------- */

.app { min-height: 100vh; }

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: calc(100vh - var(--signal-height));
}

/* --- Navigation ------------------------------------------------------------- */

.sidebar {
    position: sticky;
    top: var(--signal-height);
    align-self: start;
    height: calc(100vh - var(--signal-height));
    overflow-y: auto;
    padding: var(--space-4) 0 var(--space-5);
    border-right: 1px solid var(--line);
    background: var(--surface);
}

.brand {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: 0 var(--space-4) var(--space-4);
}

.brand__name {
    font-size: var(--step-1);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.brand__version {
    font-size: 11px;
    color: var(--ink-faint);
}

.nav-group + .nav-group { margin-top: var(--space-4); }

.nav-group__title {
    padding: 0 var(--space-4) var(--space-1);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-faint);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 7px var(--space-4);
    color: var(--ink-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    font-size: var(--step--1);
}

.nav-item:hover {
    background: var(--surface-sunk);
    color: var(--ink);
}

.nav-item[aria-current="page"] {
    border-left-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav-item__badge {
    margin-left: auto;
    padding: 1px 6px;
    border-radius: 9px;
    background: var(--fail);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.nav-icon { flex: none; width: 16px; height: 16px; stroke-width: 1.7; }

/* --- Inhaltsbereich -------------------------------------------------------- */

.main {
    min-width: 0;
    padding: var(--space-5) var(--space-5) var(--space-7);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.page-head__text { flex: 1 1 320px; min-width: 0; }
.page-head__lead { margin: var(--space-1) 0 0; color: var(--ink-muted); font-size: var(--step--1); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.section { margin-bottom: var(--space-6); }
.section__head {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.section__head h2 { margin-right: auto; }

/* --- Flächen --------------------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.panel__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
}

.panel__head h2, .panel__head h3 { margin-right: auto; }
.panel__body { padding: var(--space-4); }
.panel__body--flush { padding: 0; }

/* --- Kennzahlen ------------------------------------------------------------- */

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.metric {
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
}

.metric__value {
    font-size: var(--step-3);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.metric__label { margin-top: 2px; font-size: var(--step--1); color: var(--ink-muted); }
.metric__note { margin-top: var(--space-1); font-size: 12px; color: var(--ink-faint); }
.metric--ok   .metric__value { color: var(--ok); }
.metric--warn .metric__value { color: var(--warn); }
.metric--fail .metric__value { color: var(--fail); }

/* --- Tabellen --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--step--1);
}

table.data th {
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--line);
    background: var(--surface-sunk);
    text-align: left;
    font-weight: 600;
    color: var(--ink-muted);
    white-space: nowrap;
}

table.data td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-sunk); }

/* Zahlen rechtsbündig – so lassen sich Größenordnungen vergleichen,
   ohne zu lesen. */
table.data td.num, table.data th.num { text-align: right; }
table.data td.mono { font-family: var(--font-mono); font-size: 12.5px; }
table.data td.shrink, table.data th.shrink { width: 1%; white-space: nowrap; }

.sortable {
    cursor: pointer;
    user-select: none;
}
.sortable[aria-sort="ascending"]::after  { content: " ↑"; color: var(--accent); }
.sortable[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }

.row-actions { display: flex; gap: var(--space-1); justify-content: flex-end; }

.cell-main { font-weight: 550; }
.cell-sub  { color: var(--ink-faint); font-size: 12px; }

/* --- Status ------------------------------------------------------------------
   Ein Punkt, drei Farben, überall dieselbe Bedeutung.
   ---------------------------------------------------------------------------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.status::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-faint);
}

.status--ok::before   { background: var(--ok); }
.status--warn::before { background: var(--warn); }
.status--fail::before { background: var(--fail); }
.status--info::before { background: var(--info); }
.status--off::before  { background: var(--ink-faint); }

/* Ring um laufende Dienste: zeigt Aktivität, ohne zu blinken. */
.status--running::before {
    background: var(--ok);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

.tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: var(--radius-small);
    background: var(--surface-sunk);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-muted);
}

.tag--accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.tag--ok     { background: var(--ok-soft);     border-color: transparent; color: var(--ok); }
.tag--warn   { background: var(--warn-soft);   border-color: transparent; color: var(--warn); }
.tag--fail   { background: var(--fail-soft);   border-color: transparent; color: var(--fail); }

/* --- Bedienelemente ----------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: var(--step--1);
    font-weight: 550;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.btn:hover:not(:disabled) { background: var(--surface-sunk); border-color: var(--ink-faint); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--danger { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 45%, var(--line)); }
.btn--danger:hover:not(:disabled) { background: var(--fail-soft); }

.btn--quiet { border-color: transparent; background: transparent; color: var(--ink-muted); }
.btn--quiet:hover:not(:disabled) { background: var(--surface-sunk); color: var(--ink); }

.btn--small { padding: 3px 9px; font-size: 12.5px; }
.btn--block { width: 100%; }

.btn__spinner {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* --- Formulare ------------------------------------------------------------------ */

.field { margin-bottom: var(--space-4); }
.field:last-child { margin-bottom: 0; }

.field__label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--step--1);
    font-weight: 550;
}

.field__hint {
    margin-top: var(--space-1);
    font-size: 12.5px;
    color: var(--ink-muted);
    max-width: 68ch;
}

.field__error {
    margin-top: var(--space-1);
    font-size: 12.5px;
    color: var(--fail);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="datetime-local"],
select, textarea {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: var(--step--1);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
    outline-offset: 0;
}

input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
    border-color: var(--fail);
}

input:disabled, select:disabled, textarea:disabled {
    background: var(--surface-sunk);
    color: var(--ink-muted);
}

textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input-mono { font-family: var(--font-mono); font-size: 13px; }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--space-4);
}

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    font-size: var(--step--1);
    cursor: pointer;
}

.check input { width: auto; margin: 3px 0 0; flex: none; }
.check__text { flex: 1; }
.check__hint { display: block; color: var(--ink-muted); font-size: 12.5px; }

fieldset { margin: 0 0 var(--space-4); padding: 0; border: none; }
legend {
    padding: 0 0 var(--space-2);
    font-size: var(--step--1);
    font-weight: 600;
}

/* Passwortstärke: eine Leiste, deren Farbe der Statuslogik folgt. */
.strength { margin-top: var(--space-2); }
.strength__bar {
    height: 3px;
    border-radius: 2px;
    background: var(--line);
    overflow: hidden;
}
.strength__fill {
    height: 100%;
    width: 0;
    background: var(--fail);
    transition: width 0.2s ease, background-color 0.2s ease;
}
.strength[data-level="mittel"] .strength__fill { background: var(--warn); }
.strength[data-level="stark"] .strength__fill,
.strength[data-level="sehr stark"] .strength__fill { background: var(--ok); }
.strength__label { margin-top: 3px; font-size: 12px; color: var(--ink-muted); }

/* --- Filterleiste ------------------------------------------------------------------ */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
}

.toolbar__search { flex: 1 1 240px; max-width: 360px; }
.toolbar__spacer { flex: 1; }

/* --- Auslastungsbalken ------------------------------------------------------------ */

.meter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.meter__track {
    flex: 1;
    min-width: 54px;
    height: 5px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.meter__fill { height: 100%; background: var(--ok); border-radius: 3px; }
.meter[data-level="warn"] .meter__fill { background: var(--warn); }
.meter[data-level="fail"] .meter__fill { background: var(--fail); }
.meter__value { font-size: 12px; color: var(--ink-muted); min-width: 38px; text-align: right; }

/* --- Prüfergebnisse --------------------------------------------------------------
   Jede Zeile sagt nicht nur, was fehlt, sondern auch wo es zu beheben ist –
   im Panel, beim DNS-Anbieter, beim Hoster oder gar nicht.
   ---------------------------------------------------------------------------------- */

.check-list { display: grid; gap: 1px; background: var(--line); }

.check-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
}

.check-row__mark {
    margin-top: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ink-faint);
}

.check-row[data-status="ok"]    .check-row__mark { background: var(--ok); }
.check-row[data-status="warn"]  .check-row__mark { background: var(--warn); }
.check-row[data-status="fail"]  .check-row__mark { background: var(--fail); }
.check-row[data-status="info"]  .check-row__mark { background: var(--info); }
.check-row[data-status="error"] .check-row__mark { background: var(--warn); }

.check-row__title { font-weight: 600; }
.check-row__message { margin-top: 2px; color: var(--ink-muted); font-size: var(--step--1); max-width: 78ch; }

.check-row__scope {
    margin-top: var(--space-2);
    font-size: 12px;
    color: var(--ink-faint);
}

.check-row__values {
    display: grid;
    gap: var(--space-1);
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-small);
    background: var(--surface-sunk);
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-all;
}

.check-row__values dt { color: var(--ink-faint); font-family: var(--font-ui); }
.check-row__values dd { margin: 0 0 var(--space-2); }
.check-row__values dd:last-child { margin-bottom: 0; }

.check-row__actions { margin: var(--space-2) 0 0; padding-left: 18px; font-size: var(--step--1); color: var(--ink-muted); }
.check-row__actions li { margin-bottom: 2px; }

/* --- Bewertung ------------------------------------------------------------------- */

.score {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.score__value { font-size: var(--step-3); font-weight: 650; letter-spacing: -0.02em; }
.score--ok   .score__value { color: var(--ok); }
.score--warn .score__value { color: var(--warn); }
.score--fail .score__value { color: var(--fail); }
.score__label { color: var(--ink-muted); font-size: var(--step--1); }

/* --- Dialoge ---------------------------------------------------------------------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: start center;
    padding: var(--space-5) var(--space-4);
    overflow-y: auto;
    background: rgb(20 27 38 / 45%);
    backdrop-filter: blur(2px);
}

.modal {
    width: min(100%, 620px);
    margin-top: 4vh;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-menu);
    animation: modal-in 0.14s ease-out;
}

.modal--wide { width: min(100%, 880px); }

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.modal__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--line);
}

.modal__head h2 { margin-right: auto; }
.modal__body { padding: var(--space-4); max-height: 68vh; overflow-y: auto; }
.modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--line);
    background: var(--surface-sunk);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* --- Hinweise --------------------------------------------------------------------- */

.notice {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: var(--radius-small);
    background: var(--surface);
    font-size: var(--step--1);
    margin-bottom: var(--space-4);
}

.notice--info { border-left-color: var(--info); background: var(--info-soft); }
.notice--ok   { border-left-color: var(--ok);   background: var(--ok-soft); }
.notice--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice--fail { border-left-color: var(--fail); background: var(--fail-soft); }
.notice__body { flex: 1; min-width: 0; }
.notice__title { font-weight: 600; margin-bottom: 2px; }

/* --- Meldungen (kurzlebig) ---------------------------------------------------------- */

.toasts {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-4);
    z-index: 80;
    display: grid;
    gap: var(--space-2);
    width: min(360px, calc(100vw - 2 * var(--space-4)));
}

.toast {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-left: 3px solid var(--ok);
    border-radius: var(--radius-small);
    background: var(--surface);
    box-shadow: var(--shadow-menu);
    font-size: var(--step--1);
    animation: toast-in 0.16s ease-out;
}

.toast--error { border-left-color: var(--fail); }
.toast--warn  { border-left-color: var(--warn); }
.toast__body  { flex: 1; min-width: 0; }
.toast__close { margin: -2px -4px 0 0; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: none; }
}

/* --- Leere Zustände ------------------------------------------------------------------
   Eine leere Liste ist eine Aufforderung, nicht eine Entschuldigung.
   -------------------------------------------------------------------------------------- */

.empty {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: var(--ink-muted);
}

.empty__title { font-weight: 600; color: var(--ink); margin-bottom: var(--space-1); }
.empty__text { max-width: 46ch; margin: 0 auto var(--space-4); font-size: var(--step--1); }

/* --- Blaetterfunktion ------------------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--line);
    font-size: var(--step--1);
    color: var(--ink-muted);
}

.pagination__spacer { flex: 1; }

/* --- Anmeldeseite ------------------------------------------------------------------------ */

.login {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: var(--space-5);
}

.login__box { width: min(100%, 380px); }

.login__brand {
    margin-bottom: var(--space-5);
    text-align: center;
}

.login__title { font-size: var(--step-2); font-weight: 650; letter-spacing: -0.02em; }
.login__sub { margin-top: var(--space-1); color: var(--ink-muted); font-size: var(--step--1); }

.login__form {
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.login__foot {
    margin-top: var(--space-4);
    text-align: center;
    font-size: 12px;
    color: var(--ink-faint);
}

/* --- Diagramm ------------------------------------------------------------------------------ */

.chart { width: 100%; height: auto; display: block; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__axis { fill: var(--ink-faint); font-size: 10px; font-family: var(--font-ui); }
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-2);
    font-size: 12px;
    color: var(--ink-muted);
}
.chart-legend__item { display: flex; align-items: center; gap: 6px; }
.chart-legend__swatch { width: 9px; height: 3px; border-radius: 2px; }

/* --- Protokollausgabe ------------------------------------------------------------------------- */

.transcript {
    margin: 0;
    padding: var(--space-3);
    border-radius: var(--radius-small);
    background: var(--surface-sunk);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 340px;
    overflow-y: auto;
}

.transcript__out { color: var(--accent); }
.transcript__in  { color: var(--ink-muted); }

.copy-field {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
}

/* Der Wert bricht um, statt abgeschnitten zu werden – bei einem
   DKIM-Schlüssel ist ein halber Wert unbrauchbar. */
.copy-field__value {
    flex: 1;
    min-width: 0;
    max-height: 7.5em;
    overflow-y: auto;
    padding: 5px 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface-sunk);
    font-size: 12.5px;
    line-height: 1.5;
    word-break: break-all;
    cursor: text;
}

.copy-field .btn { flex: none; }

/* --- Beschreibungslisten ---------------------------------------------------------------------- */

.kv {
    display: grid;
    grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
    gap: var(--space-2) var(--space-4);
    margin: 0;
    font-size: var(--step--1);
}

.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; word-break: break-word; }
.kv dd.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* --- Reiter --------------------------------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.tab {
    padding: var(--space-2) var(--space-3);
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--ink-muted);
    font: inherit;
    font-size: var(--step--1);
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
}

.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }

/* --- Hilfsklassen ------------------------------------------------------------------------------------ */

.stack   { display: grid; gap: var(--space-4); }
.stack-2 { display: grid; gap: var(--space-2); }
.row     { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.grow    { flex: 1; }
.muted   { color: var(--ink-muted); }
.faint   { color: var(--ink-faint); }
.small   { font-size: var(--step--1); }
.tiny    { font-size: 12px; }
.nowrap  { white-space: nowrap; }
.right   { text-align: right; }
.cols-2  { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); }

/* --- Kleinere Bildschirme ------------------------------------------------------------------------------- */

.nav-toggle { display: none; }

@media (max-width: 880px) {
    .layout { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        top: var(--signal-height);
        left: 0;
        z-index: 50;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.18s ease;
        box-shadow: var(--shadow-menu);
    }

    .sidebar[data-open="true"] { transform: none; }

    .nav-toggle { display: inline-flex; }
    .main { padding: var(--space-4) var(--space-4) var(--space-6); }
    .signal__facts { display: none; }
    .metrics { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
    .toasts { left: var(--space-4); right: var(--space-4); width: auto; }
}

@media (max-width: 560px) {
    .page-head { flex-direction: column; }
    .page-head__actions { width: 100%; }
    .modal { margin-top: 0; }
    .kv { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
    .kv dd { margin-bottom: var(--space-2); }
}

@media print {
    .sidebar, .signal, .page-head__actions, .toolbar, .toasts { display: none; }
    .main { padding: 0; }
    .panel { border: none; }
}
