/* =============================================================
   Matchlead Portal — Design System
   Two themes, one token set. See ../../../DESIGN.md for the rationale.

   Structure:
     1. Fonts
     2. Tokens — mode-independent (:root)
     3. Tokens — light
     4. Tokens — dark
     5. Everything below reads tokens only. No literal brand colour
        may appear past section 4.
   ============================================================= */

/* ---------- 1. Fonts ---------- */
/* Hanken Grotesk — die Hausschrift von matchlead.at. Variabel, ein File für alle
   Gewichte. Selbst gehostet, kein CDN (Workspace-Regel). */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/hanken-grotesk-var.woff2') format('woff2');
}

:root {

  /* Type */
  --font-heading: 'Hanken Grotesk', ui-sans-serif, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-body:    'Hanken Grotesk', ui-sans-serif, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Fixed scale — product UI is viewed at consistent DPI, so no fluid clamps.
     Ratio sits at 1.25 between the top steps and 1.15 lower down. */
  --fs-h1: 1.75rem;
  --fs-h2: 1.4rem;
  --fs-h3: 1.125rem;
  --fs-h4: 1rem;
  --fs-body: 0.9375rem;
  --fs-sm: 0.8125rem;
  --fs-xs: 0.72rem;

  /* Spacing — 4px base */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px; --s-10: 72px;

  /* Radii — buttons are pills; that single choice carries the brand */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-2xl: 28px; --r-pill: 999px;

  /* Motion — exponential ease-out, 150-250ms. Product users are in flow. */
  --ease:     cubic-bezier(.16, 1, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast:   150ms;
  --t-base:   220ms;
  --t-slow:   320ms;

  /* Layout */
  --sidebar-w:   268px;
  --topbar-h:    68px;
  --max-content: 1280px;
}

/* ---------- 3. Tokens — light ---------- */
/* Default so the stylesheet is never colourless if the theme script fails. */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  /* Brand ramp — read as TEXT and tints. Solid fills use --accent-solid. */
  --brand-900: #1B1F0E;
  --brand-800: #262B14;
  --brand-700: #343B1B;
  --brand-600: #47512B;
  --brand-500: #5C6939;
  --brand-400: #7E8C57;
  --brand-300: #A6B87E;
  --brand-200: #C8D69B;
  --brand-100: #DDE7C2;
  --brand-50:  #F3EFE1;

  /* Solid action surface — kept separate from the text ramp so both modes
     can keep white button labels at an accessible contrast. */
  --accent-solid:       #343B1B;
  --accent-solid-hover: #262B14;
  --accent-solid-ink:   #FFFFFF;

  --accent:   #7E8C57;   /* secondary blue for gradients */
  --accent-2: #343B1B;   /* deep ink, used in the auth hero */

  /* Neutrals — warm, tinted away from pure grey. Never #000 or #fff as text. */
  --ink-900: #33362A;
  --ink-700: #2A2A28;
  --ink-600: #45443F;
  --ink-500: #6F7061;
  --ink-400: #8A8880;
  --ink-300: #ABA9A0;
  --ink-200: #CFCDC4;
  --ink-100: #E5E4DD;
  --ink-50:  #F1F0EB;

  /* Surfaces */
  --bg-base: #FDFCEE;
  --bg-soft: #F3EFE1;
  --surface: #FFFFFF;

  /* Panel tokens. The names are inherited from the glassmorphism era and are
     referenced inline in several views, so they stay — but they now describe
     ordinary sunken/raised surfaces, not translucency. */
  --glass-bg:        #FFFFFF;
  --glass-bg-strong: #FFFFFF;
  --glass-bg-soft:   #FAFAF8;
  --glass-border:    #E5E4DD;
  --glass-edge:      rgba(52, 59, 27, .12);

  --border:       #E5E4DD;
  --border-strong:#CFCDC4;

  /* Status family — separate from the accent so state never outshouts action */
  --status-locked-bg:  #F0EFEA;  --status-locked-fg:  #6B6A63;
  --status-open-bg:    #F3EFE1;  --status-open-fg:    #47512B;
  --status-submit-bg:  #FCF0D4;  --status-submit-fg:  #8A5A00;
  --status-review-bg:  #EAE9F7;  --status-review-fg:  #4F46A8;
  --status-done-bg:    #DCF5E7;  --status-done-fg:    #067647;
  --status-overdue-bg: #FBE3E1;  --status-overdue-fg: #B42318;
  /* Lead pipeline extras: "erreicht" (brand blue family) and "abgerechnet" (olive, final) */
  --status-reach-bg:   #E3ECF9;  --status-reach-fg:   #2C5FA8;
  --status-billed-bg:  #DDE7C2;  --status-billed-fg:  #343B1B;

  /* Milestone ownership. "Agency" is graphite, not blue: it means nothing is
     required of the client, and blue here would dilute the action colour. */
  --ms-client-bg:  #DCF5E7;  --ms-client-fg:  #067647;
  --ms-agency-bg:  #E8E7E1;  --ms-agency-fg:  #45443F;
  --ms-payment-bg: #FCF0D4;  --ms-payment-fg: #8A5A00;

  --danger:       #B42318;
  --danger-hover: #911D13;
  --success:      #067647;
  --success-hover:#055C37;

  /* Elevation — small and low-opacity. Hierarchy comes from surface + border. */
  --shadow-xs: 0 1px 2px rgba(15, 15, 15, .04);
  --shadow-sm: 0 2px 6px -2px rgba(15, 15, 15, .07);
  --shadow-md: 0 8px 20px -10px rgba(15, 15, 15, .12);
  --shadow-lg: 0 18px 44px -20px rgba(15, 15, 15, .18);
}

