/* yaDMS – Erscheinungsbild. Farben und Masse als Variablen; hell und dunkel aus denselben Regeln.
   Aufbau: 1 Farben · 2 Grundlagen · 3 Gerüst · 4 Bausteine von yaDMS · 5 Formulare und Tabellen
           6 Seiten der Plattform (Anmeldung, Konto, Verwaltung) · 7 Befehlszeile und Hinweise · 8 Schmale Bildschirme */

/* ------------------------------------------------------------------ 1 Farben */
:root {
  --bg: #f5f4f0; --surface: #ffffff; --surface-2: #efede7; --line: #e2dfd6; --line-strong: #cfcbc0;
  --text: #1b1a18; --muted: #6a675f; --faint: #8f8b82;
  --accent: #0b6e75; --accent-ink: #ffffff; --accent-soft: #dff0f0; --accent-text: #095a60;
  --warn: #9a5200; --warn-soft: #fcefd9; --ok: #1c6f38; --ok-soft: #e2f2e6; --bad: #a8261f; --bad-soft: #fbe5e3;
  --ki: #5440c0; --ki-soft: #eeebfb; --ki-line: #b9aef0;
  --plate-bg: #ffffff; --plate-text: #111111; --plate-line: #1b1a18;
  --shadow: 0 1px 2px rgba(20, 18, 10, .06), 0 8px 24px rgba(20, 18, 10, .08);
  --radius: 10px; --radius-s: 6px; --top: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312; --surface: #1c1c1a; --surface-2: #262522; --line: #32312d; --line-strong: #47453f;
    --text: #edebe5; --muted: #a39f95; --faint: #7d7a72;
    --accent: #4dbec6; --accent-ink: #05292c; --accent-soft: #123538; --accent-text: #7fd6dc;
    --warn: #f0b35a; --warn-soft: #382910; --ok: #74d093; --ok-soft: #142f1d; --bad: #f29088; --bad-soft: #3a1b18;
    --ki: #ab9df6; --ki-soft: #25203d; --ki-line: #5a4fa5;
    --plate-bg: #f1efe9; --plate-text: #111111; --plate-line: #f1efe9;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131312; --surface: #1c1c1a; --surface-2: #262522; --line: #32312d; --line-strong: #47453f;
  --text: #edebe5; --muted: #a39f95; --faint: #7d7a72;
  --accent: #4dbec6; --accent-ink: #05292c; --accent-soft: #123538; --accent-text: #7fd6dc;
  --warn: #f0b35a; --warn-soft: #382910; --ok: #74d093; --ok-soft: #142f1d; --bad: #f29088; --bad-soft: #3a1b18;
  --ki: #ab9df6; --ki-soft: #25203d; --ki-line: #5a4fa5;
  --plate-bg: #f1efe9; --plate-text: #111111; --plate-line: #f1efe9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ 2 Grundlagen */
* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 1rem; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1 { font-size: 1.6rem; font-weight: 680; letter-spacing: -.015em; margin-bottom: 18px; text-wrap: balance; }
h2 { font-size: .8rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
h3 { font-size: 1rem; font-weight: 650; margin-bottom: 6px; }
p { margin-bottom: 10px; }
p:last-child, p:empty { margin-bottom: 0; }
p:empty { display: none; }
main a { color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-text) 35%, transparent); text-underline-offset: 2px; }
main a:hover { text-decoration-color: currentColor; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.table th.num, .table td.num { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.nowrap { white-space: nowrap; }
.pre-line { white-space: pre-line; }
.mt { margin-top: 20px; }
.narrow { max-width: 40rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 600 .72rem var(--font); padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--surface); }

/* ------------------------------------------------------------------ 3 Gerüst */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; align-items: center; gap: 16px;
       height: var(--top); padding: 0 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; min-width: 0; }
.brand-mark { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 6px 6px 6px 9px; border-left: 3px solid var(--accent-ink); border-radius: 1px; }
.brand small { font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px; height: 36px; margin: 0 auto; padding: 0 10px 0 12px;
       border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--muted); text-align: left; }
