/* ==========================================================================
   SPARVD Admin · admin.css
   Built from the RiesterCheck design system v2 "Bescheid"
   (web/check/DESIGNSYSTEM.md): palette, Schibsted Grotesk, 6 px controls with a
   1.5 px outline and no shadow, chips, focus ring. The admin is a work tool:
   calm controls and type, denser than the saver's flow. The yellow marker
   appears only on document pages (case detail), as the system says.

   Self-contained: no framework, no build, no external requests. The admin CSP
   (docker/Caddyfile) allows styles and fonts from 'self' only.

   1  Font, tokens
   2  Base (body, links, focus, selection)
   3  App shell: header, navigation, main
   4  Page head, sections, quiet panels, definition lists
   5  Controls: buttons, inputs, selects, filters
   6  Chips, flash messages, empty states
   7  Tables, pagination
   8  Sign-in pages (login, magic link sent, TOTP setup and entry)
   9  Case detail: documents, page viewer with marker, timeline
   10 Funnel bars
   ========================================================================== */

/* ---------- 1 · Font, tokens ---------------------------------------------- */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("fonts/schibsted-grotesk-latin-wght.woff2") format("woff2-variations"),
       url("fonts/schibsted-grotesk-latin-wght.woff2") format("woff2");
}

:root {
  --rc-weiss:    #FFFFFF;
  --rc-nacht:    #1E2C38;
  --rc-nacht-2:  #2C3E4E;
  --rc-kuehl:    #E6EAED;
  --rc-kuehl-2:  #F3F5F6;
  --rc-schiefer: #56636E;
  --rc-umriss:   #C3CBD1;
  --rc-marker:   #FFE14D;
  --rc-fehler:   #A3271F;
  --rc-fehler-2: #FBEDEC;   /* quiet ground for error messages; --rc-fehler on it is 6.4:1 */
  --rc-bleiben:  #9AA6AF;   /* input hover outline (DS §8) */
  --rc-platzhalter: #6B7781;

  --rc-sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --rc-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --t-klein: .8125rem;  /* 13 */
  --t-meta:  .875rem;   /* 14  table text, labels */
  --t-text:  .9375rem;  /* 15  body text in the admin */
  --t-lead:  1.125rem;  /* 18  section titles */
  --t-titel: 1.625rem;  /* 26  page titles (one h1 per page) */

  --rc-rund: 6px;
  --rc-rund-blatt: 2px;
  --rc-papier-schatten:
    0 1px 1px rgba(30, 44, 56, .06),
    0 2px 4px rgba(30, 44, 56, .06),
    0 14px 34px -10px rgba(30, 44, 56, .22);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --ziel: 44px;                      /* primary control height in the admin */
  --rand: clamp(16px, 3vw, 40px);    /* side gutter */
  --breite: 1360px;                  /* content max width, suits the wide tables */
  --kopf: 60px;                      /* app header height */
  color-scheme: light;
}

