/* Farben im Stil von MailDuett (Verwaltung, Mails, Bestätigungsseite): Primär #1F4E79, Text #1C2430, Gold #F5A623 (marketing/brand/tokens.css), graue Fläche mit weißen Karten. */
:root {
  --page: #f6f8fb;
  --bg: #ffffff;
  --fg: #1c2430;
  --muted: #4f5b6b;
  --card: #f9fafb;
  --line: #d7dde5;
  --accent: #1f4e79;
  --accent-fg: #ffffff;
  --gold: #f5a623;
  --hover: #fdf1dc;
  --ok: #1b6e3a;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4a00;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #12151a;
    --bg: #1b1f24;
    --fg: #e6eaee;
    --muted: #9aa5b1;
    --card: #222830;
    --line: #2f363e;
    --accent: #7fb0e0;
    --accent-fg: #0e2236;
    --hover: #2a2620;
    --ok: #6fcf97;
    --warn-bg: #4a3b12;
    --warn-fg: #ffe2a0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 12px 24px;
  background: var(--page);
  color: var(--fg);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

h1 { font-size: 18px; margin: 0 0 2px; }
h2 { font-size: 13px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
h3 { font-size: 12px; margin: 12px 0 2px; padding-top: 8px; border-top: 1px solid var(--line, #e5e7eb); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 4px 0 8px; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 13px; }
.version { font-size: 11px; margin-top: 16px; text-align: right; }
.strong { font-weight: 600; }
.ok { color: var(--ok); }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 10px 0; }
.box.warn { background: var(--warn-bg); color: var(--warn-fg); border-radius: 6px; padding: 8px 10px; }

label { display: block; margin: 8px 0 3px; font-size: 13px; }
label.check { display: flex; gap: 6px; align-items: center; margin: 8px 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input[type="text"], input[type="search"], input[type="date"], input[type="time"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.row { display: flex; gap: 6px; }
.row input { flex: 1; min-width: 0; }

button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--gold); background: var(--hover); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: default; }
button.primary { width: 100%; margin-top: 6px; padding: 8px 12px; background: var(--accent); border-color: var(--accent); border-left: 4px solid var(--gold); color: var(--accent-fg); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); border-left-color: var(--gold); filter: brightness(1.15); }
button.link, button.link:hover:not(:disabled) { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-decoration-color: var(--gold); }
button.choice { display: block; width: 100%; margin: 4px 0; text-align: left; overflow-wrap: anywhere; }

.tabs { display: flex; gap: 6px; margin: 10px 0; }
.tab { flex: 1; }
.tab.active, .tab.active:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); border-bottom: 3px solid var(--gold); color: var(--accent-fg); font-weight: 600; }
.results { margin-top: 6px; }
/* Lange Liste (alle verbundenen Firmen): eigener Rollbereich, damit die Seitenleiste darunter erreichbar bleibt. */
.results.scroll { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.block { display: block; }

/* Reiter innerhalb einer Karte (Ticket | Zuweisung | Termin): flach, damit die Seitenleiste niedrig bleibt. */
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -2px 0 6px; }
.subtab, .subtab:hover:not(:disabled) { flex: 1; padding: 5px 6px; border: 0; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; background: none; font-size: 13px; }
.subtab:hover:not(:disabled) { border-bottom-color: var(--line); }
.subtab.active, .subtab.active:hover:not(:disabled) { border-bottom: 3px solid var(--gold); color: var(--fg); font-weight: 600; }

main { max-width: 640px; }

button.choice.chosen { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold); font-weight: 600; }
summary { cursor: pointer; margin: 8px 0 4px; color: var(--fg); font-weight: 600; }
summary::marker { color: var(--gold); }

textarea, select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
textarea { resize: vertical; min-height: 6em; }
/* Die Auswahlliste öffnet der Browser als eigenes Fenster. Ohne eigene Farben (und ohne color-scheme) kann sie in Outlook für Windows hell auf hell
   erscheinen und wirkt dann leer; Outlook im Web zeigt es richtig. */
select option { background-color: var(--bg); color: var(--fg); }

