/* ==========================================================================
   Client Portal UI — Radix Themes look, plain CSS, no React.
   Load AFTER radix-colors.css.

   Accent : indigo      Gray : sand        (waermer als Radix' Vorschlag slate:
                                          das Haus schreibt auf Papier, nicht auf Blau)
   Dark mode: add class="dark" to <html>.

   Die Masse stammen aus @radix-ui/themes/styles.css und sind daran
   abgeglichen: Groessenskala, Radien je Groesse, Alpha-Stufen fuer alle
   weichen Flaechen, Rahmen und leise Schrift, Fokus als Outline.

   Absichtlich anders, damit es niemand versehentlich zurueckbaut:
   - Schrift ist Inter statt der Systemschrift. Es ist unsere Hausschrift
   - .btn--ghost ist grau, das entspricht Radix' variant=ghost color=gray.
     Ein Akzent-Ghost gibt es hier nicht, es gibt nichts, was ihn braucht
   - .heading-4 und .sidebar__label sind versalisierte Etiketten. Radix hat
     dafuer keine Komponente, das ist unsere Zutat
   - Knoepfe zeigen den Zeigefinger. Radix laesst den Pfeil stehen
   ========================================================================== */

/* --- 0. Schriften -------------------------------------------------------
   Inter liegt selbst dabei, nicht per URL von leokawa.design. Ein Render, der
   auf eine fremde Seite wartet, ist langsam und faellt aus, sobald die klemmt.
   Der Display-Schnitt ist der engere: gebaut fuer grosse Grade, deshalb nur
   Ueberschriften und Zahlen. Die Pfade sind relativ, damit sie unter /ui.css
   in der Anwendung und in den Vorschauen in design/ gleich stimmen.
   ------------------------------------------------------------------------ */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/Inter-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/Inter-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/Inter-Bold.woff2') format('woff2'); }