/* ---------- 2 · Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--rc-weiss);
  color: var(--rc-nacht);
  font: 400 var(--t-text)/1.5 var(--rc-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--rc-nacht); color: var(--rc-weiss); }

a { color: var(--rc-nacht); font-weight: 500; text-decoration: underline; text-decoration-color: var(--rc-umriss); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 3px solid var(--rc-nacht); outline-offset: 3px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

.mono { font-family: var(--rc-mono); font-size: .92em; letter-spacing: 0; }
.leise, .muted { color: var(--rc-schiefer); }
/* Proportional figures throughout: tabular-nums in Schibsted widens "." and ":" (DS §3) */
.zahl { white-space: nowrap; }
.nur-sr {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.inline-form { display: inline; margin: 0; }

/* ---------- 3 · App shell ------------------------------------------------- */
.kopf {
  position: sticky; top: 0; z-index: 30;
  background: var(--rc-weiss);
  box-shadow: inset 0 -1px 0 var(--rc-kuehl);
}
.kopf__reihe {
  max-width: var(--breite); margin: 0 auto; padding: 0 var(--rand);
  min-height: var(--kopf);
  display: flex; align-items: center; gap: var(--s5);
}
.marke { display: inline-flex; align-items: center; gap: var(--s3); color: var(--rc-nacht); text-decoration: none; min-height: var(--ziel); flex: none; }
.marke svg { height: 15px; width: auto; fill: currentColor; }
.marke__admin {
  font-size: var(--t-klein); font-weight: 600; color: var(--rc-schiefer);
  padding-left: var(--s3); box-shadow: inset 1.5px 0 0 var(--rc-umriss); line-height: 1.2;
}

.nav { display: flex; align-items: stretch; gap: var(--s1); align-self: stretch; flex: 1 1 auto; min-width: 0; }
.nav a {
  display: inline-flex; align-items: center; padding: 0 var(--s3);
  color: var(--rc-schiefer); font-weight: 600; font-size: var(--t-text); text-decoration: none;
  box-shadow: inset 0 -3px 0 transparent; transition: color .15s, box-shadow .15s;
  white-space: nowrap;
}
.nav a:hover { color: var(--rc-nacht); box-shadow: inset 0 -3px 0 var(--rc-kuehl); }
.nav a[aria-current="page"] { color: var(--rc-nacht); box-shadow: inset 0 -3px 0 var(--rc-nacht); }
.nav a:focus-visible { outline-offset: -3px; }

.konto { display: flex; align-items: center; gap: var(--s3); flex: none; }
.konto__wer { text-align: right; line-height: 1.25; min-width: 0; }
.konto__mail { display: block; font-size: var(--t-meta); font-weight: 600; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.konto__rolle { display: block; font-size: var(--t-klein); color: var(--rc-schiefer); }

@media (max-width: 899px) {
  .kopf__reihe { flex-wrap: wrap; gap: 0 var(--s4); }
  .marke { flex: 1 1 auto; }
  .nav { order: 3; flex: 1 1 100%; margin: 0 calc(-1 * var(--s3)); overflow-x: auto; scrollbar-width: none; min-height: var(--ziel); }
  .nav::-webkit-scrollbar { display: none; }
  .konto__wer { display: none; }
}

main { max-width: var(--breite); margin: 0 auto; padding: var(--s6) var(--rand) var(--s7); }
@media (max-width: 599px) { main { padding-top: var(--s5); } }

/* ---------- 4 · Page head, sections, panels ------------------------------- */
.seitenkopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4) var(--s5); margin-bottom: var(--s5); }
.seitenkopf__text { min-width: 0; }
.pfad { font-size: var(--t-meta); color: var(--rc-schiefer); margin-bottom: var(--s2); }
.pfad a { color: var(--rc-schiefer); }
h1 { font-size: var(--t-titel); font-weight: 700; letter-spacing: -.022em; line-height: 1.15; overflow-wrap: anywhere; }
h1 .mono { font-size: .62em; font-weight: 500; letter-spacing: 0; color: var(--rc-schiefer); vertical-align: .18em; margin-left: .2em; }
.seitenkopf__unter { margin-top: var(--s2); color: var(--rc-schiefer); max-width: 70ch; }
.seitenkopf__chips { margin-top: var(--s3); display: flex; flex-wrap: wrap; gap: var(--s2); }
.seitenkopf__aktionen { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

.abschnitt { margin-top: var(--s7); scroll-margin-top: calc(var(--kopf) + var(--s4)); }
.abschnitt:first-child { margin-top: 0; }
h2 { font-size: var(--t-lead); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin-bottom: var(--s3); }
h2 .zaehler { font-weight: 500; color: var(--rc-schiefer); margin-left: .35em; font-size: var(--t-text); }
h3 { font-size: var(--t-text); font-weight: 700; line-height: 1.3; margin-bottom: var(--s2); }

/* In-page navigation (case detail) */
.sprung + .abschnitt { margin-top: 0; }
.sprung { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s5) 0 var(--s6); padding: 0; list-style: none; }
.sprung a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s3);
  border-radius: 99px; background: var(--rc-kuehl-2); color: var(--rc-nacht);
  font-size: var(--t-meta); font-weight: 600; text-decoration: none;
}
.sprung a:hover { background: var(--rc-kuehl); }

