/* Stil: "Achromatic ledger" auf Complimate-Boden (#f4f4f2) mit Markengrün (#3e9e57) nur auf der Priorität. Details: app/DESIGN.md */
:root {
  color-scheme: light;
  --ground: #f4f4f2;
  --surface: #ffffff;
  --raised: #f7f7f5;
  --active: #e7e7e3;
  --border: #e2e2de;
  --rule: #eeeeea;
  --control: #cdcdc8;
  --text: #111212;
  --muted: #55575a;
  --faint: #66665f;
  --accent: #3e9e57;          /* Marke, nur als Fläche: 3,4:1 auf Weiß */
  --accent-soft: #dcefe1;
  --accent-ink: #1f6b36;      /* Marke als Text und Fokus: 6,5:1 auf Weiß */
  --on-accent: #0b0c0e;
  --primary: #1d1f20;
  --primary-ink: #ffffff;
  --negative: #b4232a;
  --negative-bg: #ffedea;
  --negative-ink: #831c1e;

  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans", Roboto, "Helvetica Neue", sans-serif;
  --radius-card: 8px;
  --radius-control: 6px;
  --control-height: 34px;
  --gap: 16px;
  --panel-width: 420px;
  /* Seitenrand: wächst ab 640 px Fenster mit; der Inhalt wird nie breiter als 1360 px. */
  --page-margin: max(var(--gap), (100vw - 640px) / 8, (100vw - 1360px) / 2);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, ul, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 3px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; }

/* ---------- Bedienelemente ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-height); padding: 0 12px;
  border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); font-weight: 500; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color 150ms ease, transform 100ms var(--ease-out);
}
.btn:hover:not(:disabled) { background: var(--raised); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { color: var(--faint); background: var(--raised); cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary:hover { background: #33363a; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--active); color: var(--text); }
.input { height: var(--control-height); min-width: 0; padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.input::placeholder { color: var(--faint); }
select.input { padding: 0 8px 0 10px; max-width: 200px; cursor: pointer; }
.link { padding: 0; border: 0; background: none; color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 3px; cursor: pointer; }
.link:hover { text-decoration-color: currentColor; }
.chip { display: inline-flex; align-items: center; flex: none; height: 18px; padding: 0 6px; margin-right: 6px; border-radius: 4px; background: var(--active); color: var(--text); font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; vertical-align: 1px; }
.chip-next { background: var(--accent-soft); color: #14512a; }

/* ---------- Rahmen ---------- */
.app { display: grid; grid-template-rows: 48px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 var(--page-margin); }
.brand { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.topbar h1 { padding-left: 14px; border-left: 1px solid var(--control); font-size: 16px; line-height: 20px; font-weight: 600; }
.topbar-end { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.user { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); min-height: 0; padding: 0 var(--page-margin) var(--gap); }
.workspace:has(.preview[open]) { grid-template-columns: minmax(0, 1fr) var(--panel-width); }
.list-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }

/* ---------- Werkzeugleiste ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 200px; max-width: 320px; }
.search .icon { position: absolute; left: 10px; top: 9px; color: var(--faint); pointer-events: none; }
.search .input { width: 100%; padding-left: 32px; }
.filters { display: contents; }
.filter-toggle, select.input.sort-select { display: none; }

.toolbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.count { color: var(--muted); white-space: nowrap; }
.stamp { color: var(--faint); font-size: 12px; white-space: nowrap; }
.stamp:empty { display: none; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 12px; border-radius: var(--radius-control); background: var(--negative-bg); color: var(--negative-ink); overflow-wrap: anywhere; }
.notice .btn { flex: none; }
.stamp.is-error { color: var(--negative); }
#refresh.is-busy .icon { animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Offene Vorschau: ohne Zähler und Schriftzug bleibt die Leiste einzeilig, die Tabelle springt beim Öffnen nicht. */
@media (min-width: 1180px) {
  .workspace:has(.preview[open]) .search { flex-basis: 100px; }
  .workspace:has(.preview[open]) .count { display: none; }
  .workspace:has(.preview[open]) #refresh { width: var(--control-height); padding: 0; font-size: 0; gap: 0; }
}