@font-face { font-family: 'Inter Display'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/Inter-DisplayMedium.woff2') format('woff2'); }
@font-face { font-family: 'Inter Display'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/Inter-DisplayBold.woff2') format('woff2'); }

/* --- 1. Scales ---------------------------------------------------------- */

:root {
  /* Space — Radix Themes scale, 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --space-9: 64px;

  /* Radius */
  --radius-1: 3px;
  --radius-2: 4px;
  --radius-3: 6px;
  --radius-4: 8px;
  --radius-5: 12px;
  --radius-6: 16px;

  /* Der Grund, der um einen weissen Block laeuft: Karte und Kennzahl. Steht
     als Marke da, weil drei Regeln ihn brauchen — der Innenabstand der Karte,
     der Radius des Blocks darin und dasselbe noch einmal bei den Kennzahlen.
     Drei Zahlen von Hand waeren drei Zahlen, die auseinanderlaufen. */
  --frame: 5px;

  /* Die Sperrung fuer Versalien. Kleine Grossbuchstaben brauchen Luft, sonst
     lesen sie sich als ein Wort. Gilt fuer den Kopf einer Karte und fuer die
     Beschriftung einer Kennzahl. */
  --ls-caps: 0.06em;
  --radius-full: 9999px;

  /* Type — each size has a matched line-height and tracking */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Display", var(--font-sans);
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --fs-1: 12px;  --lh-1: 16px;  --ls-1:  0.0025em;
  --fs-2: 14px;  --lh-2: 20px;  --ls-2:  0em;
  --fs-3: 16px;  --lh-3: 24px;  --ls-3:  0em;
  --fs-4: 18px;  --lh-4: 26px;  --ls-4: -0.0025em;
  --fs-5: 20px;  --lh-5: 28px;  --ls-5: -0.005em;
  --fs-6: 24px;  --lh-6: 30px;  --ls-6: -0.00625em;
  --fs-7: 28px;  --lh-7: 36px;  --ls-7: -0.0075em;
  --fs-8: 35px;  --lh-8: 40px;  --ls-8: -0.01em;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-bold: 700;

  /* Shadows — die Werte aus @radix-ui/themes, hell. Der dunkle Satz steht
     unten in .dark. Radix traegt Flaechen ueber Raender, nicht ueber Hoehe:
     --card-line ist der ganze Rahmen einer Karte, ohne Schlagschatten. */
  --card-line:    0 0 0 1px var(--sand-a5);
  --card-line-hv: 0 0 0 1px var(--sand-a7);
  --shadow-1: inset 0 0 0 1px var(--sand-a5), inset 0 1.5px 2px 0 var(--sand-a2),
              inset 0 1.5px 2px 0 var(--black-a2);
  --shadow-2: 0 0 0 1px var(--sand-a3), 0 0 0 0.5px var(--black-a1),
              0 1px 1px 0 var(--sand-a2), 0 2px 1px -1px var(--black-a1),
              0 1px 3px 0 var(--black-a1);
  --shadow-3: 0 0 0 1px var(--sand-a3), 0 2px 3px -2px var(--sand-a3),
              0 3px 12px -4px var(--black-a2), 0 4px 16px -8px var(--black-a2);
  --shadow-4: 0 0 0 1px var(--sand-a3), 0 8px 40px var(--black-a1),
              0 12px 32px -16px var(--sand-a3);

  --transition: 120ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. Semantic tokens -------------------------------------------------
   Views should reference THESE, never --sand-6 directly. Swapping accent
   colour later then means editing this block only. */

:root, .light {
  --bg-page:        #ffffff;                 /* Radix --color-background */
  --bg-panel:       #ffffff;                 /* Radix --color-panel-solid */
  --bg-surface:     var(--sand-2);          /* Seitenleiste, Kontaktblock */
  --bg-subtle:      var(--sand-3);
  --field-surface:  rgba(255, 255, 255, 0.85); /* Radix --color-surface */

  /* Raender liegen bei Radix auf den Alpha-Stufen, damit sie ueber jedem
     Grund gleich wirken. a5 Karte, a6 Trenner, a7 Feld, a8 kraeftig. */
  --border-subtle:  var(--sand-a5);
  --border-sep:     var(--sand-a6);
  --border-normal:  var(--sand-a7);
  --border-strong:  var(--sand-a8);

  --text-high:      var(--sand-12);
  --text-low:       var(--sand-a11);
  --text-faint:     var(--sand-a10);

  --accent-solid:   var(--indigo-9);
  --accent-hover:   var(--indigo-10);
  --accent-contrast: #ffffff;                /* Schrift auf --accent-solid */
  --accent-soft:    var(--indigo-a3);
  --accent-soft-hv: var(--indigo-a4);
  --accent-border:  var(--indigo-a8);
  --accent-text:    var(--indigo-a11);
  --accent-ring:    var(--indigo-8);

  --neutral-soft:    var(--sand-a3);
  --neutral-soft-hv: var(--sand-a4);
}

.dark {
  --bg-page:        var(--sand-1);
  --bg-panel:       var(--sand-2);
  --bg-surface:     var(--sand-2);
  --bg-subtle:      var(--sand-3);
  --field-surface:  rgba(0, 0, 0, 0.25);

  --shadow-1: inset 0 -1px 1px 0 var(--sand-a3), inset 0 0 0 1px var(--sand-a3),
              inset 0 3px 4px 0 var(--black-a5), inset 0 0 0 1px var(--sand-a4);
  --shadow-2: 0 0 0 1px var(--sand-a6), 0 0 0 0.5px var(--black-a3),
              0 1px 1px 0 var(--black-a6), 0 2px 1px -1px var(--black-a6),
              0 1px 3px 0 var(--black-a5);
  --shadow-3: 0 0 0 1px var(--sand-a6), 0 2px 3px -2px var(--black-a3),
              0 3px 8px -2px var(--black-a6), 0 4px 12px -4px var(--black-a7);
  --shadow-4: 0 0 0 1px var(--sand-a6), 0 8px 40px var(--black-a3),
              0 12px 32px -16px var(--black-a5);
}

/* --- 3. Reset & base ---------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-high);
  font-family: var(--font-sans);
  font-size: var(--fs-3);
  line-height: var(--lh-3);
  letter-spacing: var(--ls-3);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure { margin: 0; }

/* Radix unterstreicht erst beim Zeigen, und zwar duenn und tiefgestellt. */
:where(a) {
  color: var(--accent-text); text-decoration-line: none;
  text-decoration-color: var(--accent-a5);
  text-decoration-thickness: min(2px, max(1px, 0.05em));
  text-underline-offset: calc(0.025em + 2px);
}
:where(a):hover { text-decoration-line: underline; }

/* Radix setzt den Ring nach aussen, wo eine gefuellte Flaeche ihn sonst
   verdeckt, und nach innen, wo der Rahmen selbst duenn ist. */
:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
  border-radius: var(--radius-2);
}
.btn--soft:focus-visible, .btn--ghost:focus-visible, .btn--outline:focus-visible,
.btn--neutral:focus-visible, .btn--danger:focus-visible,
.navlink:focus-visible, .card:focus-visible, .check input:focus-visible {
  outline-offset: -1px;
}

/* --- 4. Layout ---------------------------------------------------------- */

.container { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 var(--space-5); }
.container--wide { max-width: 1140px; }

.stack     { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--2  { gap: var(--space-2); }
.stack--3  { gap: var(--space-3); }
.stack--5  { gap: var(--space-5); }
.stack--6  { gap: var(--space-6); }

/* Two columns that collapse. Used on the portal and the admin company page. */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }
/* Zwei .cols untereinander sind Geschwister, das Formular dazwischen gibt
   nichts her. Ohne diese Zeile klebt die Beschriftung der naechsten Zeile am
   Feld darueber und gehoert optisch zur falschen Zeile. */
.cols + .cols { margin-top: var(--space-4); }
/* Unter 1000px untereinander. Zwei Spalten auf einem schmalen Fenster sind im
   CRM nicht dicht, sondern eng. Stand bisher nur im <style> der Admin-Vorschau. */
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.row       { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer    { flex: 1; }

.section { padding-block: var(--space-7); }

/* --- 5. Typography ------------------------------------------------------ */

/* Der Display-Schnitt ab 24px, darunter der Textschnitt. Inter Display ist
   enger gezeichnet und wird klein gesetzt eng statt praegnant. */
.heading-1 { font-family: var(--font-display);
             font-size: var(--fs-8); line-height: var(--lh-8); letter-spacing: var(--ls-8); font-weight: var(--fw-bold); }
.heading-2 { font-family: var(--font-display);
             font-size: var(--fs-6); line-height: var(--lh-6); letter-spacing: var(--ls-6); font-weight: var(--fw-bold); }
.heading-3 { font-size: var(--fs-4); line-height: var(--lh-4); letter-spacing: var(--ls-4); font-weight: var(--fw-bold); }
.heading-4 { font-size: var(--fs-2); line-height: var(--lh-2); letter-spacing: var(--ls-2); font-weight: var(--fw-medium);
             text-transform: uppercase; color: var(--text-low); }

.text-1 { font-size: var(--fs-1); line-height: var(--lh-1); letter-spacing: var(--ls-1); }
.text-2 { font-size: var(--fs-2); line-height: var(--lh-2); letter-spacing: var(--ls-2); }
.text-3 { font-size: var(--fs-3); line-height: var(--lh-3); letter-spacing: var(--ls-3); }

.muted     { color: var(--text-low); }
.faint     { color: var(--text-faint); }
.medium    { font-weight: var(--fw-medium); }
.mono      { font-family: var(--font-mono); font-size: 0.9em; }
.tabular   { font-variant-numeric: tabular-nums; }

/* --- 6. Button ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  height: 32px; padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-2);
  font: inherit; font-size: var(--fs-2); line-height: var(--lh-2);
  letter-spacing: var(--ls-2);
  font-weight: var(--fw-medium);
  cursor: pointer; white-space: nowrap;
  /* Ein Verweis, der wie ein Knopf aussieht, unterstreicht nicht. Radix setzt
     das im BaseButton, bei uns kaeme es sonst aus der Regel fuer a:hover. */
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
              box-shadow var(--transition);
}
.btn:hover { text-decoration: none; }
/* Radix blasst nicht ab, sondern faerbt um: grauer Grund, graue Schrift. */
.btn:disabled { background: var(--sand-a3); color: var(--sand-a8); cursor: not-allowed; box-shadow: none; }

.btn--sm { height: 24px; padding: 0 var(--space-2); font-size: var(--fs-1); line-height: var(--lh-1);
           letter-spacing: var(--ls-1); border-radius: var(--radius-1); gap: var(--space-1); }
.btn--lg { height: 40px; padding: 0 var(--space-4); font-size: var(--fs-3); line-height: var(--lh-3);
           letter-spacing: var(--ls-3); border-radius: var(--radius-3); gap: var(--space-3); }

/* solid — one per screen, maximum */
.btn--solid { background: var(--accent-solid); color: var(--accent-contrast); }
.btn--solid:hover:not(:disabled) { background: var(--accent-hover); }

/* soft — the workhorse */
.btn--soft { background: var(--accent-soft); color: var(--accent-text); }
.btn--soft:hover:not(:disabled) { background: var(--accent-soft-hv); }

.btn--outline { background: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-border); }
.btn--outline:hover:not(:disabled) { background: var(--accent-soft); }

.btn--ghost { background: transparent; color: var(--text-low); }
.btn--ghost:hover:not(:disabled) { background: var(--neutral-soft); color: var(--text-high); }

.btn--neutral { background: var(--neutral-soft); color: var(--text-high); }
.btn--neutral:hover:not(:disabled) { background: var(--neutral-soft-hv); }

.btn--danger { background: var(--red-a3); color: var(--red-a11); }
.btn--danger:hover:not(:disabled) { background: var(--red-a4); }

/* Ein Knopf, der wartet. Manches dauert laenger als einen Klick: eine PDF
   setzt WeasyPrint in einem eigenen Prozess, eine Mail geht zu Postmark, eine
   Datei wandert in die Ablage. Solange sagt der Knopf es selbst, statt dass
   die Seite still dasteht und man ein zweites Mal drueckt.

   Der Ring steht vor der Beschriftung. Damit sie nicht zur Seite rutscht,
   haelt ui.js vorher die Breite fest. */
.btn--loading { cursor: progress; pointer-events: none; }
.btn--loading::before {
  content: ''; flex: none;
  width: 1em; height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0.75;
  animation: dreht 700ms linear infinite;
}
@keyframes dreht { to { transform: rotate(1turn); } }

/* Wer weniger Bewegung eingestellt hat, bekommt die Drehung langsam. Ganz
   ohne Bewegung waere der Ring ein Punkt, der nichts sagt, und die Auskunft
   „es laeuft noch" ist genau das, was hier gebraucht wird. */
@media (prefers-reduced-motion: reduce) {
  .btn--loading::before { animation-duration: 1600ms; }
}

/* --- 7. Card / Panel ---------------------------------------------------- */

/* Radix paart Innenmass und Radius: space-4 mit radius-4, space-5 mit
   radius-5. Und die Karte traegt einen Rahmen, keinen Schatten. */
/* Eine Karte ist ein weisser Block in einem schmalen Rahmen: der Grund läuft
   drei Pixel aussen herum, wie bei den Kennzahlen. Der Rahmen ist kein Strich,
   sondern eine Fläche, und deshalb trägt er auch den Fuss, wo einer steht.

   Der weisse Block liegt als Pseudo-Element dahinter statt als eigenes
   Element: sonst bräuchte jede der vierzig Karten im Haus einen Behälter mehr,
   und eine vergessene sähe anders aus als der Rest. Der Inhalt steht darüber,
   dafür das `position: relative` an den Kindern. */
/* Eine Karte ist ein Rahmen aus Grund: fuenf Pixel rundherum, und darin ein
   weisser Block mit eigener Linie und eigener Rundung. Der Kopf sitzt auf dem
   Grund, ueber dem Block, nicht in ihm — sonst liefe die Linie um das Band
   herum, und die Linie gehoert dem Weiss.

   Der Block ist ein eigenes Element und kein Pseudo: nur so faengt er unter
   dem Kopf an und ist an allen vier Ecken rund. Mit einem Pseudo-Element im
   Ruecken war die obere Kante immer verdeckt, und jeder Ersatz dafuer war zu
   breit oder schnitt die Ecken an. */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-5);
  padding: var(--frame);
}
.card__body {
  background: var(--bg-panel);
  border: 1px solid var(--sand-a4);
  border-radius: calc(var(--radius-5) - var(--frame));
  padding: var(--space-5);
  transition: border-color var(--transition);
}
.card--flush .card__body { padding: 0; overflow: hidden; }
.card--raised .card__body { box-shadow: var(--shadow-3); }
a.card:hover .card__body, button.card:hover .card__body, label.card:hover .card__body {
  border-color: var(--sand-a7);
}