/* ---------- 4. Tokens — dark ---------- */
/* The brand ramp inverts: low numbers become dark tints, high numbers become
   light text. That keeps every inherited `var(--brand-700)` text usage legible
   without touching the 59 places that reference it. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --brand-900: #E4EDCB;
  --brand-800: #DDE7C2;
  --brand-700: #C8D69B;
  --brand-600: #B2C486;
  --brand-500: #9CAF72;
  --brand-400: #7E8C57;
  --brand-300: #66713F;
  --brand-200: #47512B;
  --brand-100: #343B1B;
  --brand-50:  #262B14;

  --accent-solid:       #5C6939;
  --accent-solid-hover: #6E7D45;
  --accent-solid-ink:   #FFFFFF;

  --accent:   #A6B87E;
  --accent-2: #14170C;

  --ink-900: #F2F1ED;
  --ink-700: #DAD8D2;
  --ink-600: #B8B6AE;
  --ink-500: #94918A;
  --ink-400: #78756E;
  --ink-300: #5C5A54;
  --ink-200: #3D3B37;
  --ink-100: #2A2926;
  --ink-50:  #1F1E1C;

  --bg-base: #0F0F0F;
  --bg-soft: #141414;
  --surface: #1A1A1A;

  --glass-bg:        #1A1A1A;
  --glass-bg-strong: #1A1A1A;
  --glass-bg-soft:   #161616;
  --glass-border:    #2A2926;
  --glass-edge:      rgba(200, 214, 155, .14);

  --border:        #2A2926;
  --border-strong: #3D3B37;

  --status-locked-bg:  #26251F;  --status-locked-fg:  #A5A29A;
  --status-open-bg:    #262B14;  --status-open-fg:    #C8D69B;
  --status-submit-bg:  #33270C;  --status-submit-fg:  #F0B75C;
  --status-review-bg:  #22203A;  --status-review-fg:  #A9A2F0;
  --status-done-bg:    #10301F;  --status-done-fg:    #5FD79B;
  --status-overdue-bg: #3A1A18;  --status-overdue-fg: #F58C82;
  --status-reach-bg:   #16273F;  --status-reach-fg:   #86B2ED;
  --status-billed-bg:  #2A3117;  --status-billed-fg:  #C8D69B;

  --ms-client-bg:  #10301F;  --ms-client-fg:  #5FD79B;
  --ms-agency-bg:  #2B2A26;  --ms-agency-fg:  #BFBCB2;
  --ms-payment-bg: #33270C;  --ms-payment-fg: #F0B75C;

  --danger:       #F58C82;
  --danger-hover: #FFA79E;
  --success:      #5FD79B;
  --success-hover:#7FE5B1;

  /* Shadows barely read on near-black; borders carry elevation instead. */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 6px -2px rgba(0, 0, 0, .45);
  --shadow-md: 0 8px 20px -10px rgba(0, 0, 0, .60);
  --shadow-lg: 0 18px 44px -20px rgba(0, 0, 0, .75);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink-900);
  background: var(--bg-base);
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--brand-600); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 6px;
}
::selection { background: var(--brand-200); color: var(--brand-900); }

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  line-height: 1.2;
}
h1 { font-size: var(--fs-h1); letter-spacing: -0.025em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); color: var(--ink-700); }
p  { max-width: 68ch; }
small, .text-xs { font-size: var(--fs-sm); color: var(--ink-500); }
.text-muted { color: var(--ink-500); }
.text-mono  { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
code { font-family: var(--font-mono); font-size: .86em; }

/* The inherited decorative background is gone. The element may still be in a
   view; keep it inert rather than chasing every template. */
.aurora { display: none; }

/* ---------- Layout shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }
.app-shell.is-public { grid-template-columns: 1fr; }
.app-main { min-width: 0; padding: var(--s-7) var(--s-8) var(--s-10); }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-main  { padding: var(--s-5); padding-top: calc(var(--topbar-h) + var(--s-5)); }
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: var(--s-6) var(--s-4);
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: var(--s-5);
  z-index: 5;
  overflow-y: auto;
}
.brand-row { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-2); }
.brand-logo { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; }
.brand-logo-sm { width: 32px; height: 32px; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong {
  font-family: var(--font-heading);
  font-size: 1.05rem; font-weight: 700;
  color: var(--ink-900); letter-spacing: -.025em;
}
/* The wordmark is lowercase and unspaced — override the label styling that the
   generic .brand-text span would otherwise apply. */
.brand-text .brand-sub {
  font-family: var(--font-heading);
  font-size: .78rem; font-weight: 500;
  color: var(--ink-500);
  text-transform: none; letter-spacing: -.01em;
}
.brand-iq { color: var(--brand-600); }

.nav-section { display: flex; flex-direction: column; gap: 1px; }
.nav-section-title {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .1em;
  color: var(--ink-400); text-transform: uppercase;
  padding: var(--s-2) var(--s-3); margin-top: var(--s-2);
}
.nav-link {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-600);
  font-weight: 500; font-size: .9rem;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-link:hover { background: var(--ink-100); color: var(--ink-900); }
.nav-link.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav-link.is-active svg { opacity: 1; }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }

.sidebar-foot { margin-top: auto; padding-top: var(--s-4); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--s-3); }
.user-chip {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3); border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-solid);
  color: var(--accent-solid-ink); font-weight: 700; font-size: .82rem;
  font-family: var(--font-heading);
  flex-shrink: 0;
}
.user-chip-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-chip-name strong { font-size: .86rem; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-name small { font-size: var(--fs-xs); color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip a { font-size: .75rem; color: var(--ink-500); flex-shrink: 0; }
.user-chip a:hover { color: var(--brand-600); }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: flex; align-items: center; gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}
.theme-toggle button {
  flex: 1;
  display: inline-grid; place-items: center;
  height: 28px;
  border-radius: var(--r-pill);
  color: var(--ink-500);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.theme-toggle button svg { width: 15px; height: 15px; }
.theme-toggle button:hover { color: var(--ink-900); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--ink-100);
  color: var(--ink-900);
}

/* ---------- Topbar (mobile) ---------- */
.topbar-mobile {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  align-items: center; justify-content: space-between;
  padding: 0 var(--s-5);
}
@media (max-width: 960px) {
  .topbar-mobile { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease);
    z-index: 50;
  }
  .sidebar.is-open { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; background: rgba(15,15,15,.55); z-index: 40; }
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-700);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Page header ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s-4);
  margin-bottom: var(--s-7);
}
.page-head-titles { display: flex; flex-direction: column; gap: 5px; }
.page-head-titles .crumbs { font-size: var(--fs-sm); color: var(--ink-500); display: flex; gap: 6px; align-items: center; }
.page-head-titles h1 { margin: 0; }
.page-head-actions { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }

/* ---------- Surfaces (class name inherited; no longer translucent) ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.glass--soft   { background: var(--glass-bg-soft); box-shadow: none; }
.glass--strong { background: var(--surface); box-shadow: var(--shadow-sm); }
.card { padding: var(--s-6); }
.card-tight { padding: var(--s-4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head h2, .card-head h3 { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 40px; padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  font-family: var(--font-heading);
  font-weight: 600; font-size: .9rem; line-height: 1;
  letter-spacing: -.005em;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--accent-solid); color: var(--accent-solid-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-solid-hover); color: var(--accent-solid-ink); }
.btn-primary:active:not(:disabled) { background: var(--accent-solid-hover); }

.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink-700); }
.btn-ghost:hover:not(:disabled) { background: var(--ink-100); color: var(--ink-900); }

.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); color: #FFFFFF; }

.btn-success { background: var(--success); color: #FFFFFF; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); color: #FFFFFF; }

.btn-sm { height: 32px; padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn-lg { height: 48px; padding: 0 var(--s-6); font-size: 1rem; }
.btn-icon-only { width: 40px; padding: 0; }
.btn-icon-only.btn-sm { width: 32px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-700); }
.label-help { font-size: var(--fs-xs); color: var(--ink-500); font-weight: 400; margin-left: 4px; }
.input, .select, .textarea {
  width: 100%;
  padding: 9px 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  color: var(--ink-900);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:hover:not(:disabled), .select:hover:not(:disabled), .textarea:hover:not(:disabled) { border-color: var(--ink-300); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--glass-edge);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input[readonly], .input:disabled, .select:disabled, .textarea:disabled {
  background: var(--ink-50); color: var(--ink-500); cursor: not-allowed;
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.helper { font-size: var(--fs-xs); color: var(--ink-500); }
.error  { font-size: var(--fs-sm); color: var(--danger); }

/* File inputs render as an unstyled OS control by default, which is the one
   place the interface would otherwise look borrowed. Style the picker button. */
input[type="file"] {
  font-size: var(--fs-sm);
  color: var(--ink-600);
  max-width: 100%;
}
input[type="file"]::file-selector-button {
  margin-right: var(--s-3);
  height: 32px; padding: 0 var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-700);
  font-family: var(--font-heading);
  font-weight: 600; font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
input[type="file"]::file-selector-button:hover { background: var(--ink-100); color: var(--ink-900); }

.check { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; user-select: none; font-size: var(--fs-body); }
.check input { width: 18px; height: 18px; accent-color: var(--accent-solid); }
.check-card {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--glass-bg-soft);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.check-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table thead th {
  background: transparent;
  text-align: left; font-weight: 600; color: var(--ink-500);
  padding: 10px 16px; font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--border-strong);
  position: sticky; top: 0; z-index: 1;
}
.table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--glass-bg-soft); }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Badges / status chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-locked  { background: var(--status-locked-bg);  color: var(--status-locked-fg); }
.badge-open    { background: var(--status-open-bg);    color: var(--status-open-fg); }
.badge-submit  { background: var(--status-submit-bg);  color: var(--status-submit-fg); }
.badge-review  { background: var(--status-review-bg);  color: var(--status-review-fg); }
.badge-done    { background: var(--status-done-bg);    color: var(--status-done-fg); }
.badge-overdue { background: var(--status-overdue-bg); color: var(--status-overdue-fg); }
.badge-info    { background: var(--brand-50);          color: var(--brand-700); }
.badge-neutral { background: var(--ink-50);            color: var(--ink-600); }

