/**
 * fxarchive.css
 *
 * @company     FUX IT GMBH
 * @author      Helmut FUX
 * @copyright   (c) 2026 - FUX IT GMBH - Alle Rechte vorbehalten
 *
 * @description Gemeinsames Stylesheet der Admin-GUI – übernommen aus dem klickbaren Prototyp
 *              (design/prototype/assets/fxarchive.css), damit die echte Oberfläche genauso aussieht.
 *              Änderungen am Aussehen bitte in BEIDEN Dateien machen oder den Prototyp künftig hieraus
 *              ableiten. Ergänzungen nur für die echte Anwendung stehen in mgmt.css.
 *              Ursprünglich für: Admin-GUI, Kundenportal, Tagesbericht, Bestätigungsseite, Outlook-Add-in. Es setzt die Gestaltungsregeln aus CLAUDE.md um:
 *              schmale dunkle Icon-Leiste, helle Inhaltsfläche, Diagramme statt Zahlenkolonnen,
 *              IBM Plex Sans/Mono, Akzentfarbe „Fuchs-Orange“ und feste Statusfarben.
 *
 *              AUFBAU:
 *                1. Farb- und Maß-Variablen (Design-Tokens) – nur hier Farben ändern
 *                2. Grundlayout (App-Rahmen mit Seitenleiste, Kopfzeile, Inhalt)
 *                3. Bausteine (Karten, Tabellen, Knöpfe, Formulare, Reiter, Schalter, Pillen …)
 *                4. Sonderseiten (Anmeldung, Tagesbericht, Add-in)
 *                5. Handy-Ansicht (das Kundenportal muss am Handy bedienbar sein)
 *
 *              Barrierefreiheit: Kontrast der Texte mindestens 4.5:1, sichtbarer Fokusrahmen für die
 *              Tastaturbedienung, echte Buttons statt klickbarer DIVs.
 */

/* ------------------------------------------------------------------------------------------
 * 1. Design-Tokens
 * Die Werte stammen aus dem Abschnitt „GUI-Design“ in CLAUDE.md.
 * ---------------------------------------------------------------------------------------- */
:root {
  --ink: #14181F;            /* Seitenleiste, Überschriften */
  --ink-2: #232A35;          /* Hover in der dunklen Seitenleiste */
  --ground: #F3F4F7;         /* Hintergrund der Inhaltsfläche */
  --surface: #FFFFFF;        /* Karten, Tabellen */
  --line: #E3E6EB;           /* Rahmen und Trennlinien */
  --text: #14181F;
  --text-2: #5B6472;         /* sekundärer Text, Beschriftungen */
  --accent: #C2410C;         /* Fuchs-Orange */
  --accent-hover: #9A3412;
  --accent-light: #FFF7ED;
  --accent-border: #FDBA74;

  /* Statusfarben – überall gleich verwenden, damit man Zustände sofort erkennt */
  --ok: #15803D;             /* zugestellt */
  --ok-bg: #ECFDF3;
  --quar: #D97706;           /* Quarantäne */
  --quar-dark: #92400E;
  --quar-bg: #FFFBEB;
  --reject: #B91C1C;         /* abgewiesen */
  --reject-bg: #FEF2F2;
  --grey: #1D4ED8;           /* Greylisting / verzögert */
  --grey-bg: #EFF6FF;
  --virus: #7E22CE;          /* Virus */
  --virus-bg: #FAF5FF;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .06), 0 1px 3px rgba(20, 24, 31, .08);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --rail: 64px;              /* Breite der Icon-Leiste */
}