/* Der Kopf steht auf dem Grund und traegt keine eigene Linie: was ihn vom
   Block trennt, sind die fuenf Pixel Grund darunter.

   Die Ueberschrift wird klein und gesperrt: sie sagt, was in dem Block steht,
   und das ist ein Etikett und keine Ansage. Gross ist der Inhalt. */
.card__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-3);
}
.card__header .heading-3 {
  font-size: var(--fs-1); line-height: var(--lh-1);
  font-weight: var(--fw-medium); color: var(--text-low);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
}

/* --- 8. Badge ----------------------------------------------------------- */

/* Keine feste Hoehe: Radix laesst das Abzeichen aus Zeilenhoehe und
   Innenabstand wachsen, 2px oben und unten, 6px an den Seiten. */
.badge {
  display: inline-flex; align-items: center; flex: none;
  gap: calc(var(--space-1) * 1.5);
  padding: calc(var(--space-1) * 0.5) calc(var(--space-1) * 1.5);
  border-radius: var(--radius-1);
  font-size: var(--fs-1); line-height: var(--lh-1); font-weight: var(--fw-medium);
  letter-spacing: var(--ls-1); white-space: nowrap;
  background: var(--sand-a3); color: var(--sand-a11);
}
.badge--accent { background: var(--indigo-a3); color: var(--indigo-a11); }
.badge--green  { background: var(--green-a3);  color: var(--green-a11); }
.badge--amber  { background: var(--amber-a3);  color: var(--amber-a11); }
.badge--red    { background: var(--red-a3);    color: var(--red-a11); }
.badge--solid  { background: var(--accent-solid); color: var(--accent-contrast); }

.dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; flex: none; }

/* --- 9. Form fields ----------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: var(--space-1); }

/* Abschnitt in einer langen Maske. Die Linie trennt, die Ueberschrift
   benennt. Radix baut das aus Separator und Heading, hier ist es eine Klasse,
   damit der Abstand nicht in jeder Ansicht neu getippt wird. */