/* ---------- Milestone ownership ---------- */
.badge-ms-client  { background: var(--ms-client-bg);  color: var(--ms-client-fg); }
.badge-ms-agency  { background: var(--ms-agency-bg);  color: var(--ms-agency-fg); }
.badge-ms-payment { background: var(--ms-payment-bg); color: var(--ms-payment-fg); }

/* Coloured side stripes are gone. Ownership reads from the badge each row
   already carries; the row itself gets only a faint wash. Mixing the status
   colour back toward the surface keeps it a hint rather than a highlight, and
   it lands correctly in both themes because both inputs are tokens. */
.msrow-client  { background: color-mix(in oklab, var(--ms-client-bg)  38%, var(--surface)) !important; }
.msrow-agency  { background: var(--glass-bg-soft) !important; }
.msrow-payment { background: color-mix(in oklab, var(--ms-payment-bg) 38%, var(--surface)) !important; }

.cascade-legend {
  display: flex; gap: var(--s-4); flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--ink-500);
  margin-bottom: var(--s-3);
}
.cascade-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cascade-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cascade-legend .lg-client i  { background: var(--ms-client-fg); }
.cascade-legend .lg-agency i  { background: var(--ms-agency-fg); }
.cascade-legend .lg-payment i { background: var(--ms-payment-fg); }

/* ---------- Payment countdown ---------- */
.pay-timer {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .01em;
  background: var(--ms-payment-bg); color: var(--ms-payment-fg);
  font-variant-numeric: tabular-nums;
}
.pay-timer::before { content: '⏳'; }
.pay-timer-urgent { background: var(--status-overdue-bg); color: var(--status-overdue-fg); }
.pay-timer-overdue { background: var(--status-overdue-fg); color: var(--surface); }
.pay-timer-overdue::before { content: '⚠'; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: var(--s-7); }
.stat { padding: var(--s-5); display: flex; flex-direction: column; gap: 4px; position: relative; }
.stat-label { font-size: var(--fs-sm); color: var(--ink-500); font-weight: 500; }
.stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem; font-weight: 700; color: var(--ink-900);
  letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: var(--fs-sm); color: var(--ink-500); margin-top: 2px; }
.stat-icon {
  position: absolute; top: var(--s-4); right: var(--s-4);
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-700);
}

/* ---------- Toast / Flash ---------- */
.flash {
  position: fixed; top: var(--s-5); right: var(--s-5);
  z-index: 100;
  display: flex; flex-direction: column; gap: var(--s-2);
  max-width: 380px;
}
.flash-item {
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  font-size: .88rem;
  animation: slideIn var(--t-base) var(--ease);
}
.flash-item.success { border-color: var(--success); color: var(--ink-900); }
.flash-item.error   { border-color: var(--danger);  color: var(--ink-900); }
.flash-item.info    { border-color: var(--brand-500); color: var(--ink-900); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 15, 15, .55);
  z-index: 90; display: grid; place-items: center;
  padding: var(--s-5);
  animation: fadeIn var(--t-fast) var(--ease);
}
.modal {
  width: min(640px, 100%);
  max-height: 90dvh; overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-7);
  box-shadow: var(--shadow-lg);
  animation: zoomIn var(--t-base) var(--ease-out);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-5); }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-6); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }

/* ---------- Progress ring ---------- */
.ring-wrap { position: relative; display: inline-grid; place-items: center; }
.ring-wrap .ring-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-heading);
  font-size: 1.35rem; font-weight: 700; color: var(--ink-900);
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
}
.ring-wrap.ring-sm .ring-text { font-size: 1rem; }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: grid; grid-template-columns: 34px 1fr; gap: var(--s-4);
  position: relative; padding: var(--s-4) 0;
}
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute; left: 16px; top: 34px; bottom: -4px;
  width: 2px;
  background: var(--border-strong);
}
.timeline-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink-100); color: var(--ink-500);
  font-family: var(--font-heading);
  font-weight: 700; font-size: .82rem;
  border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 1px var(--border-strong);
  z-index: 1;
}
.timeline-item.is-done    .timeline-dot { background: var(--status-done-bg);    color: var(--status-done-fg);    box-shadow: 0 0 0 1px var(--status-done-fg); }
.timeline-item.is-active  .timeline-dot { background: var(--accent-solid);      color: var(--accent-solid-ink);  box-shadow: 0 0 0 4px var(--glass-edge); }
.timeline-item.is-overdue .timeline-dot { background: var(--status-overdue-bg); color: var(--status-overdue-fg); box-shadow: 0 0 0 1px var(--status-overdue-fg); }
/* The dot already encodes ownership, so the body needs no coloured rule. */
.timeline-item.ms-client:not(.is-done):not(.is-active):not(.is-overdue)  .timeline-dot { background: var(--ms-client-bg);  color: var(--ms-client-fg);  box-shadow: 0 0 0 1px var(--ms-client-fg); }
.timeline-item.ms-agency:not(.is-done):not(.is-active):not(.is-overdue)  .timeline-dot { background: var(--ms-agency-bg);  color: var(--ms-agency-fg);  box-shadow: 0 0 0 1px var(--ms-agency-fg); }
.timeline-item.ms-payment:not(.is-done):not(.is-overdue) .timeline-dot { background: var(--ms-payment-bg); color: var(--ms-payment-fg); box-shadow: 0 0 0 1px var(--ms-payment-fg); }
.timeline-body { padding-top: 5px; min-width: 0; }
.timeline-body h4 { margin: 0 0 4px; font-size: .95rem; color: var(--ink-900); }
.timeline-body p { font-size: .86rem; color: var(--ink-600); margin: 0; max-width: 68ch; }
.timeline-meta { font-size: var(--fs-xs); color: var(--ink-500); display: flex; gap: var(--s-3); align-items: center; margin-top: 7px; flex-wrap: wrap; }