/* ---------- Tabelle ---------- */
.table-panel { flex: 1; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; container: list / inline-size; }
.table-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-padding-top: 38px; }
.topics { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.topics th {
  position: sticky; top: 0; z-index: 2; height: 38px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 400; color: var(--muted); text-align: left; white-space: nowrap;
}
.sort { display: inline-flex; align-items: center; gap: 3px; height: 28px; padding: 0 4px; margin-left: -4px; border: 0; border-radius: 4px; background: none; color: inherit; cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }
.sort:hover { background: var(--raised); color: var(--text); }
.sort .icon { width: 12px; height: 12px; }
th[aria-sort] .sort { color: var(--text); font-weight: 500; }
.topics td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; overflow-wrap: break-word; }
.topics tbody tr:last-child td { border-bottom: 0; }
.topics tr[data-id] { cursor: pointer; }
.topics tr[data-id]:hover td { background: var(--raised); }
.topics tr.is-selected td, .topics tr.is-selected:hover td { background: var(--active); }
.topics tr.is-selected .row-title { font-weight: 600; }

.topics .col-prio { width: 84px; padding-right: 8px; }
.col-category { width: 15%; color: var(--muted); font-size: 13px; line-height: 18px; hyphens: auto; }
.col-source { width: 16%; color: var(--muted); font-size: 13px; line-height: 18px; }
.source-count { display: block; color: var(--faint); font-size: 12px; line-height: 16px; }
.topics .col-date { width: 92px; text-align: right; color: var(--muted); font-size: 13px; white-space: nowrap; }
th.col-date .sort { margin: 0 -4px 0 0; }

.row-open { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; line-height: 19px; }
.row-title { display: inline; }
.row-sub { display: none; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 16px; }
.row-sub-part + .row-sub-part::before { content: " · "; }

/* Priorität in der Zeile: echtes select über einer eigenen Anzeige, damit geschlossen nur die Zahl steht. Grün heißt: manuell gesetzt. */
.prio { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 2px; width: 56px; height: 32px; padding: 0 6px 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); transition: border-color 150ms ease, background-color 150ms ease; }
.prio:hover { border-color: #9d9d97; }
.prio:has(select:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.prio:active { transform: scale(0.99); }
.prio-num { font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; }
.prio.is-manual { border-color: transparent; background: var(--accent-soft); }
.is-manual .prio-num { color: #14512a; font-weight: 700; }
.prio .icon { width: 12px; height: 12px; color: var(--muted); }
.prio select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; overflow: hidden; opacity: 0; cursor: pointer; font-size: 14px; }
.prio.is-saving .prio-num { opacity: 0.45; }
.prio.is-saved .icon { color: var(--accent-ink); }
.prio.is-error { border-color: var(--negative); background: var(--surface); }
.prio.is-error .icon { color: var(--negative); }
.prio.is-locked { border-color: transparent; background: transparent; }

.skeleton { display: block; height: 14px; border-radius: 4px; background: var(--active); }
.sk-prio { width: 56px; height: 32px; border-radius: var(--radius-control); }
.sk-title { width: 86%; }
.sk-text { width: 70%; }
.sk-date { width: 64px; margin-left: auto; }

.table-message { display: grid; justify-items: start; gap: 10px; margin: 16px; padding: 16px; border: 1px dashed var(--control); border-radius: var(--radius-control); color: var(--muted); }
.more { display: flex; justify-content: center; padding: 14px; }

@container list (max-width: 800px) {
  .col-category, .col-source { display: none; }
  .row-sub { display: block; }
  .row-sub-date { display: none; }
}

/* ---------- Vorschau ---------- */
.preview {
  position: relative; display: flex; flex-direction: column; width: auto; max-width: none; height: auto; max-height: none; min-height: 0; margin: 0; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); color: var(--text); overflow: hidden;
}
.preview:not([open]) { display: none; }
@media (min-width: 1180px) {
  .preview[open] { transition: transform 220ms var(--ease-out), opacity 220ms ease; }
  @starting-style { .preview[open] { transform: translateX(16px); opacity: 0; } }
}
.pv-close { position: absolute; top: 12px; right: 12px; z-index: 1; width: 32px; height: 32px; padding: 0; }
.pv-head { flex: none; padding: 18px 20px 0; }
.pv-scroll { flex: 1; min-height: 0; padding: 16px 20px 24px; overflow-y: auto; overscroll-behavior: contain; }
.pv-scroll:focus-visible { outline-offset: -2px; }
.pv-title { padding-right: 32px; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; text-wrap: pretty; overflow-wrap: anywhere; }
.pv-title:focus { outline: none; }
.pv-title:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.pv-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; color: var(--muted); font-size: 13px; }

