/* =====================================================================
   BREPP DESIGNSYSTEEM v2
   Server-rendered portal (FastAPI + Jinja2), pure CSS, geen frameworks.
   Instrument Sans (sans) + Geist Mono (mono) — geladen in base.html.
   Tokens altijd via var() consumeren; componenten nooit in de media-query.
   ===================================================================== */

/* ── TOKENS — LICHT ─────────────────────────────────────────────────── */
:root {
  /* surface-ladder: canvas -> kaart -> verhoogd (diepte zonder schaduw) */
  --canvas:         #F7F8F9;
  --card:           #FFFFFF;
  --raised:         #F1F3F5;
  --border:         #E4E7EA;
  --border-strong:  #D3D8DD;
  --text:           #16191D;
  --text-secondary: #5B6B7A;
  --text-tertiary:  #8A94A0;

  --amber:          #FF6A00;
  --amber-hover:    #E85F00;
  --amber-active:   #D45600;

  --success:        #2E7D32;
  --warning:        #FF6A00;
  --danger:         #C62828;

  --success-bg:     rgba(46, 125, 50, 0.10);
  --warning-bg:     rgba(255, 106, 0, 0.10);
  --danger-bg:      rgba(198, 40, 40, 0.10);
  --neutral-bg:     rgba(91, 107, 122, 0.10);

  --focus:          #FF6A00;
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.08);

  --font-sans: 'Instrument Sans', -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  --card-pad: 24px;   /* klant = royaal; body.dense overschrijft */
}