/* ---------- Drag handles ---------- */
.handle {
  cursor: grab; color: var(--ink-300);
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 6px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.handle:hover { color: var(--brand-600); background: var(--brand-50); }
.handle:active { cursor: grabbing; }
.is-dragging { opacity: .5; }
.drop-target { outline: 2px dashed var(--brand-500); outline-offset: 2px; border-radius: var(--r-md); }

/* ---------- Helper utilities ---------- */
.row { display: flex; gap: var(--s-3); align-items: center; }
.row-tight { display: flex; gap: var(--s-2); align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.gap-2 { gap: var(--s-2); } .gap-4 { gap: var(--s-4); } .gap-6 { gap: var(--s-6); }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.grid-2 { display: grid; gap: var(--s-5); grid-template-columns: 2fr 1fr; }
@media (max-width: 1024px) { .grid-2 { grid-template-columns: 1fr; } }
/* Grid children must be allowed to shrink below content width, otherwise long
   addresses and links push the page sideways on mobile. */
.grid-2 > * { min-width: 0; }
.glass.card small, .row-between > span, .glass.card a[href^="mailto:"] { overflow-wrap: anywhere; }
.grid-cards { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ---------- Empty states ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--s-3);
  padding: var(--s-9) var(--s-5);
  color: var(--ink-500);
}
.empty .empty-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand-50); color: var(--brand-700);
  display: grid; place-items: center;
}
.empty h3 { color: var(--ink-700); }
.empty p { max-width: 46ch; }

/* ---------- Auth ---------- */
.auth-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: 100dvh; }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } }
.auth-hero {
  position: relative;
  padding: var(--s-9);
  display: flex; flex-direction: column; justify-content: space-between;
  background-color: var(--accent-2);
  background-image: url('/assets/img/login-hero.webp');
  background-size: cover;
  background-position: 60% center;
  color: #FFFFFF;
  overflow: hidden;
}
/* The photograph fades into the brand olive from the bottom up, so the headline
   always sits on solid colour while the image stays visible above it. */
.auth-hero::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(to top,
      var(--accent-2) 0%,
      rgba(52, 59, 27, .92) 26%,
      rgba(52, 59, 27, .58) 50%,
      rgba(52, 59, 27, .18) 74%,
      rgba(52, 59, 27, .06) 100%),
    linear-gradient(115deg, rgba(52, 59, 27, .60) 0%, rgba(52, 59, 27, 0) 58%);
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero-logo { display: flex; align-items: center; gap: var(--s-3); }
.auth-hero-logo img { height: 26px; width: auto; }
.auth-hero-headline {
  font-family: var(--font-heading);
  /* Sized so each half of the headline holds one line — the <br> does the break,
     the width must never force a second wrap. */
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
  font-weight: 700; letter-spacing: -.03em; line-height: 1.18;
  max-width: 34ch;
  text-wrap: pretty;
}
.auth-hero-sub { color: rgba(255,255,255,.72); margin-top: var(--s-4); max-width: 40ch; }
.auth-hero-foot { display: flex; gap: var(--s-5); font-size: var(--fs-sm); color: rgba(255,255,255,.65); }
.auth-hero-foot strong { color: #FFFFFF; display: block; font-size: 1.05rem; }
@media (max-width: 900px) {
  .auth-hero { padding: var(--s-6); min-height: 200px; }
  .auth-hero-headline { font-size: 1.6rem; }
}

.auth-form-wrap { display: grid; place-items: center; padding: var(--s-7); background: var(--bg-base); }
.auth-form { width: 100%; max-width: 400px; }
.auth-form h1 { margin-bottom: var(--s-2); }
.auth-form .text-muted { margin-bottom: var(--s-6); }

/* ---------- Client action card ---------- */
.action-card { position: relative; padding: var(--s-7); }
.action-card .action-eyebrow {
  font-size: var(--fs-xs); color: var(--ink-500); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}
.action-card .action-title {
  font-family: var(--font-heading);
  font-size: 1.6rem; font-weight: 700; color: var(--ink-900);
  margin-top: var(--s-2); letter-spacing: -.03em; line-height: 1.15;
}
.action-card .action-desc { color: var(--ink-600); margin-top: var(--s-3); max-width: 60ch; }
.action-card .action-cta  { margin-top: var(--s-6); display: flex; gap: var(--s-3); flex-wrap: wrap; }
.action-card .action-meta { display: flex; gap: var(--s-4); margin-top: var(--s-5); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-500); }