/* Quiet panel (DS §8: --rc-kuehl-2, 6 px) */
.panel { background: var(--rc-kuehl-2); border-radius: var(--rc-rund); padding: var(--s4) var(--s5); }
.panel + .panel { margin-top: var(--s3); }
@media (max-width: 599px) { .panel { padding: var(--s4); } }

/* Facts: label/value grid */
.fakten { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--s4) var(--s6); }
.fakten > div { min-width: 0; }
.fakten dt { font-size: var(--t-klein); font-weight: 600; color: var(--rc-schiefer); margin-bottom: 2px; }
.fakten dd { font-size: var(--t-text); overflow-wrap: anywhere; }
.fakten dd .chip { margin-left: var(--s1); vertical-align: 1px; }

/* ---------- 5 · Controls -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--ziel); padding: 0 18px; margin: 0;
  border: 0; border-radius: var(--rc-rund);
  background: var(--rc-weiss); color: var(--rc-nacht);
  box-shadow: inset 0 0 0 1.5px var(--rc-umriss);
  font-weight: 600; font-size: var(--t-text); line-height: 1.2; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--rc-kuehl-2); box-shadow: inset 0 0 0 1.5px var(--rc-nacht); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--rc-nacht); color: var(--rc-weiss); box-shadow: none; }
.btn.primary:hover { background: var(--rc-nacht-2); }
.btn.danger { color: var(--rc-fehler); box-shadow: inset 0 0 0 1.5px var(--rc-fehler); }
.btn.danger:hover { background: var(--rc-fehler-2); }
.btn.klein { min-height: 36px; padding: 0 12px; font-size: var(--t-meta); }
.btn.gross { min-height: 52px; padding: 0 26px; font-size: 1rem; }
.btn.breit { width: 100%; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.textknopf {
  display: inline-flex; align-items: center; min-height: var(--ziel); padding: 0 2px; border: 0; background: none;
  color: var(--rc-schiefer); font-weight: 500; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--rc-umriss); text-underline-offset: .22em;
}
.textknopf:hover { color: var(--rc-nacht); text-decoration-color: currentColor; }

.feld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.feld + .feld { margin-top: var(--s4); }
.label, .feld > label { font-size: var(--t-meta); font-weight: 600; color: var(--rc-nacht); }
.hinweis { font-size: var(--t-meta); color: var(--rc-schiefer); }

.eingabe,
input[type="text"], input[type="email"], input[type="date"], input[type="search"], select {
  display: block; width: 100%; min-height: var(--ziel); padding: 0 12px; margin: 0;
  border: 1.5px solid var(--rc-umriss); border-radius: var(--rc-rund);
  background: var(--rc-weiss); color: var(--rc-nacht);
  font-size: var(--t-text); font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%2356636E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
input::placeholder { color: var(--rc-platzhalter); font-weight: 400; opacity: 1; }
input:hover, select:hover { border-color: var(--rc-bleiben); }
input:focus, select:focus { outline: none; border-color: var(--rc-nacht); box-shadow: 0 0 0 1.5px var(--rc-nacht); }
input[aria-invalid="true"] { border-color: var(--rc-fehler); box-shadow: 0 0 0 1px var(--rc-fehler); }

/* Filters (case list): search and buttons on top, the rest below (collapsed on phones) */
.filters {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3) var(--s4);
  align-items: end; padding: var(--s4) var(--s5); margin-bottom: var(--s5);
  background: var(--rc-kuehl-2); border-radius: var(--rc-rund);
}
.filters label { display: flex; flex-direction: column; gap: 6px; font-size: var(--t-klein); font-weight: 600; color: var(--rc-nacht); min-width: 0; }
.filters__suche { max-width: 36rem; }
.filters__knoepfe { display: flex; gap: var(--s2); align-items: center; }
.filters__mehr { grid-column: 1 / -1; }
.filters__mehr > summary {
  display: none; align-items: center; gap: var(--s2); min-height: var(--ziel); cursor: pointer;
  font-weight: 600; font-size: var(--t-meta); list-style: none;
}
.filters__mehr > summary::-webkit-details-marker { display: none; }
.filters__mehr > summary::before {
  content: ""; width: 7px; height: 7px; margin: 0 6px 0 2px; border: solid var(--rc-nacht); border-width: 0 2px 2px 0;
  transform: rotate(-45deg); transition: transform .15s;
}
.filters__mehr[open] > summary::before { transform: rotate(45deg); }
.filters__raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: var(--s3) var(--s4); }
@media (max-width: 599px) {
  .filters { grid-template-columns: minmax(0, 1fr); padding: var(--s4); }
  .filters__suche { max-width: none; }
  .filters__knoepfe { order: 3; }
  .filters__knoepfe .btn { flex: 1 1 0; }
  .filters__mehr > summary { display: flex; }
  .filters__mehr[open] > summary { margin-bottom: var(--s3); }
  .filters__raster { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Inline correction form inside a table row */
.korrektur { display: flex; gap: var(--s2); align-items: center; }
.korrektur input[type="text"] { width: 9.5rem; min-height: 36px; font-size: var(--t-meta); padding: 0 10px; font-family: var(--rc-mono); }
.zeilenaktionen { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ---------- 6 · Chips, flash, empty states -------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 99px; background: var(--rc-kuehl); color: var(--rc-nacht);
  font-size: var(--t-klein); font-weight: 600; line-height: 1.3; white-space: nowrap;
  font-variant-numeric: normal;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--rc-schiefer); flex: none; }
.chip.ok::before { background: var(--rc-nacht); border-color: var(--rc-nacht); }
.chip.warn { background: var(--rc-weiss); box-shadow: inset 0 0 0 1.5px var(--rc-nacht); }
.chip.warn::before { border-color: var(--rc-nacht); background: var(--rc-weiss); }
.chip.bad { background: var(--rc-fehler-2); color: var(--rc-fehler); }
.chip.bad::before { background: var(--rc-fehler); border-color: var(--rc-fehler); }
.chip.code { font-family: var(--rc-mono); font-weight: 500; font-size: .78rem; }
.chip.ohne::before { display: none; }

.flash {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s3) var(--s4); margin-bottom: var(--s5);
  border-radius: var(--rc-rund); font-weight: 500; line-height: 1.45;
}
.flash::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; background: currentColor; -webkit-mask: var(--flash-icon) center / contain no-repeat; mask: var(--flash-icon) center / contain no-repeat; }
.flash.info, .flash.ok { background: var(--rc-kuehl-2); color: var(--rc-nacht); box-shadow: inset 3px 0 0 var(--rc-nacht); }
.flash.info { --flash-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E"); }
.flash.ok { --flash-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.flash.error { background: var(--rc-fehler-2); color: var(--rc-fehler); box-shadow: inset 3px 0 0 var(--rc-fehler); --flash-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5v.5'/%3E%3C/svg%3E"); }

.leer {
  padding: var(--s6) var(--s5); text-align: center; color: var(--rc-schiefer);
  background: var(--rc-kuehl-2); border-radius: var(--rc-rund);
}
.leer strong { display: block; color: var(--rc-nacht); font-size: 1rem; margin-bottom: 2px; }
td.leer-zeile { padding: var(--s6) var(--s4); text-align: center; color: var(--rc-schiefer); background: var(--rc-weiss); }

/* ---------- 7 · Tables ---------------------------------------------------- */
.tabelle {
  border: 1.5px solid var(--rc-kuehl); border-radius: var(--rc-rund);
  overflow: auto; max-width: 100%; background: var(--rc-weiss);
}
.tabelle--hoch { max-height: calc(100vh - var(--kopf) - 120px); max-height: calc(100dvh - var(--kopf) - 120px); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-meta); }
th, td { text-align: left; padding: 10px var(--s3); vertical-align: middle; }
td { border-top: 1px solid var(--rc-kuehl); }
tbody tr:first-child td { border-top: 0; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--rc-kuehl-2); color: var(--rc-schiefer);
  font-size: var(--t-klein); font-weight: 600; white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--rc-kuehl);
}
th:first-child, td:first-child { padding-left: var(--s4); }
th:last-child, td:last-child { padding-right: var(--s4); }
tbody tr:hover td { background: var(--rc-kuehl-2); }
tbody tr:hover td.leer-zeile { background: var(--rc-weiss); }
td.zahl, th.zahl { text-align: right; white-space: nowrap; }
td.datum { white-space: nowrap; color: var(--rc-nacht); }
td.mono { overflow-wrap: break-word; min-width: 7.5rem; }
td.aktion { text-align: right; white-space: nowrap; width: 1%; }
td.leise-zelle { color: var(--rc-schiefer); }
td .unter { display: block; font-size: var(--t-klein); color: var(--rc-schiefer); }
td.zitat { color: var(--rc-schiefer); max-width: 36ch; }