.form-section {
  margin: var(--space-5) 0 var(--space-2);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-sep);
}

.label { font-size: var(--fs-2); line-height: var(--lh-2); font-weight: var(--fw-medium); color: var(--text-high); }
.label__req { color: var(--red-a11); margin-left: 2px; }
.help { font-size: var(--fs-1); line-height: var(--lh-1); color: var(--text-low); }

/* Radix: Flaeche --color-surface, Rahmen auf der Alpha-Stufe 7, Radius 2,
   seitlich space-2. Der Fokus ist ein Outline nach innen, kein zweiter
   Ring, sonst waechst das Feld beim Anklicken optisch um zwei Pixel. */
.input, .textarea, .select {
  width: 100%;
  background: var(--field-surface);
  color: var(--text-high);
  border: 0; border-radius: var(--radius-3);
  box-shadow: inset 0 0 0 1px var(--border-normal);
  font: inherit; font-size: var(--fs-3); line-height: var(--lh-3);
  letter-spacing: var(--ls-3);
  padding: var(--space-3);
  transition: box-shadow var(--transition);
}
.input  { height: 40px; padding-block: 0; }
.select { height: 40px; padding-block: 0; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-low) 50%),
                    linear-gradient(135deg, var(--text-low) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: var(--space-7);
}
.textarea { min-height: 88px; resize: vertical; }

.input::placeholder, .textarea::placeholder { color: var(--sand-a10); }

.input:focus, .textarea:focus, .select:focus {
  outline: 2px solid var(--accent-ring);
  outline-offset: -1px;
}
.input::selection, .textarea::selection { background: var(--indigo-a5); }

.input[aria-invalid="true"], .textarea[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1px var(--red-a8);
}

/* Checkbox — native input, restyled */
.check { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
/* Radix: 16px, Radius 1, dieselbe Flaeche und derselbe Rahmen wie ein Feld. */
.check input {
  appearance: none; flex: none;
  width: 16px; height: 16px; margin: 4px 0 0;
  border-radius: var(--radius-1);
  background: var(--field-surface);
  box-shadow: inset 0 0 0 1px var(--border-normal);
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
}
.check input:checked {
  background: var(--accent-solid) no-repeat center;
  background-image: url("data:image/svg+xml,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 5.5L4 8L9.5 2.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  box-shadow: none;
}

/* --- 10. Progress ------------------------------------------------------- */

.progress {
  height: 6px; border-radius: var(--radius-full);
  background: var(--sand-a3); box-shadow: inset 0 0 0 1px var(--sand-a4);
  overflow: hidden;
}
.progress__bar {
  height: 100%; border-radius: inherit;
  background: var(--accent-solid);
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Phase stepper */
.phases { display: flex; flex-direction: column; gap: 0; }
.phase { display: flex; gap: var(--space-3); padding-block: var(--space-3); position: relative; }
.phase:not(:last-child)::before {
  content: ""; position: absolute; left: 8px; top: 28px; bottom: -4px;
  width: 1px; background: var(--border-subtle);
}
.phase__marker {
  flex: none; width: 17px; height: 17px; margin-top: 3px;
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  background: var(--bg-panel); position: relative; z-index: 1;
}
.phase--done .phase__marker {
  background: var(--green-9) no-repeat center; box-shadow: none;
  background-image: url("data:image/svg+xml,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 5.5L4 8L9.5 2.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.phase--active .phase__marker { box-shadow: inset 0 0 0 5px var(--accent-solid); }
.phase--pending .phase__title { color: var(--text-low); }   /* default state */
.phase__body { min-width: 0; }
.phase--done .phase__title { color: var(--text-low); }

/* --- 10b. Toast und Dialog ----------------------------------------------
   Die Bewegung folgt der Regel aus dem Easing-Blueprint: was hereinkommt,
   laeuft mit ease-out, ist also sofort da und wird langsamer. Was hinausgeht,
   laeuft mit ease-in und darf beschleunigen. Die Kurve herein hat einen Hauch
   Ueberschwingen, damit der Toast auftaucht und nicht einschwebt.
   ------------------------------------------------------------------------ */

.toast {
  position: fixed; z-index: 50;
  right: var(--space-5); bottom: var(--space-5); max-width: 380px;
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-4);
  background: var(--bg-panel); color: var(--text-high);
  box-shadow: var(--shadow-3);
  font-size: var(--fs-2); line-height: var(--lh-2);
  cursor: pointer;

  opacity: 0; transform: translateY(12px) scale(0.98);
  transition: opacity 180ms cubic-bezier(0.4, 0, 1, 1),
              transform 180ms cubic-bezier(0.4, 0, 1, 1);
}
.toast--in {
  opacity: 1; transform: translateY(0) scale(1);
  transition: opacity 320ms cubic-bezier(0.21, 1.02, 0.73, 1),
              transform 320ms cubic-bezier(0.21, 1.02, 0.73, 1);
}
.toast__punkt {
  width: 8px; height: 8px; margin-top: 6px; flex: none;
  border-radius: var(--radius-full); background: var(--green-9);
}
.toast--weg .toast__punkt { background: var(--sand-9); }
.toast--fehler .toast__punkt { background: var(--red-9); }

@media (max-width: 520px) {
  .toast { right: var(--space-4); left: var(--space-4); bottom: var(--space-4); max-width: none; }
}

/* Der Dialog kommt aus der Mitte entgegen, dieselbe Regel wie beim Toast. */
.dialog {
  border: 0; padding: var(--space-5);
  border-radius: var(--radius-5);
  background: var(--bg-panel); color: var(--text-high);
  box-shadow: var(--shadow-4);
  width: min(420px, calc(100vw - var(--space-6)));
  font: inherit; font-size: var(--fs-2);
}
.dialog::backdrop { background: var(--black-a6); }

@media (prefers-reduced-motion: no-preference) {
  .dialog[open] { animation: dialog-herein 200ms cubic-bezier(0.21, 1.02, 0.73, 1); }
  .dialog[open]::backdrop { animation: verblassen 200ms ease-out; }
}
@keyframes dialog-herein {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes verblassen { from { opacity: 0; } to { opacity: 1; } }

/* Wer weniger Bewegung eingestellt hat, bekommt die Meldung ohne Weg. Sie
   verschwindet trotzdem von selbst, das erledigt die Uhr in ui.js. */
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; transform: none; }
}

/* Die Lade. Ein Formular, das von rechts hereinkommt, statt die Seite
   auseinanderzuschieben. Sichtbar ist der Grundzustand: ohne JavaScript steht
   sie offen da, sobald die Adresse sie aufruft. Zugeschoben wird sie durch
   eine Klasse, und nur die trägt den Weg. */
.drawer {
  position: fixed; inset: 0 0 0 auto; z-index: 40;
  width: min(560px, 100vw); max-width: 100vw; max-height: 100vh; height: 100%;
  margin: 0; border: 0; padding: var(--space-5) var(--space-6) var(--space-7);
  background: var(--bg-panel); color: var(--text-high);
  box-shadow: var(--shadow-4);
  overflow-y: auto;
  font: inherit; font-size: var(--fs-3);
  transform: translateX(0);
  transition: transform 320ms cubic-bezier(0.21, 1.02, 0.73, 1);
}
.drawer--closed { transform: translateX(100%); transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.drawer::backdrop { background: var(--black-a6); transition: opacity 200ms ease-out; }
.drawer--closed::backdrop { opacity: 0; }

.drawer__kopf {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-5);
}

@media (max-width: 620px) { .drawer { width: 100vw; padding: var(--space-4); } }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

/* --- 11. Callout -------------------------------------------------------- */

.callout {
  display: flex; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-4);
  background: var(--accent-soft); color: var(--accent-text);
  font-size: var(--fs-2); line-height: var(--lh-2);
}
.callout--amber { background: var(--amber-a3); color: var(--amber-a11); }
.callout--red   { background: var(--red-a3);   color: var(--red-a11); }
.callout--green { background: var(--green-a3); color: var(--green-a11); }
.callout--gray  { background: var(--sand-a3); color: var(--sand-a11); }
.callout__icon  { flex: none; margin-top: 1px; }

/* --- 12. Task list ------------------------------------------------------ */

.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.task:last-child { border-bottom: 0; }
.task__body { flex: 1; min-width: 0; }
.task__title { font-size: var(--fs-2); line-height: var(--lh-2); }
.task__meta { font-size: var(--fs-1); line-height: var(--lh-1); color: var(--text-low); margin-top: 2px; }
.task--done .task__title { color: var(--text-faint); text-decoration: line-through; }

/* --- 13. Separator, table, avatar --------------------------------------- */

.separator { height: 1px; background: var(--border-sep); border: 0; margin: 0; }

/* Radix schreibt Spaltenkoepfe fett in Textgroesse, nicht klein und
   versalisiert, und zieht die Zeilenlinie auf der Alpha-Stufe 5. */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-2); line-height: var(--lh-2); }