.pv-prio { margin-top: 14px; }
.pv-prio-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.pv-effective { display: flex; align-items: baseline; gap: 8px; }
.pv-effective-num { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; }
.pv-effective-label { color: var(--muted); font-size: 13px; }

.scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 3px; margin-top: 10px; }
.step { position: relative; height: 34px; padding: 0; border: 1px solid var(--control); border-radius: 5px; background: var(--surface); font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color 120ms ease, transform 100ms var(--ease-out); }
.step:hover { background: var(--raised); }
.step:active { transform: scale(0.94); }
.step.is-under { border-color: transparent; background: var(--accent-soft); }
.step.is-on { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.step.is-on.is-auto { background: var(--text); color: #fff; }
.scale:has(.is-auto) .is-under { background: var(--active); }
.step.has-ki::after { content: "KI"; position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%); color: var(--muted); font-size: 11px; line-height: 12px; font-weight: 500; pointer-events: none; }
.save-note { font-size: 13px; line-height: 18px; }
.save-note.is-saving { color: var(--muted); }
.save-note.is-saved { color: var(--accent-ink); font-weight: 500; }
.save-note.is-error { display: grid; justify-items: start; gap: 6px; width: 100%; margin-top: 20px; padding: 8px 10px; border-radius: var(--radius-control); background: var(--negative-bg); color: var(--negative-ink); }
.pv-note { margin-top: 10px; padding: 8px 10px; border-radius: var(--radius-control); background: var(--raised); color: var(--muted); font-size: 13px; line-height: 18px; }

.pv-tabs { display: flex; gap: 16px; margin: 26px -20px 0; padding: 0 20px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.pv-tab { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); cursor: pointer; transition: color 120ms ease; }
.pv-tab:hover { color: var(--text); }
.pv-tab[aria-selected="true"] { border-bottom-color: var(--text); color: var(--text); font-weight: 500; }
.pv-tab:focus-visible { outline-offset: -2px; }
.pv-tab-count { min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--active); color: var(--text); font-size: 11px; line-height: 16px; text-align: center; }
.pv-text { font-size: 15px; line-height: 23px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-quote { padding: 10px 12px; border-radius: var(--radius-control); background: var(--raised); font-size: 14px; line-height: 21px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-empty { color: var(--muted); font-size: 13px; }
.pv-sources-note { margin-bottom: 12px; }
.pv-sources { display: grid; gap: 12px; }
.pv-source + .pv-source { padding-top: 12px; border-top: 1px solid var(--rule); }
.pv-source .pv-quote { margin-top: 6px; }
.pv-facts { display: grid; gap: 3px; }
.pv-facts > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
.pv-facts dt { color: var(--muted); font-size: 13px; }
.pv-facts dd { overflow-wrap: anywhere; }

/* ---------- Auswahllisten: natives select, die Liste im Design der Seite. Ohne Unterstützung bleibt die Systemliste. ---------- */
@supports (appearance: base-select) {
  select, ::picker(select) { appearance: base-select; }
  select.input { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
  select::picker-icon { content: ""; width: 6px; height: 6px; margin: -3px 2px 0; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
  ::picker(select) {
    margin-block: 4px; padding: 4px; max-height: min(380px, 70dvh); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); color: var(--text);
    box-shadow: 0 8px 24px rgb(17 18 18 / 0.12); opacity: 1; transition: opacity 120ms ease, display 120ms allow-discrete, overlay 120ms allow-discrete;
  }
  ::picker(select):not(:popover-open) { opacity: 0; }
  @starting-style { ::picker(select):popover-open { opacity: 0; } }
  option { display: flex; align-items: center; gap: 12px; min-height: 30px; padding: 4px 8px; border-radius: 5px; white-space: nowrap; cursor: pointer; }
  option:hover, option:focus-visible { background: var(--active); outline: none; }
  option:checked { font-weight: 500; }
  option::checkmark { order: 1; margin-left: auto; color: var(--accent-ink); }
  @media (pointer: coarse) {
    option { min-height: 36px; }
  }
  /* Telefon: zwölf große Einträge passen an einer Zeile in der Bildmitte weder darüber noch darunter, also unten am Rand. */
  @media (max-width: 640px) {
    option { min-height: 44px; }
    ::picker(select) { position: fixed; position-area: none; inset: auto 8px 8px; width: auto; margin: 0; max-height: min(560px, calc(100dvh - 16px)); }
  }
}

/* ---------- Unter 1180 px: Vorschau als Blatt von rechts, gleicher Weg hinein und hinaus ---------- */
@media (max-width: 1179px) {
  .workspace, .workspace:has(.preview[open]) { grid-template-columns: minmax(0, 1fr); }
  .preview {
    position: fixed; inset: 0 0 0 auto; width: min(560px, 100%); height: 100%; max-height: 100%; border: 0; border-radius: 0;
    transform: translateX(100%); transition: transform 280ms var(--ease-out), overlay 280ms allow-discrete, display 280ms allow-discrete;
  }
  .preview:not([open]) { display: none; }
  .preview[open] { transform: none; }
  @starting-style { .preview[open] { transform: translateX(100%); } }
  .preview::backdrop { background: rgb(17 18 18 / 0.28); opacity: 0; transition: opacity 280ms ease, overlay 280ms allow-discrete, display 280ms allow-discrete; }
  .preview[open]::backdrop { opacity: 1; }
  @starting-style { .preview[open]::backdrop { opacity: 0; } }
}

/* ---------- Wenig Platz: Seite und Blatt scrollen als Ganzes, keine inneren Kästen ---------- */
@media (max-width: 640px), (max-width: 1179px) and (max-height: 500px) {
  html { scroll-padding-top: 38px; }
  html:has(.preview:modal) { overflow: hidden; }
  .app { grid-template-rows: 48px auto; height: auto; min-height: 100dvh; }
  .table-panel { flex: none; overflow: visible; }
  .table-scroll { height: auto; overflow: visible; }
  .preview { overflow: hidden auto; overscroll-behavior: contain; }
  .pv-close { position: sticky; top: 4px; flex: none; align-self: flex-end; width: 44px; height: 44px; margin: 4px 4px -48px 0; background: var(--surface); }
  .pv-title { padding-right: 40px; }
  .pv-scroll { flex: none; overflow: visible; }
}

/* ---------- Telefon ---------- */
@media (max-width: 640px) {
  :root { --control-height: 44px; --gap: 16px; }
  /* iPhone vergrößert die Seite beim Fokus auf Felder unter 16 px. */
  .input, .prio select { font-size: 16px; }
  html { scroll-padding-top: 64px; }
  .topbar .brand { font-size: 0; gap: 0; }
  .topbar h1 { padding-left: 0; border-left: 0; }
  .topbar .btn { padding-right: 0; }
  .user { display: none; }
  .workspace { padding: 0; }
  .list-pane { gap: 0; }

  /* Beim Scrollen bleibt nur die Suchzeile stehen; die Anzahl darüber wandert aus dem Bild. */
  .toolbar { position: sticky; top: -18px; z-index: 3; padding: 0 16px 8px; background: var(--ground); }
  .toolbar:has(.filters.is-open) { position: static; }
  .toolbar-end { display: contents; }
  .count { order: -1; width: 100%; font-size: 13px; line-height: 18px; }
  .search { flex: 1 1 0; max-width: none; }
  .search .icon { top: 14px; }
  .search .input:placeholder-shown { text-overflow: ellipsis; }
  .filter-toggle { display: inline-flex; flex: none; }
  #refresh { flex: none; width: 44px; padding: 0; font-size: 0; gap: 0; }
  .filters { display: none; order: 1; width: 100%; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .filters.is-open { display: grid; }
  .filters select.input { width: 100%; max-width: none; }
  .filters select.input::picker-icon { margin-inline-start: auto; }
  select.input.sort-select { display: inline-flex; }
  .stamp { order: 2; width: 100%; }
  .notice { position: sticky; top: 64px; z-index: 3; margin: 0 16px 8px; }

  /* Zeilen über die volle Breite: Titel und Priorität oben, darunter Kategorie, Quelle und Datum je einzeilig. */
  .table-panel { border-width: 1px 0 0; border-radius: 0; }
  .topics, .topics tbody { display: block; }
  .topics caption, .topics thead { display: none; }
  .topics tr[data-id] { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--rule); -webkit-tap-highlight-color: transparent; }
  .topics tr[data-id]:active { background: var(--raised); }
  .topics tr[aria-hidden] { display: block; padding: 12px 16px; }
  .topics tr[aria-hidden] td:not(.col-title) { display: none; }
  .topics td { display: block; padding: 0; border: 0; }
  .topics tr[data-id]:hover td, .topics tr.is-selected td, .topics tr.is-selected:hover td { background: none; }
  .topics tr.is-selected { background: var(--active); }
  .topics tr[data-id] td.col-title { display: contents; }
  .row-open { grid-column: 1; grid-row: 1; align-self: center; font-size: 15px; line-height: 20px; font-weight: 500; }
  .topics td.col-prio { grid-column: 2; grid-row: 1; width: auto; }
  .topics td.col-category, .topics td.col-source, .topics td.col-date { display: none; }
  .row-sub { display: block; grid-column: 1 / -1; margin-top: 6px; font-size: 13px; line-height: 18px; }
  .row-sub-part { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row-sub-part + .row-sub-part::before { content: none; }
  .row-sub-source { display: flex; gap: 4px; }
  .row-sub-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .row-sub-count { flex: none; }
  .row-sub-date { display: inline; flex: none; margin-left: auto; padding-left: 8px; }
  .prio { width: 64px; height: 44px; }

  /* Skala in zwei Reihen, damit jedes Feld mit dem Daumen sicher zu treffen ist. */
  .scale { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 6px; }
  .step { height: 44px; }
  .pv-head { padding: 14px 16px 0; }
  .pv-scroll { padding: 14px 16px 24px; }
  .pv-tabs { justify-content: space-between; gap: 6px; margin-inline: -16px; padding-inline: 16px; }
  .pv-tab { height: 44px; }
  .btn { min-height: var(--control-height); }
}

/* ---------- Anmeldung ---------- */
.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.login { width: min(360px, 100%); }
.login .brand { font-size: 15px; }
.login h1 { margin: 12px 0 18px; font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.015em; }
.login-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 500; }
.field .input { width: 100%; height: max(40px, var(--control-height)); }
.login-form .btn { height: max(40px, var(--control-height)); margin-top: 4px; }
.field .input[readonly] { background: var(--raised); color: var(--muted); }
.field-hint { color: var(--muted); font-size: 12px; line-height: 16px; }
.login-error { margin-bottom: 14px; padding: 8px 10px; border-radius: var(--radius-control); background: var(--negative-bg); color: var(--negative-ink); }
.setup-text { margin-bottom: 10px; overflow-wrap: anywhere; }
.qr { display: block; width: min(220px, 100%); margin: 0 auto 12px; background: #fff; fill: #000; shape-rendering: crispEdges; }
.setup-key { margin-bottom: 18px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; user-select: all; }
.setup-logout { margin-top: 10px; }
.setup-logout .btn { width: 100%; height: max(40px, var(--control-height)); }

/* ---------- Team ---------- */
.team { display: grid; gap: 10px; padding: 0 var(--page-margin) var(--gap); }
.team-invite { display: flex; gap: 8px; }
.team-invite .input { flex: 1 1 200px; max-width: 320px; }
.team-link { display: grid; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow-wrap: anywhere; }
.team-link > p:first-child { font-weight: 500; }
.team-link-row { display: flex; gap: 8px; }
.team-link-row .input { flex: 1; color: var(--muted); }
.team-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.team-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.team-table th { height: 38px; padding: 0 12px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 400; color: var(--muted); text-align: left; white-space: nowrap; }
.team-table td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.team-table tbody tr:last-child td { border-bottom: 0; }
.team-email { overflow-wrap: anywhere; }
.team-email .chip { margin: 0 0 0 4px; }
.team-status, .team-empty { color: var(--muted); }
.team-actions { white-space: nowrap; text-align: right; }
.team-actions .btn + .btn { margin-left: 4px; }
@media (max-width: 640px) {
  .team { padding-inline: 16px; }
  .team-invite .input { max-width: none; }
  .team-link-row { flex-direction: column; }
  .team-link-row .input { flex: none; }
  /* Zeilen statt Spalten: Adresse und Status untereinander, Aktionen darunter. */
  .team-table thead { display: none; }
  .team-table, .team-table tbody, .team-table tr, .team-table td { display: block; }
  .team-table tr { padding: 12px; border-bottom: 1px solid var(--rule); }
  .team-table tr:last-child { border-bottom: 0; }
  .team-table td { padding: 0; border: 0; }
  .team-email { font-weight: 500; }
  .team-status { margin-top: 2px; font-size: 13px; line-height: 18px; }
  .team-actions { display: flex; gap: 8px; margin-top: 8px; text-align: left; }
  .team-actions .btn + .btn { margin-left: 0; }
  .team-actions .btn { flex: 1; }
}

/* ---------- Präferenzen ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop { transition-duration: 0.01ms !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  :root { --border: #8a8a85; --rule: #bdbdb8; --control: #66665f; --muted: #3c3e41; --faint: #47473f; }
}