.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-top: var(--s4);
}
.pagination__info { color: var(--rc-schiefer); font-size: var(--t-meta); }
.pagination__info strong { color: var(--rc-nacht); }
.pagination__knoepfe { display: flex; gap: var(--s2); }
.btn[aria-disabled="true"] { color: var(--rc-schiefer); background: var(--rc-kuehl-2); box-shadow: none; cursor: default; pointer-events: none; }

.htmx-request #cases-table-wrap, #cases-table-wrap.htmx-request { opacity: .55; transition: opacity .15s; }

/* ---------- 8 · Sign-in pages --------------------------------------------- */
.anmeldung { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--rc-kuehl-2); }
.anmeldung main { flex: 1 0 auto; width: 100%; max-width: 30rem; padding: clamp(32px, 8vh, 88px) var(--rand) var(--s7); }
.anmeldung--breit main { max-width: 52rem; }
.anmeldung__marke { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); color: var(--rc-nacht); }
.anmeldung__marke svg { height: 17px; width: auto; fill: currentColor; }
.anmeldung__marke span { font-size: var(--t-meta); font-weight: 600; color: var(--rc-schiefer); padding-left: var(--s3); box-shadow: inset 1.5px 0 0 var(--rc-umriss); line-height: 1.2; }
.bogen { background: var(--rc-weiss); border-radius: var(--rc-rund); padding: clamp(24px, 4vw, 40px); box-shadow: 0 0 0 1px var(--rc-kuehl); }
.bogen h1 { font-size: clamp(1.5rem, 1.3rem + .6vw, 1.875rem); text-wrap: balance; }
.bogen__unter { margin-top: var(--s2); color: var(--rc-schiefer); font-size: 1rem; }
.bogen form { margin-top: var(--s5); }
.bogen .btn.primary { margin-top: var(--s4); }
.bogen .flash { margin: var(--s5) 0 0; }
.bogen__fuss { margin-top: var(--s5); font-size: var(--t-meta); color: var(--rc-schiefer); }
.bogen input[type="email"] { min-height: 52px; font-size: 1.0625rem; padding: 0 16px; }
.anmeldung__fuss { padding: 0 var(--rand) var(--s5); text-align: center; font-size: var(--t-klein); color: var(--rc-schiefer); }