/* ── TOKENS — DONKER (OS-voorkeur + expliciete toggle, beide richtingen) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas:         #0E1013;
    --card:           #15181C;
    --raised:         #1B1F24;
    --border:         #262B31;
    --border-strong:  #333A42;
    --text:           #F2F4F6;
    --text-secondary: #9AA6B2;
    --text-tertiary:  #6B7683;
    --success:        #4CAF7D;
    --danger:         #E57373;
    --success-bg:     rgba(76, 175, 125, 0.10);
    --danger-bg:      rgba(229, 115, 115, 0.10);
    --neutral-bg:     rgba(154, 166, 178, 0.10);
  }
}

:root[data-theme="dark"] {
  --canvas:         #0E1013;
  --card:           #15181C;
  --raised:         #1B1F24;
  --border:         #262B31;
  --border-strong:  #333A42;
  --text:           #F2F4F6;
  --text-secondary: #9AA6B2;
  --text-tertiary:  #6B7683;
  --success:        #4CAF7D;
  --danger:         #E57373;
  --success-bg:     rgba(76, 175, 125, 0.10);
  --danger-bg:      rgba(229, 115, 115, 0.10);
  --neutral-bg:     rgba(154, 166, 178, 0.10);
}

/* ── RESET / BASIS ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.dense { --card-pad: 16px; }
a { color: inherit; }

/* ── TYPOGRAFIE — 12/13/14/16/18/24/32, gewichten 400/500/600 ────────── */
.page-title { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.section-title { font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; margin: 0; }
.body { font-size: 14px; line-height: 1.5; }
.lead { font-size: 16px; color: var(--text); margin: 0; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-12 { font-size: 12px; }
.text-13 { font-size: 13px; }
.text-16 { font-size: 16px; }
.prewrap { white-space: pre-wrap; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.tabular { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }

/* ── APP-SHELL ──────────────────────────────────────────────────────── */
.app { min-height: 100vh; background: var(--canvas); }
.app-main { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
body.dense .app-main { max-width: 1200px; }

.stack    { display: flex; flex-direction: column; gap: 48px; }
body.dense .stack { gap: 24px; }
.stack-24 { display: flex; flex-direction: column; gap: 24px; }
.stack-16 { display: flex; flex-direction: column; gap: 16px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.stack-8  { display: flex; flex-direction: column; gap: 8px; }
.row-16   { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.grid     { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid--3   { grid-template-columns: repeat(3, 1fr); }
.grid--vandaag { grid-template-columns: 1.3fr 1fr; align-items: start; }
@media (max-width: 860px) { .grid--3, .grid--vandaag { grid-template-columns: 1fr; } }

/* ── TOPBAR — 56px, 2px amber actieve-nav-onderlijn ─────────────────── */
.topbar { height: 56px; display: flex; align-items: center; gap: 24px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--border); }
.topbar__brand { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; color: var(--text); }
.topbar__brand .dot { color: var(--amber); }
.topbar__nav { display: flex; align-items: center; gap: 24px; height: 100%; }
.nav-link { display: inline-flex; align-items: center; height: 100%; padding: 0 4px; font-size: 14px; font-weight: 500; color: var(--text-secondary); text-decoration: none; border-bottom: 2px solid transparent; }
.nav-link:hover { color: var(--text); }
.nav-link.is-active { color: var(--text); border-bottom-color: var(--amber); }
.topbar__spacer { flex: 1; }
.linklike { background: none; border: none; color: var(--text-secondary); cursor: pointer; font: inherit; font-size: 14px; }
.linklike:hover { color: var(--text); }
.footer { padding: 32px 24px; text-align: center; color: var(--text-tertiary); font-family: var(--font-mono); font-size: 12px; }
.footer a { color: var(--text-secondary); }

/* ── KAART — radius 10, 1px border, GEEN schaduw ────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: var(--card-pad); }
.card.dense { --card-pad: 16px; }
.card__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:hover { border-color: var(--border-strong); background: var(--raised); }

/* ── MONO-UPPERCASE LABEL ───────────────────────────────────────────── */
.label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }

/* ── STAT-TEGEL — groot mono-getal + klein label eronder ────────────── */
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat__value { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat__context { font-size: 13px; color: var(--text-secondary); }

/* ── VOORTGANGSBALK — 6px, track = verhoogd, fill amber ─────────────── */
.progress { height: 6px; width: 100%; background: var(--raised); border-radius: 9999px; overflow: hidden; }
.progress__fill { height: 100%; background: var(--amber); border-radius: 9999px; }
.progress--neutral .progress__fill { background: var(--border-strong); }
.progress--mini { height: 4px; }

/* ── FASE-LIJST — 48px rijen, dividers, statusicoon links ───────────── */
.phases { list-style: none; margin: 0; padding: 0; }
.phase { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--border); }
.phase:first-child { border-top: none; }
.phase__icon { flex: 0 0 auto; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.phase__icon--done { color: var(--success); font-size: 14px; line-height: 1; }
.phase__icon--active { border-radius: 9999px; width: 8px; height: 8px; background: var(--amber); box-shadow: 0 0 0 4px var(--warning-bg); }
.phase__icon--todo { width: 12px; height: 12px; border-radius: 9999px; border: 1px solid var(--border-strong); }
.phase__label { font-size: 14px; color: var(--text); }
.phase--done .phase__label { color: var(--text-secondary); }
.phase__meta { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.phase__sub { font-size: 13px; color: var(--text-secondary); }

/* ── TABEL — mono-uppercase koppen, horizontale dividers, geen zebra ── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
body.dense .table { font-size: 13px; }
.table thead th { font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); text-align: left; padding: 0 16px; height: 40px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tbody td { padding: 12px 16px; min-height: 44px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
body.dense .table tbody td { padding: 8px 16px; }
.table tbody tr:hover td { background: var(--raised); }
.table .amount, .table th.amount, .table td.amount { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ── BADGE — 10% tint-bg + volle tekst, ALTIJD met label ────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 9999px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1; white-space: nowrap; }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger  { background: var(--danger-bg); color: var(--danger); }
.badge--neutral { background: var(--neutral-bg); color: var(--text-secondary); }

/* ── KNOPPEN — radius 6, focus 2px amber ring ───────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 6px; border: 1px solid transparent; font-family: var(--font-sans); font-size: 14px; font-weight: 500; line-height: 1; cursor: pointer; text-decoration: none; -webkit-appearance: none; appearance: none; background: var(--amber); color: #FFFFFF; }
.btn:hover  { background: var(--amber-hover); }
.btn:active { background: var(--amber-active); }
body.dense .btn { height: 36px; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover  { background: var(--raised); }
.btn-secondary:active { background: var(--raised); border-color: var(--text-tertiary); }
.btn-tertiary { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-tertiary:hover  { background: var(--raised); color: var(--text); }
.btn-small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:focus-visible, .btn-secondary:focus-visible, .btn-tertiary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--focus); }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── FORMULIERVELD — label 13/500 boven input, focus 2px amber ring ──── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 13px; font-weight: 500; color: var(--text); }
.field__hint { font-size: 12px; color: var(--text-secondary); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  height: 40px; padding: 0 12px; border-radius: 6px; max-width: 100%;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
}
.field input, .field select, .field textarea { width: 100%; }
textarea { height: auto; padding: 8px 12px; min-height: 64px; resize: vertical; }
body.dense input:not([type="checkbox"]):not([type="radio"]), body.dense select { height: 36px; }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 2px var(--focus); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; }
.form-row .field--tight { flex: 0 0 auto; }
.form-help { margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
.backlink { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.backlink:hover { color: var(--text); }

/* ── EMPTY-STATE — icoon + kop + zin + optionele CTA ─────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 48px 24px; }
.empty__icon { font-size: 24px; line-height: 1; color: var(--text-tertiary); }
.empty__title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty__text { font-size: 14px; color: var(--text-secondary); max-width: 48ch; }

/* ── CALLOUTS (flash / checklist / concept-waarschuwing) ────────────── */
.callout { padding: 16px; border-radius: 10px; border: 1px solid var(--border); font-size: 14px; }
.callout--warn   { background: var(--warning-bg); border-color: transparent; }
.callout--danger { background: var(--danger-bg); border-color: transparent; }
.callout--ok     { background: var(--success-bg); border-color: transparent; }
.callout__title  { font-weight: 600; margin-bottom: 4px; }
.checklist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { font-size: 14px; font-family: var(--font-mono); }
.checklist .done { color: var(--success); }
.checklist .todo { color: var(--text-tertiary); }

/* ── OVERLAY-VLAKKEN — dropdown/modal: ENIGE plek met schaduw ────────── */
.dropdown, .modal { background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-overlay); }

/* ── LOGIN ──────────────────────────────────────────────────────────── */
.center-page { max-width: 400px; margin: 12vh auto 0; }

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