.table th {
  text-align: left; font-weight: var(--fw-bold); color: var(--text-high);
  padding: var(--space-3); border-bottom: 1px solid var(--border-subtle);
}
.table td { padding: var(--space-3); border-bottom: 1px solid var(--border-subtle); }
.table th, .table td { height: 44px; }
.table tr:last-child td { border-bottom: 0; }

/* Radix rundet das Avatar ab, es kreist es nicht ein. */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none;
  border-radius: var(--radius-2);
  background: var(--indigo-9); color: var(--accent-contrast);
  font-size: var(--fs-2); font-weight: var(--fw-medium); line-height: 1;
  letter-spacing: var(--ls-2); text-transform: uppercase;
}

/* --- 14. Empty state ---------------------------------------------------- */

.empty {
  text-align: center; padding: var(--space-7) var(--space-5);
  color: var(--text-low); font-size: var(--fs-2);
}

/* --- 15. Autosave indicator --------------------------------------------- */

.saved {
  font-size: var(--fs-1); color: var(--green-a11);
  opacity: 0; transition: opacity 200ms;
}
.saved--on { opacity: 1; }


/* ==========================================================================
   ADMIN / CRM
   Deliberately denser than the portal: you're in here daily, scanning beats
   scrolling. Same tokens, tighter spacing.
   ========================================================================== */

/* --- 16. App shell ------------------------------------------------------ */

.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* So hoch wie das Fenster, nicht wie der Inhalt. Ohne `align-self: start`
   zieht das Raster die Spalte auf die Zeilenhoehe, und `sticky` hat keinen
   Weg mehr: auf einer langen Firmenseite scrollt die Navigation nach oben
   weg und `Abmelden` steht ganz unten im Dokument. `overflow-y` fuer den
   Fall, dass die Punkte selbst laenger werden als das Fenster. */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-4) var(--space-3) var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-5);
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh; overflow-y: auto;
}
/* Alle Gruppen zusammen. Ohne den Behaelter legt sich der Abstand der Leiste
   auf den der Trennlinie. */
.sidebar__menu { display: flex; flex-direction: column; }
.sidebar__group { display: flex; flex-direction: column; gap: calc(var(--space-1) / 2); }

/* Die Ueberschrift einer Gruppe. Klein, grau, in Versalien: sie ordnet, ohne
   sich in die Reihe der Punkte zu stellen. Deshalb auch nicht anklickbar. */
.sidebar__label {
  font-size: var(--fs-1); line-height: var(--lh-1); letter-spacing: var(--ls-1);
  color: var(--text-faint);
  padding: 0 var(--space-2) var(--space-2);
}

/* Die Linie zwischen zwei Gruppen. Sie trennt, wo der Abstand allein nicht
   reicht: sieben Punkte in einer Spalte sehen sonst aus wie eine Liste. */
.sidebar__divider {
  border: 0; border-top: 1px solid var(--border-subtle);
  margin: var(--space-3) var(--space-2);
}

.navlink {
  display: flex; align-items: center; gap: var(--space-3);
  height: 34px; padding: 0 var(--space-3);
  border-radius: var(--radius-3);
  font-size: var(--fs-2); color: var(--text-low); text-decoration: none;
  transition: background var(--transition), color var(--transition),
              box-shadow var(--transition);
}
.navlink:hover { background: var(--neutral-soft); color: var(--text-high); text-decoration: none; }