/* Steps (TOTP setup) */
.schritte { margin: var(--s5) 0 0; padding: 0; list-style: none; counter-reset: schritt; display: grid; gap: var(--s3); }
.schritte li { counter-increment: schritt; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); align-items: start; }
.schritte li::before {
  content: counter(schritt); width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--rc-nacht); color: var(--rc-weiss);
  font-size: var(--t-meta); font-weight: 700;
}
.schritte strong { display: block; font-weight: 600; line-height: 1.3; padding-top: 4px; }
.schritte small { display: block; font-size: var(--t-meta); color: var(--rc-schiefer); }

.einrichten { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); margin-top: var(--s5); }
.einrichten .schritte { margin-top: 0; }
@media (min-width: 720px) {
  .einrichten { grid-template-columns: auto minmax(0, 1fr); gap: var(--s6); align-items: center; }
}
.einrichten__eingabe { margin-top: var(--s6); padding-top: var(--s5); box-shadow: inset 0 1px 0 var(--rc-kuehl); }

/* QR: large and crisp. The SVG carries its own white quiet zone (4 modules);
   the white sheet around it adds more for phones held at an angle. */
.qr-box {
  justify-self: center; width: fit-content; padding: 16px; background: var(--rc-weiss);
  border-radius: var(--rc-rund-blatt); box-shadow: var(--rc-papier-schatten);
}
.qr-box svg {
  width: 288px; height: 288px; min-width: 240px; min-height: 240px;
  max-width: calc(100vw - 2 * var(--rand) - 2 * clamp(24px, 4vw, 40px) - 32px);
  max-height: calc(100vw - 2 * var(--rand) - 2 * clamp(24px, 4vw, 40px) - 32px);
  shape-rendering: crispEdges;
}
.qr-box svg path { shape-rendering: crispEdges; }