/* ------------------------------------------------------------------------------------------
 * 2. Grundlayout
 * ---------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }

/* App-Rahmen: links die Icon-Leiste, rechts Kopfzeile + Inhalt */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  background: var(--ink);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px;
  position: sticky; top: 0; height: 100vh;
  /* Mehr Menüpunkte als Platz: die Leiste scrollt (schmale, dunkle Bildlaufleiste) */
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #3A4250 transparent;
}
.rail > * { flex-shrink: 0; }
/* Niedrige Bildschirme (Laptop): Menüpunkte etwas enger */
@media (max-height: 860px) and (min-width: 901px) {
  .rail { gap: 2px; padding: 8px 0; }
  .rail-btn { height: 34px; }
  .rail .logo { margin-bottom: 8px; }
}
.rail .logo { margin-bottom: 14px; }
.rail-btn {
  position: relative;
  width: 44px; height: 40px; border-radius: var(--radius);
  display: grid; place-items: center;
  color: #A7B0BE; background: none; border: 0; cursor: pointer;
}
.rail-btn:hover { background: var(--ink-2); color: #fff; }
.rail-btn.active { background: var(--accent); color: #fff; }
.rail-btn svg { width: 20px; height: 20px; }
/* Beschriftung erscheint beim Darüberfahren als Tooltip rechts neben dem Symbol */
/* position: fixed, damit die scrollende Leiste den Tooltip nicht abschneidet; die Höhe setzt app.js (--tip-top) */
.rail-btn .tip {
  position: fixed; left: calc(var(--rail) + 6px); top: var(--tip-top, -100px); transform: translateY(-50%);
  background: var(--ink); color: #fff; white-space: nowrap;
  font-size: 12.5px; padding: 5px 9px; border-radius: var(--radius-sm);
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50;
  box-shadow: var(--shadow);
}
.rail-btn:hover .tip, .rail-btn:focus-visible .tip { opacity: 1; }
.rail .spacer { flex: 1; }
.rail .badge-dot {
  position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--reject); border: 2px solid var(--ink);
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumbs { color: var(--text-2); font-size: 13px; }
.topbar .crumbs b { color: var(--text); font-weight: 600; }
.topbar .grow { flex: 1; }
.topbar .search {
  display: flex; align-items: center; gap: 8px; width: 340px; max-width: 40vw;
  background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 10px; color: var(--text-2);
}
.topbar .search input { border: 0; background: none; outline: none; flex: 1; font: inherit; color: var(--text); }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-light);
  color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 12px;
  border: 1px solid var(--accent-border);
}
.content { padding: 24px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.proto-note {
  font-size: 12px; color: var(--quar-dark); background: var(--quar-bg);
  border: 1px solid #FDE68A; border-radius: var(--radius-sm); padding: 3px 8px;
}

/* ------------------------------------------------------------------------------------------
 * 3. Bausteine
 * ---------------------------------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 14.5px; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

/* Kennzahl-Kachel */
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.kpi .delta.up { color: var(--reject); }
.kpi .delta.down { color: var(--ok); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* Knöpfe */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 12px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  white-space: nowrap;
}
.btn:hover { border-color: #C9CED6; background: #FAFAFB; text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--reject); }
.btn.danger:hover { background: var(--reject-bg); border-color: #FCA5A5; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--ground); }
.btn.sm { padding: 4px 8px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Pillen für Status und Kategorien */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; line-height: 1;
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--ground); color: var(--text-2); border: 1px solid var(--line);
}
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: #BBF7D0; }
.pill.quar { background: var(--quar-bg); color: var(--quar-dark); border-color: #FDE68A; }
.pill.reject { background: var(--reject-bg); color: var(--reject); border-color: #FECACA; }
.pill.grey { background: var(--grey-bg); color: var(--grey); border-color: #BFDBFE; }
.pill.virus { background: var(--virus-bg); color: var(--virus); border-color: #E9D5FF; }
.pill.accent { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }
.pill.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill svg { width: 12px; height: 12px; }

/* Herkunft einer Einstellung (Hierarchie Global → Domain → Benutzer) */
.origin { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; }
.origin.global { background: #EEF0F4; color: var(--text-2); }
.origin.domain { background: var(--accent-light); color: var(--accent); }
.origin.user { background: var(--grey-bg); color: var(--grey); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px;
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.click { cursor: pointer; }
table.data tbody tr.click:hover td { background: #FAFAFB; }
table.data tr.selected td { background: var(--accent-light); }
table.data tr.seen td { color: var(--text-2); }
table.data tr.group td { background: var(--ground); font-weight: 600; font-size: 12px; color: var(--text-2); padding: 6px 12px; }
table.data .chk { width: 34px; }
.subject { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.sender { color: var(--text-2); font-size: 12px; }

/* Score-Balken: Zahl plus kleiner Balken, damit man auf einen Blick vergleichen kann */
.score { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12.5px; }
.score .bar { width: 46px; height: 6px; background: var(--ground); border-radius: 3px; overflow: hidden; }
.score .bar i { display: block; height: 100%; background: var(--quar); }
.score.high .bar i { background: var(--reject); }
.score.low .bar i { background: var(--ok); }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label, .label-text { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], input[type=search], select, textarea {
  font: inherit; font-size: 13.5px; color: var(--text);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
textarea { min-height: 80px; font-family: var(--mono); font-size: 12.5px; }
.inline-input { width: auto; display: inline-block; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-list label, .check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.radio-list small { display: block; color: var(--text-2); font-size: 12px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; margin-top: 2px; }

/* Schalter (ein/aus) – optisch ein Kippschalter, technisch eine Checkbox */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 34px; height: 20px; border-radius: 999px; background: #CBD1DA; position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { left: 17px; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .55; cursor: not-allowed; }

/* Einstellungszeilen: Name + Beschreibung links, Wert/Schalter rechts */
.setting { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .name { font-weight: 500; }
.setting .desc { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.setting .ctl { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.setting.locked .name::after { content: " 🔒"; }

/* Reiter */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  font: inherit; font-size: 13.5px; background: none; border: 0; cursor: pointer;
  padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab .count { font-size: 11.5px; background: var(--ground); border-radius: 999px; padding: 1px 6px; margin-left: 4px; color: var(--text-2); }

/* Filter-Chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text-2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Toolbar über Tabellen */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar input[type=search] { width: 260px; }
.bulkbar { background: var(--accent-light); border-bottom: 1px solid var(--accent-border); }

/* Hinweis-Boxen */
.notice { border: 1px solid var(--line); border-left: 3px solid var(--grey); background: var(--grey-bg); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { border-left-color: var(--quar); background: var(--quar-bg); }
.notice.danger { border-left-color: var(--reject); background: var(--reject-bg); }
.notice.ok { border-left-color: var(--ok); background: var(--ok-bg); }
.notice.accent { border-left-color: var(--accent); background: var(--accent-light); }
.notice svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* Liste mit Symbolen (z. B. Alarme, Zeitleiste) */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.list .icon svg { width: 16px; height: 16px; }
.list .grow { flex: 1; min-width: 0; }

/* Zeitleiste im Mail-Detail (Message-Trace) */
.timeline { list-style: none; margin: 0; padding: 4px 0 4px 8px; }
.timeline li { position: relative; padding: 0 0 16px 24px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text-2); }
.timeline li.ok::before { border-color: var(--ok); background: var(--ok); }
.timeline li.quar::before { border-color: var(--quar); background: var(--quar); }
.timeline li.reject::before { border-color: var(--reject); background: var(--reject); }
.timeline li.grey::before { border-color: var(--grey); background: var(--grey); }
.timeline .when { font-family: var(--mono); font-size: 12px; color: var(--text-2); }

/* Filterkette (Stufe 0–3) als Trichter */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel .stage { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; }
.funnel .track { height: 22px; background: var(--ground); border-radius: 4px; overflow: hidden; display: flex; }
.funnel .track i { display: block; height: 100%; }
.funnel .num { text-align: right; font-family: var(--mono); font-size: 12.5px; }

/* Diagramm-Legende */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { font-family: var(--font); font-size: 10px; fill: var(--text-2); }

/* Matrix für die Warteschlange (Domain × Alter, ähnlich qshape) */
.heat td.cell { text-align: center; font-family: var(--mono); font-size: 12px; }
.heat td.h0 { color: #C5CAD3; }
.heat td.h1 { background: #FFF7ED; }
.heat td.h2 { background: #FED7AA; }
.heat td.h3 { background: #FDBA74; color: #7C2D12; font-weight: 600; }

/* Knoten-Karte im Cluster */
.node .services { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.meter { height: 6px; background: var(--ground); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); }

/* Modal-Dialog */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 31, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: 620px; max-width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal .card-head { position: sticky; top: 0; background: var(--surface); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }

/* Meldungen unten rechts (Toast) */
.toast-area { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; box-shadow: var(--shadow); max-width: 380px; display: flex; gap: 10px; align-items: center; animation: toastIn .18s ease-out; }
.toast svg { width: 16px; height: 16px; color: #86EFAC; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Vorschau einer Mail (abgeschottet, Bilder blockiert) */
.mail-preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mail-preview .meta { background: #FAFBFC; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; }
.mail-preview .body { padding: 16px; font-size: 14px; }
.blocked-img { display: inline-grid; place-items: center; width: 160px; height: 70px; background: repeating-linear-gradient(45deg, #F3F4F7, #F3F4F7 8px, #E9EBF0 8px, #E9EBF0 16px); border-radius: 6px; color: var(--text-2); font-size: 11.5px; margin: 6px 0; }
pre.headers { margin: 0; padding: 14px; background: #0F1318; color: #D5DBE3; border-radius: var(--radius); font-family: var(--mono); font-size: 12px; overflow-x: auto; line-height: 1.55; }

/* Tastenkürzel-Hinweis */
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--surface); color: var(--text); }

/* Regel-Engine */
.rule-cond { display: flex; gap: 4px; flex-wrap: wrap; }
.rule-cond .pill { font-weight: 400; }
.prio { font-family: var(--mono); font-weight: 600; font-size: 12.5px; }
tr.locked td { background: #FBFBFC; }
tr.inactive td { color: #9AA3B0; }
tr.inactive .pill { opacity: .6; }

/* Kopfbanner im Portal (Hinweis des Admins) */
.banner { background: var(--accent-light); border-bottom: 1px solid var(--accent-border); color: var(--accent-hover); padding: 9px 24px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.banner svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------------------------------
 * 3b. Aufklappbare Menüleiste
 * Standard: schmale Icon-Leiste. Mit dem Knopf oben wird sie auf 220 px aufgeklappt und zeigt die
 * Menütexte neben den Symbolen. Der Zustand wird im Browser gemerkt (ui.js → Rail).
 * ---------------------------------------------------------------------------------------- */
.app.rail-open { --rail: 220px; }
.rail-btn .rail-label { display: none; }
.rail-toggle { color: #7B8494; }
.app.rail-open .rail { align-items: stretch; padding: 12px 10px; }
.app.rail-open .rail-btn { width: auto; display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 0 11px; }
.app.rail-open .rail-btn .rail-label { display: inline; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.rail-open .rail-btn .tip { display: none; }
.app.rail-open .rail .logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; padding: 0 4px; text-decoration: none; }
.rail .logo .rail-label { display: none; }
.app.rail-open .rail .logo .rail-label { display: inline; }
.rail-section { display: none; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #6B7482; padding: 10px 11px 4px; }
.app.rail-open .rail-section { display: block; }

/* ------------------------------------------------------------------------------------------
 * 3c. Kompakte Mail-Listen für tausende Einträge
 * Gedanken dahinter:
 *   - Eine Zeile pro Mail (32 px), alles Wichtige in einer Zeile: Kategorie-Farbbalken, Zeit,
 *     Absender, Betreff, Score. Lange Texte werden mit „…“ gekürzt, der volle Text steht im Tooltip.
 *   - Ungelesene Mails fett, gelesene normal – wie in Outlook.
 *   - Aktionen erscheinen erst beim Darüberfahren (spart eine ganze Spalte).
 *   - Lesebereich rechts (wie Outlook): Klick auf eine Zeile zeigt Vorschau, Header und „Warum?“,
 *     ohne die Liste zu verlassen. Pfeiltasten bzw. j/k blättern durch die Liste.
 *   - Die Liste scrollt in sich, Spaltenköpfe und Tagesgruppen bleiben oben stehen.
 *   - Seitenweise Anzeige (50/100/250) – der Server liefert nie tausende Zeilen auf einmal.
 *   - Umschalter „Kompakt / Komfort“ für alle, denen 32 px zu eng sind.
 * ---------------------------------------------------------------------------------------- */
.mail-split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.mail-split.no-pane { grid-template-columns: minmax(0, 1fr); }
.list-scroll { max-height: calc(100vh - 290px); min-height: 320px; overflow: auto; }
table.mails { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; table-layout: fixed; }
table.mails th {
  position: sticky; top: 0; z-index: 3; background: #FAFBFC; text-align: left; font-weight: 500;
  color: var(--text-2); font-size: 11.5px; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.mails td { padding: 0 8px; height: 32px; border-bottom: 1px solid #EEF0F3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.density-comfort table.mails td { height: 44px; }
table.mails tr.grp td {
  position: sticky; top: 30px; z-index: 2; height: 24px; background: var(--ground); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; border-bottom: 1px solid var(--line);
}
table.mails tbody tr.m { cursor: pointer; }
table.mails tbody tr.m:hover td { background: #F7F8FA; }
table.mails tbody tr.m.active td { background: var(--accent-light); }
table.mails tbody tr.m.selected td { background: #FEF3E7; }
table.mails tr.m.unseen .c-from, table.mails tr.m.unseen .c-subj { font-weight: 600; color: var(--text); }
table.mails tr.m .c-from { color: var(--text); }
table.mails tr.m .c-subj { color: var(--text); }
table.mails tr.m:not(.unseen) .c-from, table.mails tr.m:not(.unseen) .c-subj { color: #3F4855; }
table.mails .c-chk { width: 34px; }
table.mails .c-cat { width: 12px; padding: 0 0 0 6px; }
table.mails .c-time { width: 58px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
table.mails .c-from { width: 170px; }
table.mails .c-to { width: 160px; color: var(--text-2); }
table.mails .c-score { width: 64px; text-align: right; font-family: var(--mono); font-size: 12px; }
table.mails .c-status { width: 118px; }
table.mails .c-act { width: 66px; text-align: right; }
table.mails .c-node { width: 92px; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
/* Kategorie als schmaler Farbbalken statt breiter Pille */
.catbar { display: inline-block; width: 4px; height: 18px; border-radius: 2px; vertical-align: middle; background: #CBD1DA; }
.catbar.spam { background: var(--quar); }
.catbar.newsletter { background: var(--grey); }
.catbar.virus { background: var(--virus); }
.catbar.dangerous { background: var(--reject); }
.catbar.policy { background: var(--ink); }
.catbar.ok { background: var(--ok); }
/* Score als kleine Zahl mit Farbe */
.sc { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--ground); }
.sc.mid { background: var(--quar-bg); color: var(--quar-dark); }
.sc.high { background: var(--reject-bg); color: var(--reject); }
.sc.low { background: var(--ok-bg); color: var(--ok); }
/* Aktionen nur beim Darüberfahren bzw. in der aktiven Zeile */
.row-act { visibility: hidden; display: inline-flex; gap: 2px; }
tr.m:hover .row-act, tr.m.active .row-act { visibility: visible; }
.icon-btn { width: 26px; height: 24px; border: 1px solid transparent; border-radius: 4px; background: none; display: inline-grid; place-items: center; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }
/* Kleine Statuspille in dichten Listen */
table.mails .pill { padding: 2px 7px; font-size: 11.5px; }
/* Seitenleiste unten an der Liste */
.pager { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.pager .grow { flex: 1; }
.pager select { width: auto; padding: 3px 6px; font-size: 12.5px; }
/* Lesebereich rechts */
.reading { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; }
.reading .r-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.reading .r-head h2 { font-size: 15px; line-height: 1.35; }
.reading .r-meta { display: grid; grid-template-columns: 64px 1fr; gap: 3px 8px; font-size: 12.5px; margin-top: 8px; }
.reading .r-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.reading .tabs { margin: 0; padding: 0 10px; }
.reading .r-body { padding: 14px 16px; }
.reading pre.headers { font-size: 11.5px; max-height: 420px; }
.reading .empty { padding: 40px 20px; text-align: center; color: var(--text-2); }
.kbd-hint { font-size: 11.5px; color: var(--text-2); }
@media (max-width: 1640px) {
  table.mails .c-to { display: none; }
}
@media (max-width: 1250px) {
  .mail-split { grid-template-columns: minmax(0, 1fr); }
  .reading { position: static; max-height: none; }
  table.mails .c-to, table.mails .c-node { display: none; }
}

/* ------------------------------------------------------------------------------------------
 * 4. Sonderseiten
 * ---------------------------------------------------------------------------------------- */

/* Anmeldung: zweigeteilt – links Marke, rechts Formular */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); }
.auth-brand { background: var(--ink); color: #E5E9EF; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand h1 { font-size: 30px; color: #fff; margin-top: 64px; line-height: 1.2; }
.auth-brand p { color: #A7B0BE; max-width: 440px; font-size: 15px; }
.auth-brand .facts { display: flex; gap: 28px; margin-top: 32px; }
.auth-brand .facts b { display: block; color: #fff; font-size: 22px; font-weight: 600; }
.auth-brand .facts span { font-size: 12.5px; color: #A7B0BE; }
.auth-brand .glow { position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(194, 65, 12, .35), transparent 70%); }
.auth-form { background: var(--surface); padding: 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-form .box { width: 100%; max-width: 360px; margin: 0 auto; }
.auth-form h2 { font-size: 22px; margin-bottom: 6px; }
.auth-form .sub { color: var(--text-2); margin: 0 0 24px; }
.auth-form .btn.primary { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }
.otp { display: flex; gap: 8px; margin: 8px 0 18px; }
.otp input { width: 46px; text-align: center; font-family: var(--mono); font-size: 20px; padding: 10px 0; }
.hidden-lg { display: none !important; }   /* nur in der Handy-Ansicht sichtbar, siehe Abschnitt 5 */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; color: #fff; letter-spacing: -.01em; }
.brand small { font-weight: 400; color: #A7B0BE; font-size: 12px; display: block; letter-spacing: 0; }
.logo-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 20px; height: 20px; color: #fff; }

/* Startseite des Prototyps */
.hub { max-width: 1100px; margin: 0 auto; padding: 48px 24px; }
.hub-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.hub-head .brand { color: var(--text); font-size: 24px; }
.hub-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 28px; }
.hub-tile { display: block; color: inherit; padding: 20px; }
.hub-tile:hover { text-decoration: none; border-color: var(--accent-border); }
.hub-tile .ico { width: 40px; height: 40px; border-radius: 9px; background: var(--accent-light); color: var(--accent); display: grid; place-items: center; margin-bottom: 12px; }
.hub-tile .ico svg { width: 20px; height: 20px; }
.hub-tile h2 { margin-bottom: 6px; }
.hub-tile p { color: var(--text-2); margin: 0; font-size: 13.5px; }

/* ------------------------------------------------------------------------------------------
 * 5. Handy-Ansicht
 * Unter 900 px wird die Icon-Leiste zur Leiste am unteren Rand (wie eine App),
 * Raster werden einspaltig. Seitenränder 16 px.
 * ---------------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: 60px; width: 100%;
    flex-direction: row; justify-content: space-around; padding: 0 6px; z-index: 40; overflow-x: auto;
  }
  .rail .logo, .rail .spacer, .rail-toggle, .rail-section { display: none !important; }
  .rail-btn .tip, .app.rail-open .rail-btn .rail-label { display: none; }
  .app.rail-open .rail { padding: 0 6px; }
  .app.rail-open .rail-btn { width: 44px; padding: 0; justify-content: center; }
  .list-scroll { max-height: none; }
  table.mails .c-from { width: 110px; }
  table.mails .c-score, table.mails .c-act, table.mails .c-status { display: none; }
  .main { padding-bottom: 64px; }
  .topbar { padding: 0 16px; }
  .topbar .search { display: none; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .hidden-lg { display: flex !important; }
  .auth-form { padding: 32px 16px; }
  .toolbar input[type=search] { width: 100%; }
  .setting { grid-template-columns: 1fr; }
  .setting .ctl { justify-content: flex-start; }
  .hide-sm { display: none; }
  .subject { max-width: 200px; }
  .funnel .stage { grid-template-columns: 100px 1fr 54px; }
}