/* Der Punkt, auf dem man steht: eine weisse Karte auf dem grauen Grund der
   Leiste, mit dem kleinsten Schatten, den das Haus hat. Nicht die Akzentfarbe:
   die Leiste sagt, wo man ist, und nicht, was wichtig ist. Ein blauer Balken
   neben sechs grauen Punkten zieht den Blick an, sooft man auf die Seite
   kommt, und sagt dabei nichts, was man nicht schon weiss. */
.navlink--active {
  background: var(--bg-panel); color: var(--text-high);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-2);
}
.navlink--active:hover { background: var(--bg-panel); }
.navlink--active .icon { opacity: 1; }
.navlink__count { margin-left: auto; font-size: var(--fs-1); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.navlink--active .navlink__count { color: var(--text-low); }

/* Phosphor Icons, 16x16. `flex: none` weil ein langes Wort das Icon sonst
   staucht, und die Farbe kommt ueber currentColor vom Link. */
.navlink .icon { flex: none; width: 16px; height: 16px; opacity: 0.75; }

/* Ausserhalb der Navigation sitzt das Zeichen in der Zeile und soll die
   Grundlinie halten, nicht darauf stehen. */
.icon { flex: none; vertical-align: -0.15em; }

/* Das Zeichen im Plaettchen: weiss auf schwarz. Die Farben kommen aus den
   Tokens und nicht als #000, damit es im dunklen Modus umschlaegt statt
   schwarz auf schwarz zu stehen. */
.icon-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none;
  border-radius: var(--radius-2);
  background: var(--text-high); color: var(--bg-panel);
}
.icon-chip .icon { width: 15px; height: 15px; vertical-align: 0; }
.navlink:hover .icon,
.navlink--active .icon { opacity: 1; }


.main { padding: var(--space-5) var(--space-6); min-width: 0; }

/* Der Weg bis hierher, über der Überschrift. Eine Zeile, klein und grau, mit
   einer Haarlinie darunter: sie ordnet die Seite ein, ohne sich vor sie zu
   stellen. Die Linie läuft über die ganze Breite, deshalb die negativen
   Ränder — sie gehört zum Fenster und nicht zum Text. */
.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--space-2);
  margin: calc(var(--space-5) * -1) calc(var(--space-6) * -1) var(--space-5);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-1); line-height: var(--lh-1);
}
.breadcrumb__step { color: var(--text-low); text-decoration: none; }
a.breadcrumb__step:hover { color: var(--text-high); text-decoration: none; }
.breadcrumb__step--current { color: var(--text-high); font-weight: var(--fw-medium); }
.breadcrumb__sep { color: var(--text-faint); }

@media (max-width: 860px) {
  .breadcrumb {
    margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-4);
    padding: var(--space-3) var(--space-4);
  }
}
@media (max-width: 860px) { .main { padding: var(--space-4); } }

/* Der Kopf fuer schmale Fenster. Die Seitenleiste verschwindet unter 860px,
   und im Portal sitzt dort der einzige Weg zurueck und der Abmeldeknopf: ein
   Kunde am Telefon haette sonst keine Navigation mehr. Im CRM bleibt er aus,
   Leo arbeitet am grossen Bildschirm. */
.topbar { display: none; }
@media (max-width: 860px) {
  .topbar {
    display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
  }
  .topbar .navlink { height: 28px; }
}

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }

/* Der Weg zurueck steht ueber der Ueberschrift, nicht daneben. Radix hat
   dafuer keine Komponente, das Zeichen ist ein Kleiner-als, kein Icon. */
.backlink {
  display: inline-block; margin-bottom: var(--space-1);
  font-size: var(--fs-2); line-height: var(--lh-2); letter-spacing: var(--ls-2);
  color: var(--text-low);
}
.backlink:hover { color: var(--text-high); text-decoration: none; }

/* --- 17. Stat tiles ----------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-3); }
.stat {
  background: var(--bg-panel); border-radius: var(--radius-5);
  box-shadow: var(--shadow-2); padding: var(--space-4);
}

/* Die Beschriftung in Versalien, klein und gesperrt. Sie sagt, was die Zahl
   ist, und soll dabei neben ihr nicht mitreden: gross ist die Zahl. */