.geheimnis__reihe { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: 6px; }
code.geheimnis__wert {
  display: inline-block; padding: 10px 14px; border-radius: var(--rc-rund);
  background: var(--rc-kuehl-2); box-shadow: inset 0 0 0 1.5px var(--rc-kuehl);
  font-family: var(--rc-mono); font-size: 1rem; font-weight: 600; letter-spacing: .02em; color: var(--rc-nacht);
  user-select: all; -webkit-user-select: all; line-height: 1.6; max-width: 100%;
}
/* Groups of four without whitespace in the text, so a copy or a script reads the plain secret. */
code.geheimnis__wert span { display: inline-block; margin-right: .6em; }
code.geheimnis__wert span:last-child { margin-right: 0; }
.einrichten__felder { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
@media (min-width: 720px) { .einrichten__felder { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; } }
.einrichten__felder form { margin-top: 0; }
.kopiert { font-size: var(--t-meta); color: var(--rc-schiefer); }

.code-eingabe {
  width: 100%; max-width: 15rem; min-height: 64px !important; padding: 0 18px !important;
  font-size: 1.875rem !important; font-weight: 600 !important; letter-spacing: .32em;
  font-variant-numeric: tabular-nums; font-family: var(--rc-sans);
}
.code-eingabe::placeholder { letter-spacing: .32em; color: var(--rc-umriss); }

/* ---------- 9 · Case detail ----------------------------------------------- */
.dokument + .dokument { margin-top: var(--s6); }
.dokument__kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.dokument__titel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-width: 0; }
.dokument__titel strong { font-size: 1rem; }
.dokument__titel .leise { font-size: var(--t-meta); overflow-wrap: anywhere; }
.dokument__inhalt { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
@media (min-width: 1100px) { .dokument__inhalt--mit-seiten { grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); align-items: start; } }