/* ---------- Status banner: who is up, right now ---------- */
.action-status {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.05rem; font-weight: 700; line-height: 1.35; letter-spacing: -.015em;
  padding: 13px 18px; border-radius: var(--r-md);
  margin-bottom: var(--s-5);
}
.action-status.is-todo   { background: var(--ms-client-bg);  color: var(--ms-client-fg); }
.action-status.is-review { background: var(--ms-agency-bg);  color: var(--ms-agency-fg); }
.action-status.is-pay    { background: var(--ms-payment-bg); color: var(--ms-payment-fg); }
.action-status.is-late   {
  box-shadow: inset 0 0 0 1.5px var(--status-overdue-fg);
  font-size: 1rem;
}
.action-status.is-late::after {
  content: 'überfällig';
  margin-left: auto;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--status-overdue-fg);
  color: var(--surface);
  font-family: var(--font-body);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}

/* Concept-approval confirmation */
.confirm-check {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--glass-bg-soft); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
  margin-bottom: var(--s-3); font-size: .9rem; color: var(--ink-700); cursor: pointer;
}
.confirm-check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent-solid); flex-shrink: 0; cursor: pointer; }

/* ---------- Completed milestones: collapsible group ---------- */
.timeline-done-group { margin-bottom: 4px; }
.timeline-done-group > summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--status-done-fg);
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--status-done-bg);
  user-select: none; margin-bottom: 8px;
}
.timeline-done-group > summary::-webkit-details-marker { display: none; }
.timeline-done-group > summary::before { content: '✓'; font-weight: 700; }
.timeline-done-group[open] > summary::before { content: '▾'; }
.timeline-done-group > summary .tdg-count { font-weight: 700; }

/* ---------- Legal links ---------- */
.legal-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--glass-bg-soft); color: inherit; text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.legal-item:hover { border-color: var(--brand-300); background: var(--brand-50); color: inherit; }
.legal-ico { font-size: 1.3rem; flex-shrink: 0; }
.legal-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.legal-body strong { font-size: .94rem; color: var(--ink-900); }
.legal-arrow { color: var(--brand-600); font-weight: 700; }

/* ---------- Second-revision notice ---------- */
.rev2-note {
  border: 1px solid var(--status-overdue-fg);
  background: var(--status-overdue-bg);
  color: var(--status-overdue-fg); border-radius: var(--r-md);
  padding: 14px 16px; margin-bottom: 14px;
}
.rev2-note strong { display: block; margin-bottom: 4px; }
.rev2-note p { margin: 0; font-size: .88rem; line-height: 1.5; }

/* ---------- Welcome panel ---------- */
.welcome-panel {
  position: relative; padding: var(--s-6);
  border: 1px solid var(--brand-200);
  background: var(--brand-50);
  margin-bottom: var(--s-6);
}
.welcome-panel h2 { margin: 0 0 6px; font-size: 1.25rem; }
.welcome-close {
  position: absolute; top: 10px; right: 14px;
  background: transparent; border: 0; font-size: 1.4rem; line-height: 1;
  color: var(--ink-400); cursor: pointer;
}
.welcome-close:hover { color: var(--ink-900); }
.welcome-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s-4); margin-top: var(--s-4);
}
.welcome-grid > div { display: flex; flex-direction: column; gap: 3px; }
.welcome-grid strong { font-size: .92rem; color: var(--ink-900); }
.welcome-grid span { font-size: .84rem; color: var(--ink-600); line-height: 1.45; }

/* ---------- Live toast ---------- */
.live-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px);
  z-index: 120; background: var(--ink-900); color: var(--bg-base);
  padding: 9px 18px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.live-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus {
  left: var(--s-3); top: var(--s-3); padding: 8px 14px;
  background: var(--accent-solid); color: var(--accent-solid-ink);
  border-radius: var(--r-pill); z-index: 200;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0ms !important; scroll-behavior: auto !important; }
}