.stat__label {
  font-size: var(--fs-1); color: var(--text-low);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  margin-bottom: var(--space-1);
}
.stat__value { font-family: var(--font-display);
               font-size: var(--fs-6); line-height: var(--lh-6); letter-spacing: var(--ls-6);
               font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.stat__delta { font-size: var(--fs-1); color: var(--text-faint); margin-top: 2px; }
.stat--warn .stat__value { color: var(--red-a11); }
.stat--good .stat__value { color: var(--green-a11); }

/* Eine Kennzahl in der Reihe ist eine Karte in einem Rahmen: der graue Grund
   laeuft schmal aussen herum und wird unten zum Streifen mit der Einordnung.
   Deshalb der eigene Behaelter um Beschriftung und Zahl — zwei Geschwister
   lassen sich nicht gemeinsam unterlegen.

   Ausserhalb der Reihe bleibt die Kennzahl eine Zeile: im Seitenkopf steht sie
   ohne Karte, und ein Rahmen um nichts waere ein Kasten ohne Kasten. */
.stats .stat {
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border-radius: var(--radius-5);
  box-shadow: none;
  /* Der Grund rundherum. Fuenf Pixel: er soll den weissen Block einfassen und
     nicht neben ihm stehen. */
  padding: var(--frame);
}
.stats .stat__body {
  /* Waechst mit: die Karten in der Reihe sind gleich hoch, und ohne das
     klaffte der Grund zwischen Zahl und Fuss. */
  flex: 1;
  background: var(--bg-panel);
  border-radius: calc(var(--radius-5) - var(--frame));
  /* Eine Linie statt eines Schattens: der Block liegt nicht ueber dem Grund,
     er liegt darin. */
  border: 1px solid var(--sand-a4);
  padding: var(--space-4);
}
.stats .stat__value { margin-bottom: 0; }

/* Der Fuss. Kein eigener Grund und keine Linie: beides kommt vom Rahmen, in
   dem er sitzt. `auto` oben haelt ihn unten, auch wenn die Karte daneben
   hoeher ist. */
.stats .stat__delta {
  margin: auto 0 0;
  padding: var(--space-2) var(--space-3);
  color: var(--text-low);
}

/* --- 18. Dense list rows ------------------------------------------------ */

.list { list-style: none; margin: 0; padding: 0; }
.list__row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-3);
  font-size: var(--fs-2);
  text-decoration: none; color: inherit;
  transition: background var(--transition);
}
a.list__row:hover { background: var(--neutral-soft); text-decoration: none; }
.list__row + .list__row { border-top: 1px solid var(--border-subtle); border-radius: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Ein Titel, der etwas oeffnet, bleibt in der Textfarbe: eine Liste aus lauter
   blauen Zeilen liest sich wie ein Suchergebnis. Kein Strich beim Zeigen, auch
   nicht beim Zeigen: die Zeile ist keine Verlinkung ins Netz, sie oeffnet eine
   Lade. Der Zeiger sagt genug. */
a.list__title, a.list__title:hover { color: inherit; text-decoration: none; cursor: pointer; }
/* Eine Unterzeile, die irgendwohin fuehrt: die Anschrift auf die Karte.
   Anders als der Titel behaelt sie die Verweisfarbe, sonst waere nicht zu
   sehen, dass sich hier etwas anklicken laesst. */
a.list__sub { color: var(--accent-text); }
/* Ein Schild neben dem Titel braucht Abstand. Er steht hier und nicht als
   Leerzeichen in der Vorlage: eine Pug-Zeile mit blankem `|` gibt nichts aus,
   und ein Leerzeichen am Zeilenende ist das Erste, was ein Editor wegräumt.
   Dreimal hat das Schild deshalb am Namen geklebt. */
.list__title > .badge { margin-left: var(--space-2); }
.list__sub { font-size: var(--fs-1); color: var(--text-low); margin-top: 1px; }
.list__meta { font-size: var(--fs-1); color: var(--text-low); font-variant-numeric: tabular-nums; white-space: nowrap; }
.list__value { font-size: var(--fs-2); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Row emphasis for the "needs attention" lists */
.list__row--alert { box-shadow: inset 2px 0 0 var(--red-9); border-radius: 0; }
.list__row--warn  { box-shadow: inset 2px 0 0 var(--amber-9); border-radius: 0; }

/* --- 19. Pipeline board ------------------------------------------------- */

.board { display: flex; gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-3); }
.board__col { flex: 0 0 232px; display: flex; flex-direction: column; gap: var(--space-2); }
.board__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2);
  padding: 0 var(--space-1) var(--space-2);
  border-bottom: 2px solid var(--border-subtle);
}
.board__title { font-size: var(--fs-2); font-weight: var(--fw-medium); }
.board__sum { font-size: var(--fs-1); color: var(--text-low); font-variant-numeric: tabular-nums; }
.board__body { display: flex; flex-direction: column; gap: var(--space-2); min-height: 60px; }

.deal {
  display: block; text-decoration: none; color: inherit;
  background: var(--bg-panel); border-radius: var(--radius-3);
  box-shadow: var(--shadow-2); padding: var(--space-3);
  transition: box-shadow var(--transition);
}
.deal:hover { box-shadow: var(--shadow-3); text-decoration: none; }
.deal__company { font-size: var(--fs-1); color: var(--text-low); }
.deal__title { font-size: var(--fs-2); font-weight: var(--fw-medium); margin-top: 1px; }
.deal__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-3); }
.deal__value { font-size: var(--fs-2); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }

/* --- 20. Activity timeline ---------------------------------------------- */

.activity { list-style: none; margin: 0; padding: 0; }
.act { display: flex; gap: var(--space-3); padding-block: var(--space-3); position: relative; }
.act:not(:last-child)::before {
  content: ""; position: absolute; left: 11px; top: 30px; bottom: -6px;
  width: 1px; background: var(--border-subtle);
}
.act__icon {
  flex: none; width: 23px; height: 23px; margin-top: 1px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  background: var(--sand-a3); color: var(--sand-a11);
  font-size: 11px; position: relative; z-index: 1;
}
.act__icon--anruf   { background: var(--indigo-a3); color: var(--indigo-a11); }
.act__icon--email   { background: var(--sand-a3);  color: var(--sand-a11); }
.act__icon--meeting { background: var(--amber-a3);  color: var(--amber-a11); }
.act__icon--angebot { background: var(--green-a3);  color: var(--green-a11); }
.act__icon--system  { background: var(--sand-a2);  color: var(--sand-a10); }
.act__body { flex: 1; min-width: 0; padding-top: 1px; }
.act__head { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.act__who { font-size: var(--fs-2); font-weight: var(--fw-medium); }
.act__when { font-size: var(--fs-1); color: var(--text-faint); }
.act__text { font-size: var(--fs-2); line-height: var(--lh-2); color: var(--text-low); margin-top: 2px; }
.act--system .act__text { font-style: italic; color: var(--text-faint); }

/* --- 21. Activity composer ---------------------------------------------- */
/* Logging a call must take under ten seconds. No modal, no navigation. */

.composer {
  background: var(--bg-surface);
  border-radius: var(--radius-4);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  padding: var(--space-3);
}
.composer .textarea { background: var(--bg-panel); min-height: 60px; }
.composer__foot { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; }
/* Radix legt den Segmentschalter auf --color-surface mit einem Grauschleier
   darueber, nicht auf einen Vollton. */
.composer__types { display: flex; gap: calc(var(--space-1) / 2); background: var(--field-surface);
  background-image: linear-gradient(var(--sand-a3), var(--sand-a3));
  padding: 2px; border-radius: var(--radius-2); }
.composer__type {
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: var(--fs-1); font-weight: var(--fw-medium);
  color: var(--text-low); padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-2);
  transition: background var(--transition), color var(--transition);
}
.composer__type[aria-pressed="true"] { background: var(--bg-panel); color: var(--text-high); box-shadow: var(--shadow-2); }

/* Dieselbe Schaltfläche als Label um ein Radio herum. So hält der Umschalter
   seinen Zustand ohne JavaScript, und das Formular schickt den Typ einfach mit. */
.composer__type:has(input:checked) { background: var(--bg-panel); color: var(--text-high); box-shadow: var(--shadow-2); }
.composer__type input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.composer__type:focus-within { outline: 2px solid var(--accent-solid); outline-offset: 1px; }

/* --- 22. Lifecycle & stage badges --------------------------------------- */