/* Page viewer: the desk, the sheet, the marker (DS §7). Paper corners and shadow. */
.seiten { background: var(--rc-kuehl); border-radius: var(--rc-rund); padding: var(--s4); display: grid; gap: var(--s4); }
@media (min-width: 1100px) { .seiten { position: sticky; top: calc(var(--kopf) + var(--s4)); max-height: calc(100vh - var(--kopf) - 32px); overflow: auto; } }
.seite figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); margin-top: var(--s2); font-size: var(--t-klein); color: var(--rc-schiefer); }
.seite figcaption a { color: var(--rc-schiefer); }
.blatt { position: relative; background: var(--rc-weiss); border-radius: var(--rc-rund-blatt); box-shadow: var(--rc-papier-schatten); overflow: hidden; }
.blatt img { width: 100%; height: auto; }
.mk {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--rc-marker); mix-blend-mode: multiply;
  border-radius: 3px 8px 4px 9px / 7px 3px 8px 3px; transform: rotate(-.35deg);
  transition: opacity .15s;
}
.seiten.hat-auswahl .mk { opacity: .28; }
.seiten.hat-auswahl .mk.ist-aktiv { opacity: 1; }
.ohne-bild { padding: var(--s4); background: var(--rc-weiss); border-radius: var(--rc-rund-blatt); font-size: var(--t-meta); color: var(--rc-schiefer); }
.ohne-bild a { color: var(--rc-nacht); }
tr[data-feld] { cursor: default; }
tr.ist-aktiv td { background: var(--rc-kuehl-2); }


/* Findings */
.befunde { display: grid; gap: var(--s3); }
.befund { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: var(--s3); align-items: start; }
.befund::before { content: ""; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; border: 2px solid var(--rc-nacht); }
.befund__kopf { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.befund__kopf strong { font-family: var(--rc-mono); font-size: var(--t-meta); font-weight: 600; }
.befund p { margin-top: 2px; }
.befund .leise { font-size: var(--t-meta); }

/* Provider requests, letters */
.zeilen { display: grid; gap: var(--s2); }
.zeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--rc-kuehl); }
.zeile:first-child { border-top: 0; padding-top: 0; }
.zeile:last-child { padding-bottom: 0; }
.zeile__text { min-width: 0; }
.zeile__text .leise { font-size: var(--t-meta); }

/* Timeline (DS §8 Zeitleiste, compact) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: var(--s3); padding: 6px 0 6px 22px; font-size: var(--t-meta); }
.timeline li::before { content: ""; position: absolute; left: 0; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--rc-nacht); }
.timeline li::after { content: ""; position: absolute; left: 4px; top: 22px; bottom: -6px; width: 2px; background: var(--rc-kuehl); }
.timeline li:last-child::after { display: none; }
.timeline li.muted { padding-left: 0; display: block; }
.timeline li.muted::before, .timeline li.muted::after { display: none; }
.timeline time { color: var(--rc-schiefer); white-space: nowrap; }
.timeline strong { font-family: var(--rc-mono); font-weight: 600; font-size: .92em; }
@media (max-width: 599px) { .timeline li { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* Two-up grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5) var(--s6); }
.abschnitt + .grid-2, .grid-2 + .abschnitt { margin-top: var(--s7); }
.grid-2 > .abschnitt { margin-top: 0; }
@media (max-width: 899px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 10 · Funnel bars ---------------------------------------------- */
.kennzahl { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s4); }
.kennzahl strong { font-size: 2.25rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kennzahl span { color: var(--rc-schiefer); }
.balken-zelle { width: 40%; }
.balken { height: 8px; background: var(--rc-kuehl-2); border-radius: 2px; overflow: hidden; min-width: 60px; }
.balken i { display: block; height: 100%; background: var(--rc-nacht); border-radius: 2px; }
.funnel-block h3 { margin: var(--s5) 0 var(--s2); }
.funnel-block h3:first-of-type { margin-top: 0; }

/* Users: invite row */
.einladen { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: var(--s3) var(--s4); align-items: end; }
@media (max-width: 699px) { .einladen { grid-template-columns: minmax(0, 1fr); } .einladen .btn { width: 100%; } }
.einladen__hinweis { margin-top: var(--s3); }
.panel h2 { margin-bottom: var(--s3); }
.rolle-wahl select { min-height: 36px; font-size: var(--t-meta); width: auto; min-width: 10.5rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