.ask:hover { border-color: var(--accent); }
.ask span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 8px; justify-self: end; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); }
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
.place { font-size: .87rem; color: var(--muted); white-space: nowrap; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.usermenu summary::-webkit-details-marker { display: none; }
.user-chip, .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: .8rem; }
.usermenu-panel { position: absolute; right: 0; top: 40px; z-index: 30; min-width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); }
.usermenu-panel a, .usermenu-panel button { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px; background: none; text-align: left; color: var(--text); }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-2); }
.usermenu-panel form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.usermenu-name { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-weight: 650; }
.usermenu-name span { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; }
.usermenu-place span { display: block; padding: 4px 10px 2px; font-size: .8rem; color: var(--muted); }
.usermenu-place button[aria-current="true"] { font-weight: 650; background: var(--surface-2); }
.usermenu-langs { display: flex; gap: 4px; padding: 6px 6px 2px; margin-top: 4px; border-top: 1px solid var(--line); }
.usermenu-langs a, .usermenu-langs b { width: auto; padding: 3px 8px; border-radius: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.usermenu-langs b { background: var(--surface-2); color: var(--text); }

.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.side { padding: 18px 12px; border-right: 1px solid var(--line); position: sticky; top: calc(var(--top) + env(safe-area-inset-top, 0px)); height: calc(100vh - var(--top)); overflow: auto; }
.side h2 { margin: 18px 8px 6px; }
.nav { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 7px; color: var(--muted); }
.nav:hover { background: var(--surface-2); color: var(--text); }
.nav[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.nav-badge, .nav-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: .7rem; font-weight: 700; }
.side-foot { margin: 22px 8px 0; font-size: .8rem; color: var(--faint); }
main { padding: 26px 30px 80px; max-width: 1260px; width: 100%; min-width: 0; container-type: inline-size; }

/* Ohne Anmeldung: eine ruhige Seite mit einer Karte in der Mitte */
.page-auth .shell, .page-plain .shell { display: block; }
.page-auth main, .page-plain main { max-width: none; display: grid; justify-items: center; align-content: start; padding-top: 7vh; }
.page-auth .top, .page-plain .top { grid-template-columns: minmax(0, 1fr) auto; }
.footer { padding: 18px 16px 30px; text-align: center; font-size: .8rem; color: var(--faint); }
.lang-switch { margin-left: 10px; white-space: nowrap; }
.lang-switch a, .lang-switch b { margin-right: 6px; }
.lang-switch a:hover { color: var(--text); text-decoration: underline; }

/* ------------------------------------------------------------------ 4 Bausteine von yaDMS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 5px 13px; border-radius: 8px; border: 1px solid var(--line-strong);
       background: var(--surface); color: var(--text); font-weight: 600; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: var(--text); }
.btn.primary, .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) !important; }
.btn.primary:hover, .btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn.quiet, .btn-ghost { border-color: transparent; background: transparent; color: var(--muted); font-weight: 500; }
.btn.quiet:hover, .btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn.danger, .btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line-strong)); }
.btn.danger:hover, .btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.small, .btn-sm { min-height: 28px; padding: 2px 10px; font-size: .86rem; }
.btn.big { min-height: 64px; padding: 0 26px; font-size: 1.15rem; border-radius: 14px; }
.btn.ki { border-color: var(--ki-line); color: var(--ki); }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok, .pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn, .pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad, .pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill.go { background: var(--accent-soft); color: var(--accent-text); }
.pill.ki { background: var(--ki-soft); color: var(--ki); }

/* Kontrollschild: das, was in der Werkstatt jeder zuerst sucht */
.plate.big { font-size: 1.05rem; padding: 2px 10px; vertical-align: 3px; }
.plate { display: inline-block; padding: 1px 7px; border: 1.5px solid var(--plate-line); border-radius: 4px; background: var(--plate-bg); color: var(--plate-text);
         font-weight: 700; font-size: .86rem; letter-spacing: .04em; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Karte: eine Fläche mit Rand. Die Seiten der Plattform füllen sie direkt (mit Innenabstand); Listen von yaDMS
   gehen bis an den Rand (.flush) und bringen Kopf und Zeilen mit. */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); container-type: inline-size; padding: 18px 20px; margin-bottom: 20px; }