/* Auswahlliste, die in der Seitenleiste aufklappt (siehe dropdown() in main.js): nur Knöpfe, kein Browser-Fenster. */
.dropdown button.toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; padding: 6px 8px; }
.listbox { margin-top: 2px; max-height: 190px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.listbox button.option { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; overflow-wrap: anywhere; }
.listbox button.option:last-child { border-bottom: 0; }
.listbox button.option.active { background: var(--card); }
.listbox input.filter { border: 0; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; position: sticky; top: 0; }
.listbox p { margin: 0; padding: 6px 8px; }
.listbox button.option.chosen { font-weight: 600; box-shadow: inset 4px 0 0 var(--gold); }

.appointment { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 4px; }
.appointment .row { align-items: flex-end; }
.appointment .row > div { flex: 1; min-width: 0; }

/* Kopf der Seitenleiste wie Verwaltung und Mail: Logo, Name, goldene Linie; reicht über die ganze Breite. */
header.brand { display: flex; align-items: center; gap: 10px; margin: 0 -12px 10px; padding: 10px 12px; background: var(--bg); border-bottom: 3px solid var(--gold); }
header.brand img { width: 32px; height: 32px; flex: none; display: block; }
header.brand h1 { font-size: 17px; margin: 0; line-height: 1.2; }
header.brand p { margin: 0; font-size: 12px; }
/* Termine entscheiden in der Seitenleiste (Benachrichtigung geöffnet): dieselbe Liste wie auf der Bestätigungsseite, schmal gesetzt. */
.rv-embed .rv-list { list-style: none; margin: 0; padding: 0; }
.rv-embed .rv-item { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.rv-embed .rv-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.rv-embed button.seg { padding: 5px 9px; font-size: 13px; }
.rv-embed button.seg.active, .rv-embed button.seg.active:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; box-shadow: inset 0 -3px 0 var(--gold); }
.rv-embed .rv-place-label { display: block; font-size: 12px; color: var(--muted); margin: 2px 0 3px; }
.rv-embed .rv-search input { width: 100%; }
.rv-embed .rv-question { margin: 0 0 6px; }
.rv-embed .rv-done { border-left: 4px solid var(--ok); padding: 4px 8px; margin: 0; }
.rv-embed .rv-submit { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 2px; border-top: 1px solid var(--line); }
/* Terminpflege: nur ein Symbol oben rechts, der Name steht im Hinweis beim Darüberfahren. */
header.brand .icon-button { margin-left: auto; flex: none; width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--accent); }
header.brand .icon-button:disabled { opacity: .5; cursor: progress; }
.box.ok-box { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 6px; padding: 8px 10px; }
.box.closable { position: relative; padding-right: 28px; }
.box button.close { position: absolute; top: 4px; right: 8px; text-decoration: none; font-size: 16px; line-height: 1; }
.env { margin: -10px -12px 10px; padding: 5px 12px; background: var(--warn-bg); color: var(--warn-fg); font-size: 12px; font-weight: 600; }

/* Hilfe- und Startseite (ohne Kopf der Seitenleiste): etwas Abstand nach oben. */
main:not(#app) { padding-top: 12px; }
/* Menü am Kalender-Symbol: unter der Kopfzeile rechtsbündig, Einträge untereinander. */
header.brand .icon-button.open { border-color: var(--gold); background: var(--hover); }
.menu-panel { margin: -6px 0 10px; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 6px; background: var(--bg); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.menu-panel .menu-item { display: grid; gap: 2px; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 0; background: none; }
.menu-panel .menu-item + .menu-item { border-top: 1px solid var(--line); }
.menu-panel button.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-panel .menu-switch { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; cursor: pointer; }
.menu-panel .menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.menu-panel .menu-item.disabled strong { color: var(--muted); }
button.small { padding: 4px 10px; font-size: 13px; width: auto; margin: 0; }
/* Schiebeschalter (role="switch") */
button.toggle { position: relative; flex: none; width: 40px; height: 22px; padding: 0; border-radius: 11px; border: 1px solid var(--line); background: var(--line); }
button.toggle .knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
button.toggle.on { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--gold); }
button.toggle.on .knob { left: 20px; }
button.toggle:hover:not(:disabled) { border-color: var(--gold); }
button.toggle.on:hover:not(:disabled) { background: var(--accent); }
button.toggle:disabled { opacity: .5; cursor: not-allowed; }
/* Hinweis am Kalender-Symbol: sofort beim Darüberfahren (statt des verzögerten Browser-Tooltips) */
header.brand { position: relative; }
header.brand .icon-button[data-tip]:hover::after, header.brand .icon-button[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; white-space: nowrap;
  padding: 4px 8px; border-radius: 4px; background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 400; pointer-events: none;
}
/* Neue Version verfügbar (Seite älter als die Schnittstelle) */
.box.update-box { background: var(--bg); border: 1px solid var(--gold); border-left: 4px solid var(--gold); border-radius: 6px; padding: 8px 10px; }
.box.update-box button { margin-left: 4px; }
/* „Was ist neu?“: Hinweis „Neu“ in der Kopfzeile (nur wo Platz ist) und die Karte darunter */
header.brand .news-pill { flex: none; margin-left: auto; padding: 2px 10px; border-radius: 999px; border: 0; background: var(--gold); color: #1c2430; font-size: 12px; font-weight: 700; }
header.brand .news-pill + .icon-button { margin-left: 6px; }
header.brand .news-pill:hover:not(:disabled) { filter: brightness(1.08); background: var(--gold); }
@media (max-width: 340px) { header.brand .news-pill { display: none; } header.brand .news-pill + .icon-button { margin-left: auto; } }
.news-panel .news-entry { margin: 6px 0 2px; }
.news-panel .news-title { font-weight: 600; }
.news-panel ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.news-panel li { margin: 2px 0; }