.badge--lead     { background: var(--sand-a3);  color: var(--sand-a11); }
.badge--prospect { background: var(--amber-a3);  color: var(--amber-a11); }
.badge--client   { background: var(--green-a3);  color: var(--green-a11); }
.badge--lost     { background: var(--red-a3);    color: var(--red-a11); }
.badge--past     { background: var(--sand-a3);  color: var(--sand-a10); }

/* ==========================================================================
   PORTAL — Freigabe, Abnahme, Fragebogen-Wizard
   ========================================================================== */

/* --- 24. Freigabe / decision block -------------------------------------- */
/* The most important thing on the client page when it's present, so it gets
   the only accent border in the whole portal. */

.decide {
  background: var(--bg-panel);
  border-radius: var(--radius-4);
  box-shadow: 0 0 0 1px var(--accent-border), var(--shadow-3);
  padding: var(--space-5);
}
.decide--urgent { box-shadow: 0 0 0 1px var(--amber-a7), var(--shadow-3); }
.decide__label {
  font-size: var(--fs-1); font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--accent-text); margin-bottom: var(--space-2);
}
.decide--urgent .decide__label { color: var(--amber-a11); }
.decide__actions {
  display: flex; gap: var(--space-3); flex-wrap: wrap;
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* Deadline countdown */
.deadline {
  display: flex; align-items: baseline; gap: var(--space-2);
  font-variant-numeric: tabular-nums;
}
.deadline__n { font-family: var(--font-display); font-size: var(--fs-7); line-height: 1; font-weight: var(--fw-bold); }
.deadline__unit { font-size: var(--fs-2); color: var(--text-low); }
.deadline--warn .deadline__n { color: var(--amber-a11); }
.deadline--alert .deadline__n { color: var(--red-a11); }

/* --- 25. Wizard step indicator ------------------------------------------ */

.steps { display: flex; gap: var(--space-1); margin-bottom: var(--space-5); }
.steps__item { flex: 1; }
.steps__bar {
  height: 3px; border-radius: var(--radius-full);
  background: var(--sand-a3); margin-bottom: var(--space-2);
}
.steps__item--done .steps__bar,
.steps__item--active .steps__bar { background: var(--accent-solid); }
.steps__label { font-size: var(--fs-1); color: var(--text-faint); }
.steps__item--active .steps__label { color: var(--text-high); font-weight: var(--fw-medium); }
.steps__item--done .steps__label { color: var(--text-low); }

/* Question block inside the wizard */
.q { padding-block: var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.q:last-child { border-bottom: 0; }
.q__label { font-size: var(--fs-4); line-height: var(--lh-4); font-weight: var(--fw-medium); }
.q__help { font-size: var(--fs-2); line-height: var(--lh-2); color: var(--text-low); margin-top: var(--space-2); }
.q__field { margin-top: var(--space-3); }
.q--conditional {
  margin-left: var(--space-4); padding-left: var(--space-4);
  border-left: 2px solid var(--accent-soft); border-bottom: 0;
}

/* Radio / checkbox option lists */
.opts { display: flex; flex-direction: column; gap: var(--space-2); }
.opt {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-3);
  box-shadow: inset 0 0 0 1px var(--border-normal);
  cursor: pointer; font-size: var(--fs-2);
  transition: box-shadow var(--transition), background var(--transition);
}
.opt:hover { background: var(--sand-a2); }
.opt input { flex: none; margin: 2px 0 0; accent-color: var(--accent-solid); }
.opt--on { box-shadow: inset 0 0 0 2px var(--accent-solid); background: var(--accent-soft); }

/* --- 26. Contact block -------------------------------------------------- */
/* Nothing in this portal nags automatically, so reaching a human has to be
   one click. This block is doing real work, not decoration. */

.contact {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface); border-radius: var(--radius-4);
}
.contact__avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: var(--radius-3);
  background: var(--indigo-9); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--fw-medium);
}

/* Das Foto an derselben Stelle wie die Initialen: gleiche Groesse, gleiche
   Ecken. `object-fit` schneidet zu, statt das Gesicht zu stauchen. */
.contact__foto {
  width: 44px; height: 44px; flex: none;
  border-radius: var(--radius-3);
  object-fit: cover; object-position: center top;
  background: var(--neutral-soft);
}

/* --- 23. Section heading with count ------------------------------------- */

.sec-head {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.sec-head__title { font-size: var(--fs-2); font-weight: var(--fw-medium); }
.sec-head__rule { flex: 1; height: 1px; background: var(--border-subtle); }


/* ==========================================================================
   ÖFFENTLICHE SEITE
   Das Anfrageformular unter /anfrage. Kopfzeile, schmale Spalte, Honeypot.
   Stand bisher nur im <style> von anfrage-preview.html, wird aber gebraucht.
   ========================================================================== */

.site { border-bottom: 1px solid var(--border-subtle); background: var(--bg-panel); }
.site__inner { display: flex; align-items: center; gap: var(--space-4); height: 60px; }
/* Die Wortmarke steht als SVG in der Seite, siehe den Mixin +logo. Die Farbe
   kommt von hier, nicht aus dem SVG, sonst gaebe es zwei Orte fuer eine
   Aussage. */
/* Die Wortmarke als Text: Inter, fett, in der Textfarbe. Kein eigener Schnitt
   und keine Zeichnung, damit sie im dunklen Modus mit umdreht und in jeder
   Grösse scharf bleibt. Das gezeichnete Zeichen steht weiter auf den
   Dokumenten, dort ist es Briefkopf. */
.logo {
  display: inline-flex; align-items: center;
  color: var(--text-high);
  font-weight: var(--fw-bold);
  font-size: var(--fs-3); line-height: var(--lh-3);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.narrow { max-width: 620px; }

/* Ein Feld, das nur zu einer Auswahl gehoert, ist mit `hidden` weg. Die Regel
   muss sein, weil .cols und andere Klassen display setzen und damit die
   Voreinstellung des Browsers schlagen. */
[hidden] { display: none !important; }

/* Honeypot. Für Menschen unsichtbar, für Bots ein Feld wie jedes andere.
   Nicht display:none, das überspringen manche Bots absichtlich. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.footer {
  display: flex; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-6) 0;
  font-size: var(--fs-1); color: var(--text-low);
}
.footer a { color: inherit; }