/* ---------- Messaging ---------- */
.nav-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #FFFFFF;
  font-size: var(--fs-xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.msg-thread { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow-y: auto; padding: 4px 2px; }
.msg-row { display: flex; }
.msg-row.msg-mine { justify-content: flex-end; }
.msg-row.msg-them { justify-content: flex-start; }
.msg-bubble {
  max-width: 78%; padding: 10px 13px; border-radius: 14px;
  background: var(--glass-bg-soft); border: 1px solid var(--border);
}
.msg-mine .msg-bubble { background: var(--accent-solid); color: var(--accent-solid-ink); border-color: transparent; }
.msg-meta { font-size: var(--fs-xs); opacity: .75; margin-bottom: 3px; }
.msg-mine .msg-meta { color: rgba(255,255,255,.85); opacity: 1; }
.msg-body { font-size: .92rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-width: none; }
.msg-compose .textarea { width: 100%; }

.inbox-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item:hover { background: var(--glass-bg-soft); }
.inbox-preview { flex: 1; min-width: 0; }
.inbox-preview .inbox-last { color: var(--ink-600); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pay-admin { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--brand-50); border: 1px solid var(--brand-200); }
.pay-block .pay-amount { font-size: .95rem; }

/* ---------- Client dashboard hero ---------- */
/* The inherited stock sky photo carried no meaning and, being bright, fought the
   greeting for attention in both themes. A flat brand gradient states the same
   thing and lets the text be the loudest element. */
.dash-hero {
  position: relative; overflow: hidden; color: #FFFFFF; isolation: isolate;
  border-radius: var(--r-xl);
  padding: var(--s-7) var(--s-8);
  margin-bottom: var(--s-6);
  min-height: 150px;
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(115deg, var(--accent-2) 0%, #1A1A1A 46%, var(--accent-solid) 140%);
}
.dash-hero > * { position: relative; z-index: 1; }
.dash-hero .dh-eyebrow {
  font-size: var(--fs-xs); letter-spacing: .12em; text-transform: uppercase;
  font-weight: 600; color: rgba(255,255,255,.7);
}
.dash-hero h1 {
  margin: .35rem 0 .4rem; color: #FFFFFF;
  font-size: 2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.12;
}
.dash-hero .dh-sub { color: rgba(255,255,255,.85); font-size: .96rem; max-width: 56ch; }
.dash-hero .dh-actions { margin-top: var(--s-5); display: flex; gap: var(--s-2); flex-wrap: wrap; }
.dash-hero .dh-actions .btn-ghost {
  background: rgba(255,255,255,.12); color: #FFFFFF; border-color: rgba(255,255,255,.28);
}
.dash-hero .dh-actions .btn-ghost:hover { background: rgba(255,255,255,.22); color: #FFFFFF; }
@media (max-width: 640px) {
  .dash-hero { padding: var(--s-6); min-height: 130px; }
  .dash-hero h1 { font-size: 1.5rem; }
}

/* ---------- Emoji-led labels ---------- */
/* Apple Color Emoji's advance width visually swallows the space that follows it,
   so "💳 Zahlung" renders as "💳Zahlung". Mantaflow solved this with
   word-spacing on the whole element, which was tuned for Outfit — under Hanken
   Grotesk it visibly pulled every word apart, not just the one after the emoji.
   A left margin on the emoji's own box fixes exactly the affected gap instead. */
.action-status::first-letter,
.welcome-panel h2::first-letter,
.welcome-grid strong::first-letter { margin-right: .32em; }

/* ---------- Lead board (Anfragen) ---------- */
/* Seven pipeline lanes (kanban with drag & drop). Colours reuse the status
   tokens so the board follows both themes. */
.lead-board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px;
  scroll-snap-type: x proximity; }
.lead-col { flex: 1 0 216px; max-width: 260px; background: var(--glass-bg-soft);
  border: 1px solid var(--border); border-radius: 14px; padding: 10px;
  scroll-snap-align: start; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.lead-col-head { display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px 8px; gap: 6px; }
.lead-col-title { font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap; }
.lead-col-count { font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--ink-100); color: var(--ink-600); font-variant-numeric: tabular-nums; }
.lead-col-neu            .lead-col-title { color: var(--status-open-fg); }
.lead-col-nicht_erreicht .lead-col-title { color: var(--status-locked-fg); }
.lead-col-erreicht       .lead-col-title { color: var(--status-reach-fg); }
.lead-col-nicht_gekauft  .lead-col-title { color: var(--status-overdue-fg); }
.lead-col-angemeldet     .lead-col-title { color: var(--status-done-fg); }
.lead-col-abgerechnet    .lead-col-title { color: var(--status-billed-fg); }
.lead-col-empty { text-align: center; color: var(--ink-300); padding: 14px 0 8px; }
/* Matchlead-only lane: visible but not a client drop target */
.lead-col-locked { background: repeating-linear-gradient(-45deg, var(--glass-bg-soft) 0 14px, transparent 14px 22px); }
.lead-col-lockhint { font-size: .7rem; color: var(--ink-400); padding: 0 4px 6px; line-height: 1.4; }

/* Drag & drop affordances */
.lead-card[draggable="true"] { cursor: grab; }
.lead-card.is-dragging { opacity: .45; cursor: grabbing; }
.lead-col.is-dropzone { border-color: var(--brand-300); }
.lead-col.is-over { border-color: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-solid);
  background: var(--brand-50); }
.lead-col.is-forbidden { border-color: var(--status-overdue-fg); }

.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 10px; transition: box-shadow .15s, transform .15s; }
.lead-card:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; }
.lead-card-top { display: flex; justify-content: space-between; align-items: baseline; }
.lead-number { font-family: var(--font-mono); font-size: .78rem; font-weight: 700; color: var(--brand-500); }
.lead-date { font-size: .74rem; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.lead-name { font-weight: 700; font-size: .95rem; color: var(--ink-900); margin-top: 2px; }
.lead-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-500); margin-top: 4px; }
.lead-meta a { color: var(--brand-500); text-decoration: none; }
.lead-meta a:hover { text-decoration: underline; }
.lead-note { font-size: .8rem; color: var(--ink-600); font-style: italic; margin-top: 6px; }
.lead-reason { display: inline-block; margin-top: 6px; font-size: .72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--status-overdue-bg); color: var(--status-overdue-fg); }
.lead-note-edit { margin-top: 8px; }
.lead-note-edit summary { cursor: pointer; font-size: .76rem; color: var(--ink-400); }

