/* Büro-Cockpit – mobil zuerst, hell/dunkel. Eigenes Branding (Cockpit-Blau + Signal-Amber). */
:root {
  --bg: #F3F5F8; --surface: #FFFFFF; --surface-2: #F7F9FB; --line: #E1E6EC; --text: #0F1A24; --muted: #5B6875;
  --accent: #1F6FD1; --accent-ink: #FFFFFF; --accent-tint: #E5F0FD; --amber: #B26A00; --amber-tint: #FFF3DC;
  --danger: #B3261E; --danger-tint: #FBEAE8; --ok: #2E7D32; --ok-tint: #E6F4E7;
  --hero: #0F1419; --hero-text: #F4F7FA; --hero-muted: #A9B4BF;
  --f-visiontrend: #7B4FD6; --f-arve: #0E8A8A; --f-esave: #5E8C12; --f-calandaair: #1E7FC2; --f-ohne: #6B7280;
  --radius: 16px; --shadow: 0 1px 2px rgba(15, 26, 36, .06), 0 4px 16px rgba(15, 26, 36, .05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="hell"]) {
    --bg: #0F1419; --surface: #1A2129; --surface-2: #212A34; --line: #2C3742; --text: #EEF2F6; --muted: #9AA7B4;
    --accent: #5AA9FF; --accent-ink: #0B1520; --accent-tint: #16304D; --amber: #F5B547; --amber-tint: #3A2E14;
    --danger: #FF8A80; --danger-tint: #3D1C1A; --ok: #7BD389; --ok-tint: #19331D; --hero: #151C24;
    --f-visiontrend: #B39DFF; --f-arve: #4FD1C5; --f-esave: #8CC63F; --f-calandaair: #6CB8F0; --f-ohne: #9AA3AF;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dunkel"] {
  --bg: #0F1419; --surface: #1A2129; --surface-2: #212A34; --line: #2C3742; --text: #EEF2F6; --muted: #9AA7B4;
  --accent: #5AA9FF; --accent-ink: #0B1520; --accent-tint: #16304D; --amber: #F5B547; --amber-tint: #3A2E14;
  --danger: #FF8A80; --danger-tint: #3D1C1A; --ok: #7BD389; --ok-tint: #19331D; --hero: #151C24;
  --f-visiontrend: #B39DFF; --f-arve: #4FD1C5; --f-esave: #8CC63F; --f-calandaair: #6CB8F0; --f-ohne: #9AA3AF;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.laden { padding: 40vh 24px; text-align: center; color: var(--muted); }

/* Kopf */
.kopf { background: var(--hero); color: var(--hero-text); padding: calc(env(safe-area-inset-top) + 14px) 18px 14px; position: sticky; top: 0; z-index: 5; }
.kopf-zeile { display: flex; align-items: center; gap: 12px; }
.kopf img { width: 34px; height: 34px; border-radius: 9px; }
.kopf h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.kopf .unter { font-size: 13px; color: var(--hero-muted); }
.kopf .rechts { margin-left: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.18); background: transparent; color: var(--hero-text); padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 34px; }
.chip[aria-pressed="true"] { background: var(--hero-text); color: var(--hero); border-color: var(--hero-text); }
.chip .punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* Layout */
.rahmen { display: block; }
main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }
.navi { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.navi a { flex: 1; text-align: center; padding: 8px 2px 7px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.navi a svg { display: block; margin: 0 auto 2px; width: 24px; height: 24px; }
.navi a[aria-current="page"] { color: var(--accent); }
.navi .zahl { position: absolute; top: 3px; left: 50%; margin-left: 6px; background: var(--danger); color: #fff; font-size: 10px; border-radius: 999px; padding: 0 5px; min-width: 16px; line-height: 16px; }
@media (min-width: 900px) {
  .rahmen { display: grid; grid-template-columns: 220px 1fr; }
  .navi { position: sticky; top: 0; height: 100vh; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 16px 10px; gap: 4px; }
  .navi a { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; text-align: left; font-size: 15px; padding: 10px 12px; border-radius: 10px; }
  .navi a svg { margin: 0; }
  .navi a[aria-current="page"] { background: var(--accent-tint); }
  .navi .zahl { position: static; margin-left: auto; }
  main { padding: 24px 32px 48px; margin: 0; }
  .kopf { padding: 16px 32px 14px; }
  .rahmen { background: linear-gradient(to right, var(--surface) 219px, var(--line) 219px, var(--line) 220px, transparent 220px); min-height: 100vh; }
  .spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
}

/* Kacheln und Karten */
.gruss { margin: 4px 2px 14px; }
.gruss h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.gruss p { margin: 2px 0 0; color: var(--muted); }
.kacheln { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 640px) { .kacheln { grid-template-columns: repeat(4, 1fr); } }
.kachel { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); text-decoration: none; color: inherit; display: block; }
.kachel b { display: block; font-size: 28px; line-height: 1.1; letter-spacing: -.02em; }
.kachel span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kachel.gefragt b { color: var(--amber); }
.kachel.dringend b { color: var(--danger); }
.abschnitt { margin: 18px 2px 8px; display: flex; align-items: baseline; gap: 8px; }
.abschnitt h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.abschnitt .anz { font-size: 12px; color: var(--muted); }
.karte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; }
a.karte { display: block; text-decoration: none; color: inherit; }
.karte .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.karte .titel { font-weight: 650; font-size: 16px; margin: 0 0 4px; overflow-wrap: anywhere; }
.karte .text { margin: 0; color: var(--text); opacity: .9; font-size: 15px; overflow-wrap: anywhere; }
.karte .zeit { margin-left: auto; }
.leer { color: var(--muted); padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.firma { color: #fff; border: 0; }
.badge.f-visiontrend { background: var(--f-visiontrend); } .badge.f-arve { background: var(--f-arve); } .badge.f-esave { background: var(--f-esave); } .badge.f-calandaair { background: var(--f-calandaair); } .badge.f-ohne { background: var(--f-ohne); }
:root[data-theme="dunkel"] .badge.firma { color: #0B1520; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="hell"]) .badge.firma { color: #0B1520; } }
.badge.gefragt { background: var(--amber-tint); color: var(--amber); border-color: transparent; }
.badge.dringend { background: var(--danger-tint); color: var(--danger); border-color: transparent; }
.badge.ok { background: var(--ok-tint); color: var(--ok); border-color: transparent; }
.badge.blau { background: var(--accent-tint); color: var(--accent); border-color: transparent; }
.beispiel { background: var(--amber-tint); color: var(--amber); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }

/* Aufgabenliste */
.zeile { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.zeile:first-child { border-top: 0; }
a.zeile.link { text-decoration: none; color: inherit; align-items: center; }
a.zeile.link .klein { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
.zeile input[type="checkbox"] { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.zeile .inhalt { flex: 1; min-width: 0; }
.zeile .klein { font-size: 13px; color: var(--muted); }
.zeile.erledigt .inhalt > div:first-child { text-decoration: line-through; color: var(--muted); }
.ueberfaellig { color: var(--danger); font-weight: 700; }

/* Formulare und Knöpfe */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 650; cursor: pointer; text-decoration: none; }
.knopf.primaer { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.knopf.gefahr { color: var(--danger); }
.knopf.klein { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.knopf[disabled] { opacity: .5; cursor: default; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.feld { display: block; margin: 0 0 14px; }
.feld span { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.feld input, .feld textarea, .feld select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 16px; }
.feld textarea { min-height: 180px; resize: vertical; line-height: 1.5; }
.feld input:focus, .feld textarea:focus, .knopf:focus-visible, .chip:focus-visible, .navi a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.segment { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.segment button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 650; font-size: 14px; color: var(--muted); cursor: pointer; }
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.hinweis { font-size: 13px; color: var(--muted); }
.fehler { background: var(--danger-tint); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.erfolg { background: var(--ok-tint); color: var(--ok); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); padding: 10px; border-radius: 10px; user-select: all; }
dl.daten { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
dl.daten dt { color: var(--muted); }
dl.daten dd { margin: 0; overflow-wrap: anywhere; }
.zurueck { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; font-weight: 650; text-decoration: none; }
.verlauf { font-size: 13px; color: var(--muted); margin: 0; padding-left: 18px; }

/* Anmeldung */
.anmeldung { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--hero); }
.anmeldung .box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 22px; padding: 28px 22px; }
.anmeldung .marke { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.anmeldung .marke img { width: 52px; height: 52px; border-radius: 14px; }
.anmeldung h1 { margin: 0; font-size: 22px; }
.anmeldung .knopf { width: 100%; }
.trenner { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0; }

/* Dialog */
.schleier { position: fixed; inset: 0; background: rgba(5, 10, 15, .55); display: grid; place-items: end center; z-index: 20; padding: 0; }
@media (min-width: 640px) { .schleier { place-items: center; padding: 24px; } }
.dialog { background: var(--surface); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
@media (min-width: 640px) { .dialog { border-radius: 22px; } }
.dialog h2 { margin: 0 0 8px; font-size: 20px; }
.vorschau { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 15px; max-height: 40vh; overflow: auto; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 30; max-width: 90vw; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.versteckt { display: none !important; }

/* 0.4.4: Kategorien-Chips wie Apple Mail (Icon + Badge; gewählter Chip mit Namen, am Desktop alle mit Namen) */
.katleiste { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.segzeile { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.segzeile > .knopf { margin: 3px 0 12px auto; }
.katchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; padding: 6px 6px 4px 0; -webkit-overflow-scrolling: touch; }
.katchips::-webkit-scrollbar { display: none; }
.katchip { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; min-width: 48px; justify-content: center; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 650; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); }
.katchip svg { width: 20px; height: 20px; flex: 0 0 auto; }
.katchip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.katchip[data-kat="persoenlich"][aria-pressed="true"] { background: var(--accent); }
.katchip[data-kat="einkaeufe"][aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.katchip[data-kat="mitteilungen"][aria-pressed="true"] { background: #6E56CF; border-color: #6E56CF; color: #fff; }
.katchip[data-kat="werbung"][aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #fff; }
.katchip[data-kat="alle"][aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.katchip .katname { display: none; }
.katchip[aria-pressed="true"] .katname, .katchip .katname.immer { display: inline; }
.katchip .katzahl { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 750; line-height: 18px; text-align: center; }
.katchip[aria-pressed="true"] .katzahl { background: rgba(255,255,255,.28); }
.katchips.klein { flex-wrap: wrap; overflow: visible; }
.katchips.klein .katchip { min-height: 36px; font-size: 13.5px; padding: 5px 12px; }
.badge.kat { background: var(--accent-tint); color: var(--accent); border-color: transparent; }
.titel .ungelesen { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 2px; }
@media (max-width: 759px) {
  .katchips:not(.klein) .katchip:not([aria-pressed="true"]) { padding: 6px 12px; }
  .katchips:not(.klein) .katchip:not([aria-pressed="true"]) .katzahl { position: absolute; top: -4px; right: -4px; box-shadow: 0 0 0 2px var(--bg); }
}
@media (min-width: 760px) { .katchip .katname { display: inline; } }

/* 0.4.5: Kategorien im fixierten Kopf (Apple-Vorbild: Kategorien zuerst), Postfach als Auswahl */
.kopf.mit-kategorien .unter { display: none; }
.kopf.mit-kategorien .katchips { padding: 12px 6px 2px 0; }
.kopf .katchip { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.14); color: var(--hero-text); box-shadow: none; }
.kopf .katchip[aria-pressed="true"], .kopf .katchip[data-kat][aria-pressed="true"] { background: var(--hero-text); border-color: var(--hero-text); color: var(--hero); }
.kopf .katchip .katzahl { box-shadow: 0 0 0 2px var(--hero); }
.kopf .katchip[aria-pressed="true"] .katzahl { background: var(--danger); color: #fff; box-shadow: none; }
.firmawahl { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 7px 10px; font-size: 14px; font-weight: 600; min-height: 38px; max-width: 46vw; }
/* Listenvorschau max. 3 Zeilen, Absendername */
.karte .vorschau3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 14.5px; line-height: 1.4; }
.karte .absender { font-weight: 600; color: var(--text); }
/* Mailtext: lesbare Absätze, Links als Domain */
.mailtext { font-size: 15.5px; line-height: 1.55; overflow-wrap: anywhere; }
.mailtext p { margin: 0 0 .8em; white-space: pre-line; }
.mailtext a.mlink { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-tint); border-radius: 999px; padding: 0 8px; text-decoration: none; margin: 1px 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: baseline; }
/* Spam-Prüfung */
.badge.warn { background: var(--amber-tint); color: var(--amber); border-color: transparent; }
.badge.phishing { background: var(--danger); color: #fff; border-color: transparent; }
.abschnitt .anz.warn { color: var(--amber); font-weight: 700; } .abschnitt .anz.rot { color: var(--danger); font-weight: 700; }
.phishing-warnung { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.phishing-warnung .titel { color: var(--danger); font-size: 17px; }
.phishing-warnung p { margin: 0 0 4px; }
ul.gruende { margin: 6px 0 8px; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
ul.gruende li.rot { color: var(--danger); } ul.gruende li.minus { color: var(--ok); }
/* Neue Version */
.neue-version { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 78px); z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--hero); color: var(--hero-text); border-radius: 14px; padding: 10px 12px 10px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-weight: 600; }
@media (min-width: 760px) { .neue-version { left: auto; right: 24px; bottom: 24px; max-width: 420px; } }
