:root {
  --bg: #ffffff;
  --fg: #1f2933;
  --muted: #5f6b7a;
  --card: #f4f6f8;
  --line: #d5dbe1;
  --accent: #1f4e79;
  --accent-fg: #ffffff;
  --ok: #1b6e3a;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4a00;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1f24;
    --fg: #e6eaee;
    --muted: #9aa5b1;
    --card: #252b32;
    --line: #3a424b;
    --accent: #5b9bd5;
    --accent-fg: #0f1720;
    --ok: #6fcf97;
    --warn-bg: #4a3b12;
    --warn-fg: #ffe2a0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 12px 16px 24px;
  background: var(--bg);
  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); }
p { margin: 4px 0 8px; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 13px; }
.strong { font-weight: 600; }
.ok { color: var(--ok); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; 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="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:disabled { opacity: .5; cursor: default; }
button.primary { width: 100%; margin-top: 6px; background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }
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 { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.results { margin-top: 6px; }

/* 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 { flex: 1; padding: 5px 6px; border: 0; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; background: none; font-size: 13px; }
.subtab.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

main { max-width: 640px; }

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

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 3px 0 0 var(--accent); }

.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; }