/* Fallback move menu (touch / keyboard / no-JS) */
.lead-movemenu { margin-top: 8px; position: relative; }
.lead-movemenu summary { cursor: pointer; font-size: .76rem; font-weight: 600; color: var(--brand-500);
  list-style: none; }
.lead-movemenu summary::-webkit-details-marker { display: none; }
.lead-movemenu[open] .lead-movemenu-list { display: flex; }
.lead-movemenu-list { display: none; flex-direction: column; gap: 4px; margin-top: 6px;
  padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lead-movemenu-list form { display: contents; }
.lead-move { border: 1px solid var(--border); background: var(--glass-bg-soft); cursor: pointer;
  border-radius: 999px; font-size: .72rem; font-weight: 600; padding: 4px 9px; text-align: left;
  color: var(--ink-600); transition: background-color .15s, color .15s, border-color .15s; }
.lead-move-nicht_erreicht:hover { background: var(--status-locked-bg);  color: var(--status-locked-fg);  border-color: currentColor; }
.lead-move-erreicht:hover       { background: var(--status-reach-bg);   color: var(--status-reach-fg);   border-color: currentColor; }
.lead-move-nicht_gekauft:hover  { background: var(--status-overdue-bg); color: var(--status-overdue-fg); border-color: currentColor; }
.lead-move-angemeldet:hover     { background: var(--status-done-bg);    color: var(--status-done-fg);    border-color: currentColor; }
.lead-move-abgerechnet:hover    { background: var(--status-billed-bg);  color: var(--status-billed-fg);  border-color: currentColor; }
.lead-move-neu:hover            { background: var(--status-open-bg);    color: var(--status-open-fg);    border-color: currentColor; }

/* Reason dialog for "nicht gekauft" */
.lead-reason-backdrop { position: fixed; inset: 0; z-index: 99980; background: rgba(20,23,12,.5);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.lead-reason-dialog { width: min(380px, 100%); background: var(--surface); color: var(--ink-900);
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  box-shadow: 0 24px 70px rgba(20,23,12,.35); }
.lead-reason-dialog h3 { font-size: 1rem; margin-bottom: 4px; }
.lead-reason-dialog p { font-size: .84rem; color: var(--ink-600); margin-bottom: 10px; }
.lead-reason-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 6px; cursor: pointer; font-size: .88rem; }
.lead-reason-opt:hover { border-color: var(--brand-300); background: var(--glass-bg-soft); }
.lead-reason-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* Sign-up value tag + custom price row in the package dialog */
.lead-value { display: inline-block; margin-top: 6px; margin-left: 4px; font-size: .72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--status-done-bg); color: var(--status-done-fg);
  font-variant-numeric: tabular-nums; }
.lead-pkg-custom { display: flex; gap: 8px; margin-top: 8px; }
.lead-pkg-custom .input { flex: 1; }

/* Monthly billing box (client board + admin) */
.lead-billing-row { display: flex; gap: 28px; flex-wrap: wrap; align-items: baseline; }
.lead-billing-row > div { display: flex; flex-direction: column; gap: 2px; }
.lead-billing-label { font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-400); }
.lead-billing-row strong { font-size: 1.25rem; color: var(--ink-900); }
.lead-billing-note { flex-basis: 100%; font-size: .8rem; margin: 4px 0 0; }

/* Board toast */
.lead-toast { position: fixed; z-index: 99985; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(8px);
  background: var(--accent-solid); color: var(--accent-solid-ink); font-size: .86rem; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; box-shadow: 0 12px 34px rgba(20,23,12,.3);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.lead-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.lead-toast.is-error { background: var(--status-overdue-fg); color: #fff; }

/* Admin: table badges per lead status */
.lead-badge-neu            { background: var(--status-open-bg);    color: var(--status-open-fg); }
.lead-badge-nicht_erreicht { background: var(--status-locked-bg);  color: var(--status-locked-fg); }
.lead-badge-erreicht       { background: var(--status-reach-bg);   color: var(--status-reach-fg); }
.lead-badge-nicht_gekauft  { background: var(--status-overdue-bg); color: var(--status-overdue-fg); }
.lead-badge-angemeldet     { background: var(--status-done-bg);    color: var(--status-done-fg); }
.lead-badge-abgerechnet    { background: var(--status-billed-bg);  color: var(--status-billed-fg); }

/* Admin: inline status select per table row */
.lead-status-form { display: flex; align-items: center; gap: 6px; }
.lead-status-form select { font-size: .78rem; padding: 3px 6px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-900); }

/* Language switcher (sidebar + auth pages) */
.lang-toggle { display: flex; gap: 2px; border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.lang-toggle a { flex: 1; text-align: center; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  padding: 3px 10px; border-radius: 999px; color: var(--ink-500); text-decoration: none; }
.lang-toggle a:hover { color: var(--ink-900); }
.lang-toggle a.is-active { background: var(--accent-solid); color: var(--accent-solid-ink); }

/* Admin: spot-check queue */
.check-item { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.check-geprueft_widerspruch { border-color: var(--status-overdue-fg); background: var(--status-overdue-bg); }
.check-head { font-size: .9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check-meta { font-size: .8rem; margin-top: 4px; }
.check-form { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.check-form .input { flex: 1 1 180px; }
.check-result { font-size: .84rem; font-weight: 600; margin-top: 8px; color: var(--ink-700); }