/* Kein «overflow: hidden»: Vorschlagslisten von Auswahlfeldern ragen aus der Karte heraus. Die Ecken runden die Kinder. */
.card.flush { padding: 0; margin-bottom: 0; }
.card.flush > :first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.card.flush > :last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.panel.narrow { max-width: 640px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel h2 .btn-sm { float: right; font-weight: 500; text-transform: none; letter-spacing: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.card-body { padding: 14px 16px; }
.count { color: var(--faint); font-weight: 500; letter-spacing: 0; text-transform: none; margin-left: 6px; }
.stack { display: grid; gap: 22px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.empty { padding: 18px 16px; color: var(--faint); }
.empty-code { font-size: 4rem; font-weight: 800; color: var(--line-strong); line-height: 1; }

.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.hello h1 { margin-bottom: 0; }
.hello p { color: var(--muted); margin: 3px 0 0; }
.facts { display: flex; gap: 26px; }
.fact b { display: block; font-size: 1.5rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.fact span { font-size: .8rem; color: var(--muted); }

/* Zeile: eine Sache, ihr Stand, die nächste Handlung */
.row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.urgent { box-shadow: inset 3px 0 0 var(--warn); }
.row-main { min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.row-title .plate { flex: none; }
.row-title span.t, .row-title a.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title a.t { color: inherit; text-decoration: none; }
.row-title a.t:hover { text-decoration: underline; }
.row-sub { color: var(--muted); font-size: .87rem; overflow-wrap: anywhere; }
.row-state { min-width: 0; font-size: .87rem; color: var(--muted); }
.row-acts { display: flex; gap: 8px; justify-self: end; flex-wrap: wrap; }
.row-form, .row-wide { grid-column: 1 / -1; }
.row-more { padding: 12px 16px; border-top: 1px solid var(--line); margin: 0; }
details.row-more > summary, details.row-wide > summary, .card > details > summary { color: var(--accent-text); font-weight: 600; font-size: .93rem; }
details.row-more[open] > summary { margin-bottom: 12px; }
/* Kürzel eines Standorts oder einer Person */
.tag { display: inline-block; flex: none; padding: 0 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .78rem; letter-spacing: .04em; line-height: 1.6; }
.tag.big { font-size: 1rem; padding: 1px 9px; vertical-align: 3px; }
/* Hinweis, der eine Entscheidung braucht (mögliche Dublette) */
.card.hint { border-color: var(--warn); background: var(--warn-soft); }
fieldset.choice { display: flex; gap: 18px; border: 0; padding: 0; }
/* Anlegen: je nach Wahl «Person» oder «Firma» nur die passenden Felder (ohne Skript; ältere Browser zeigen alle) */
.form-grid:has(input[name="kind"][value="firma"]:checked) .nur-person, .form-grid:has(input[name="kind"][value="person"]:checked) .nur-firma { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 6px 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-weight: 600; }
.chip.off { color: var(--faint); border-style: dashed; font-weight: 500; }
.chip form { margin: 0; }
.chip button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--muted); line-height: 1; }
.chip button:hover { background: var(--surface-2); color: var(--text); }

/* Zeitstrahl: was geschehen ist, jüngstes zuerst – Notizen heben sich ab */
.time-wrap { padding: 14px 0 0 6px; }
.time-item { position: relative; padding: 0 0 14px 18px; border-left: 1.5px solid var(--line); }
.time-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.time-dot { position: absolute; left: -5.5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 3px var(--surface); }
.time-item.note .time-dot { background: var(--accent); }
.time-item b { font-weight: 600; }
.time-item b a { color: inherit; }
.time-item small { display: block; color: var(--faint); }
.time-item small form { margin-left: 6px; }

/* Vorschlag der KI: überall dieselbe Darstellung – gestrichelt, eigene Farbe, mit Übernehmen und Verwerfen (ab Etappe Y4) */
.vorschlag { border: 1.5px dashed var(--ki-line); background: var(--ki-soft); border-radius: var(--radius); padding: 13px 15px; }
.vorschlag-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--ki); font-weight: 650; font-size: .86rem; }

/* ------------------------------------------------------------------ 5 Formulare und Tabellen */
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="search"],
input[type="url"], input[type="tel"], select, textarea {
  width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
input[type="color"] { width: 54px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
input[type="file"] { max-width: 100%; }
::placeholder { color: var(--faint); }
label { display: block; font-size: .87rem; font-weight: 600; }
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea { display: block; margin-top: 5px; }
label > .muted, label > small, label > span { font-weight: 400; }
label > .muted { display: block; margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; margin: 0; }
legend { font-size: .87rem; font-weight: 650; padding: 0 6px; }
details > summary { cursor: pointer; }

.form { display: flex; flex-direction: column; gap: 14px; }
label.check, .check { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* Raster für Formulare: Felder nebeneinander, Überschriften, Hinweise und Knöpfe über die ganze Breite */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 14px 16px; align-items: start; }
.form-grid > h2, .form-grid > h3, .form-grid > p, .form-grid > fieldset, .form-grid > hr, .form-grid > .form-actions, .form-grid > button, .form-grid > .btn, .form-grid > details, .form-grid > .check { grid-column: 1 / -1; }
.form-grid > h2 { margin: 14px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.form-grid > h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.form-grid > p { margin: 0; }
.form-grid > button, .form-grid > .btn { justify-self: start; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; align-items: center; }
.form-actions.wrap { flex-wrap: wrap; }
.form-actions form, .share-url form, form.inline, .inline-form { margin: 0; }
form.inline, .inline-form, .inline { display: inline-flex; align-items: center; gap: 8px; }
.form.row-form, .row-form { display: flex; flex-direction: row; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row-form label { flex: 1; min-width: 160px; }
.inline-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.inline-row input { flex: 1; min-width: 12rem; }
.inline-row .grow { flex: 3; }
.keep-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 14px; font-size: .9rem; }
.filter-row label { display: flex; align-items: center; gap: 6px; }
.share-url { display: flex; gap: 6px; }
.share-url input { font-family: var(--mono); font-size: .82rem; }
.inline-details { display: inline-block; vertical-align: top; }
.inline-details > summary { list-style: none; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] { display: block; margin-top: 10px; max-width: 520px; }
.inline-details[open] > .form { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }

.table-scroll { overflow-x: auto; }
main > .table, main > .table-scroll { margin-bottom: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 650; padding: 9px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 7px 10px; }
.table tr.inactive td { opacity: .55; }
.table a { font-weight: 600; }
.kv { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 7px 14px; margin-bottom: 18px; }
.kv dt { color: var(--muted); }
.kv dd { overflow-wrap: anywhere; }
.plain-list { margin: 6px 0 0; padding-left: 18px; }
.plain-list li { margin: 2px 0; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.item-list > li:last-child { border-bottom: 0; }
.item-list .item-main { flex: 1; min-width: 160px; }
.item-list details { width: 100%; }
.item-list details form { margin-top: 8px; }
ol.steps, .backup-steps, .address-steps { margin: 0; padding-left: 20px; line-height: 1.7; }
.backup-steps > li, .address-steps li { margin-bottom: 10px; }
.address-steps li.done { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stats b { display: block; font-size: 1.5rem; font-weight: 680; }
.stats span { font-size: .8rem; color: var(--muted); }

/* ------------------------------------------------------------------ 6 Seiten der Plattform */
.page-title { font-size: 1.6rem; font-weight: 680; letter-spacing: -.015em; margin-bottom: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .page-title { margin-bottom: 4px; }
.crumbs { font-size: .87rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.admin-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-cols.wide-left { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.admin-cols > .panel { min-width: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 9px 12px; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 30px; box-shadow: var(--shadow); }
.auth-card.auth-wide { max-width: 540px; }
.auth-card h1 { font-size: 1.45rem; margin-bottom: 6px; }
.auth-card .form { margin: 20px 0; }
.auth-card > p.small { margin-top: 12px; }
.auth-logo { display: block; max-height: 56px; max-width: 100%; margin-bottom: 18px; }
.passkey-login { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.auth-card .passkey-login:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.alert, .notice { padding: 10px 12px; border-radius: 8px; font-size: .93rem; margin-top: 12px; }
.alert { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); }
.notice-action { border-color: var(--accent); background: var(--accent-soft); }
.qr { margin: 10px 0; }
.qr svg { display: block; width: 190px; height: 190px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.totp-secret { display: block; margin-top: 4px; font-family: var(--mono); letter-spacing: .05em; word-break: break-all; user-select: all; background: none; padding: 0; }
.recovery-codes { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.recovery-codes code { font-size: 1rem; letter-spacing: .04em; }
.secret-once, .token-panel { border: 1.5px solid var(--warn); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0 16px; }
.secret-once textarea { font-family: var(--mono); font-size: .82rem; }
.terms-text { max-height: 28rem; overflow-y: auto; line-height: 1.55; }
.dns-record { margin: 8px 0 4px; max-width: 640px; }
.usage-row { margin-bottom: 14px; }
.usage-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
progress { width: 100%; height: 6px; accent-color: var(--accent); }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 14px 0; }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.plan-card.current { border-color: var(--ok); }
.plan-card ul { margin: 0; padding-left: 18px; flex: 1; }
.backup-kind { margin: 22px 0 6px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.backup-form { margin: 10px 0 14px; max-width: 34rem; }
.folder-picker { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin: 10px 0; }
.folder-list { list-style: none; margin: 6px 0; padding: 0; max-height: 16rem; overflow-y: auto; }
.folder-list li { padding: 3px 0; overflow-wrap: anywhere; }
.folder-path { margin: 6px 0; font-family: var(--mono); font-size: .88em; overflow-wrap: anywhere; }

/* Kopf der Betreiber-Verwaltung (/plattform): Sie bringt ihr eigenes Gerüst mit */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 18px; min-height: var(--top); padding: 6px 16px; flex-wrap: wrap; }
.mainnav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.mainnav a { padding: 6px 10px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.mainnav a:hover { background: var(--surface-2); color: var(--text); }
.mainnav a.active { color: var(--text); font-weight: 650; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); }
.usernav { display: flex; align-items: center; gap: 10px; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
main.container { padding: 26px 24px 80px; container-type: normal; }
.page-auth main.container { padding-top: 7vh; }

/* ------------------------------------------------------------------ 7 Befehlszeile und Hinweise */
.veil { position: fixed; inset: 0; z-index: 50; background: rgba(15, 14, 10, .42); display: grid; align-items: start; justify-items: center; padding: 11vh 16px 0; }
.palette { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.palette input { width: 100%; height: 54px; padding: 0 18px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 1.1rem; outline: none; }
.results { max-height: 52vh; overflow: auto; padding: 6px; }
.hit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; }
.hit[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.hit small { color: var(--muted); }
.hit > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit b { font-weight: 600; }
.hit b + small { margin-left: 8px; }
/* Auswahlfeld: Vorschläge unter dem Feld, der gewählte Name daneben */
.pick { position: relative; }
.pick-list { position: absolute; left: 0; min-width: min(340px, 86vw); top: 100%; z-index: 25; margin-top: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; box-shadow: var(--shadow); font-weight: 400; }
.pick-name { display: block; min-height: 1.2em; margin-top: 3px; font-weight: 400; }
.palette-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: .8rem; }

.toasts { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 11px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); animation: rise .18s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
.toast form { margin: 0; flex: none; }
.toast button { min-height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); background: transparent; color: inherit; font-weight: 650; white-space: nowrap; }
.toast button.x { border-color: transparent; padding: 0 6px; font-weight: 400; opacity: .75; }
.toast.leaving { opacity: 0; transition: opacity .25s; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.flash { max-width: 1160px; margin: 14px auto 0; padding: 10px 16px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }

/* Die Bausteine richten sich nach dem Platz, den sie haben – nicht nach der Breite des Fensters */
@container (max-width: 820px) {
  .cols, .admin-cols, .admin-cols.wide-left { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 560px) {
  .row { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
  .row-acts { justify-self: start; }
  .form-row, .keep-row, .recovery-codes { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ 8 Schmale Bildschirme */
@media (max-width: 1020px) {
  .top { grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand small, .place { display: none; }
  .shell { display: block; }
  /* Die Navigation wandert als Leiste unter die Kopfzeile und lässt sich seitlich schieben */
  .side { position: sticky; top: calc(var(--top) + env(safe-area-inset-top, 0px)); z-index: 15; height: auto; display: flex; gap: 4px; padding: 6px 10px; overflow-x: auto;
          border-right: 0; border-bottom: 1px solid var(--line); background: var(--bg); scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side h2 { display: none; }
  .side .nav { flex: none; padding: 6px 10px; }
  .side-foot { display: none; }
  main { padding: 20px 16px 90px; }
  .admin-cols, .admin-cols.wide-left, .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .top { gap: 8px; padding: 0 10px; }
  .brand span.name { display: none; }
  .ask kbd { display: none; }
  .facts { gap: 18px; }
  .auth-card { padding: 22px 18px; }
  .page-auth main, .page-plain main { padding-top: 24px; }
  .container, main.container { padding-left: 14px; padding-right: 14px; }
  .toast { flex-wrap: wrap; }
}
