/* ═══════════════════════════════════════════════════════════════════════════
   HENK PROJECT DESIGN SYSTEM — applied to Henk OS (2026-07-21)
   Dark, private, urban-nocturnal identity. Near-black + dark violet dominate
   (~70%), violet-primary carries brand (~25%), neon violet is glow/accent only
   (≤5% — outlines, halos, active states — never a fill for large areas).
   Fonts self-hosted in static/fonts/ → fully offline-capable.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Fonts (self-hosted, offline-ready) ───────────────────────────────────── */
@font-face { font-family:'Oswald'; font-style:normal; font-weight:400 700; font-display:swap; src:url('fonts/oswald-var.woff2') format('woff2'); }
@font-face { font-family:'Rajdhani'; font-style:normal; font-weight:400; font-display:swap; src:url('fonts/rajdhani-400.woff2') format('woff2'); }
@font-face { font-family:'Rajdhani'; font-style:normal; font-weight:500; font-display:swap; src:url('fonts/rajdhani-500.woff2') format('woff2'); }
@font-face { font-family:'Rajdhani'; font-style:normal; font-weight:600; font-display:swap; src:url('fonts/rajdhani-600.woff2') format('woff2'); }
@font-face { font-family:'Rajdhani'; font-style:normal; font-weight:700; font-display:swap; src:url('fonts/rajdhani-700.woff2') format('woff2'); }
@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:400; font-display:swap; src:url('fonts/jetbrains-mono-400.woff2') format('woff2'); }

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Henk Project design tokens (source of truth) ── */
  /* Brand palette */
  --black-deep:#050507; --violet-dark:#2B0F3F; --violet-primary:#6A1FB0; --violet-neon:#9B4DFF;
  --white:#F5F2FA; --grey-1:#B9AFC4; --grey-2:#6E6578; --grey-3:#332B3D;
  /* Surfaces */
  --bg-page:var(--black-deep); --bg-surface:#0C0A12; --bg-surface-raised:#150F1F; --bg-inset:#0A0810;
  /* Borders — thin violet, low opacity for default; solid for emphasis */
  --border-subtle:rgba(155,77,255,0.16); --border-default:rgba(155,77,255,0.28); --border-strong:var(--violet-primary);
  /* Text */
  --text-primary:var(--white); --text-secondary:var(--grey-1); --text-tertiary:var(--grey-2);
  /* Semantic */
  --hp-success:#3FBF7F; --hp-warning:#E0A93E; --hp-danger:#E0473E;
  /* Fonts */
  --font-display:'Oswald',Impact,'Arial Narrow',sans-serif;
  --font-body:'Rajdhani','Segoe UI',sans-serif;
  --font-mono:'JetBrains Mono',ui-monospace,monospace;
  /* Radii */
  --radius-sm:4px; --radius-md:8px; --radius-lg:14px; --radius-pill:999px;
  /* Elevation (black, for depth) + Glow (violet, emphasis only) */
  --shadow-elevation-1:0 2px 8px rgba(0,0,0,0.5);
  --shadow-elevation-2:0 8px 24px rgba(0,0,0,0.6);
  --shadow-elevation-3:0 16px 48px rgba(0,0,0,0.7);
  --shadow-glow-sm:0 0 12px rgba(155,77,255,0.35);
  --shadow-glow-md:0 0 28px rgba(155,77,255,0.45);
  --shadow-glow-lg:0 0 60px rgba(155,77,255,0.5);
  /* Official gradients (only two directions/hues allowed) */
  --gradient-surface:linear-gradient(180deg,var(--violet-dark) 0%,var(--black-deep) 100%);
  --gradient-surface-diagonal:linear-gradient(135deg,var(--violet-dark) 0%,var(--black-deep) 75%);
  --gradient-glow:linear-gradient(90deg,var(--violet-neon) 0%,rgba(155,77,255,0) 100%);
  /* Motion — restrained, functional only */
  --ease-standard:cubic-bezier(0.4,0,0.2,1); --ease-out:cubic-bezier(0,0,0.2,1);
  --duration-fast:120ms; --duration-base:200ms; --duration-slow:400ms;

  /* ── Legacy aliases → remapped onto Henk tokens ──
     The existing 2400-line stylesheet references these names everywhere;
     pointing them at the new tokens reskins the whole app in one move. */
  --sidebar-w:  220px;
  --bg:         var(--bg-page);
  --surface:    var(--bg-surface);
  --surface2:   var(--bg-surface-raised);
  --border:     var(--border-default);
  --accent:     var(--violet-primary);
  --accent-h:   var(--violet-neon);
  --accent-dim: rgba(155,77,255,0.12);
  --danger:     var(--hp-danger);
  --success:    var(--hp-success);
  --warning:    var(--hp-warning);
  --text:       var(--text-primary);
  --muted:      var(--text-secondary);
  --radius:     var(--radius-md);
}

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Display headlines use Oswald (matches the logo's bold geometric wordmark). */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; line-height: 1.2; }

a { color: var(--violet-neon); text-decoration: none; }
a:hover { color: #c199ff; text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  gap: 2rem;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: 0 .25rem;
  text-decoration: none !important;
}
.sidebar-brand span { color: var(--violet-neon); text-shadow: var(--shadow-glow-sm); }
.brand-logo {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(155,77,255,.45));
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .85rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .03em;
  text-decoration: none !important;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
  border: 1px solid transparent;
}
.nav-item:hover {
  background: var(--accent-dim);
  color: var(--text-primary);
}
/* Active — neon text + thin neon left marker (the 5% accent). */
.nav-item.active {
  background: var(--accent-dim);
  color: var(--violet-neon);
  border-color: var(--border-default);
  box-shadow: inset 3px 0 0 var(--violet-neon);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2rem 1.75rem 4rem;
}

/* ── Mobile top bar ───────────────────────────────────────────────────────── */
.mobile-bar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 300;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0 8px;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sidebar overlay (mobile) ─────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 190;
  opacity: 0;
  transition: opacity .2s;
}
.sidebar-overlay.show { opacity: 1; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard);
  text-decoration: none !important;
}
/* Primary — solid violet with a soft neon glow (brand action). */
.btn-primary  { background: var(--violet-primary); color: #fff; box-shadow: var(--shadow-glow-sm); }
.btn-primary:hover { background: var(--violet-primary); color: #fff; box-shadow: var(--shadow-glow-md); }
/* Ghost — subtle violet border for secondary actions. */
.btn-ghost    { background: transparent; color: var(--text-secondary); border-color: var(--border-default); }
.btn-ghost:hover { background: rgba(155,77,255,0.08); color: var(--text-primary); border-color: var(--violet-neon); }
/* Danger — outlined, fills on hover. */
.btn-danger   { background: transparent; color: var(--hp-danger); border-color: var(--hp-danger); }
.btn-danger:hover { background: var(--hp-danger); color: #fff; }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn:disabled, .btn-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Inline link-style button (used inside text/values) */
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  padding: 0;
  margin-left: .5rem;
  text-decoration: underline;
}
.btn-link:hover { color: var(--accent-h); }

/* ── Modal (overlay + card) ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: .1rem .55rem;
  border-radius: 6px;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-list {
  list-style: none;
  padding: .5rem;
  margin: 0;
  overflow-y: auto;
}
.modal-list li + li { border-top: 1px solid var(--border); }
.modal-list a {
  display: block;
  padding: .7rem .85rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  transition: background .12s;
}
.modal-list a:hover {
  background: var(--accent-dim);
  color: var(--accent-h);
  text-decoration: none;
}

/* ── CSV import results ───────────────────────────────────────────────────── */
.import-summary {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  padding: .75rem 1rem;
  background: var(--surface2);
  border-radius: 8px;
}
.import-details { margin-bottom: 1rem; }
.import-details summary {
  cursor: pointer;
  padding: .5rem 0;
  font-weight: 600;
  font-size: .9rem;
  color: var(--muted);
}
.import-list {
  list-style: none;
  padding: .5rem .75rem;
  margin: 0;
  background: var(--surface2);
  border-radius: 8px;
}
.import-list li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.import-list li:last-child { border-bottom: none; }
.import-skipped .import-reason { color: var(--danger); font-size: .85rem; }

.table-compact td, .table-compact th {
  padding: .45rem .75rem;
  font-size: .85rem;
}
.table-compact code {
  font-family: monospace;
  background: var(--surface2);
  padding: .1rem .4rem;
  border-radius: 4px;
  font-size: .8rem;
}
.contact-required {
  font-size: .8rem;
  color: var(--accent);
  vertical-align: middle;
  text-align: center;
}

input[type="file"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .55rem .85rem;
  font-size: .9rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .35rem .75rem;
  border-radius: 6px;
  font-size: .85rem;
  cursor: pointer;
  margin-right: .75rem;
}
input[type="file"]::file-selector-button:hover { background: var(--accent-h); }

/* ── Auth pages (login + setup) ───────────────────────────────────────────── */
/* Login/setup shell — full-bleed Berlin night-skyline key art behind a dark
   violet veil (~60% so foreground stays legible, per brand guidelines). */
.auth-body {
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(5,5,7,.80) 0%, rgba(5,5,7,.94) 100%),
    url("brand/skyline.jpg") center/cover no-repeat fixed;
}
.auth-shell {
  width: 100%;
  max-width: 380px;
}
/* Circular brand mark (hooded figure + Greek-key ring) above the card. */
.auth-logo {
  display: block;
  width: 108px;
  height: 108px;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 0 22px rgba(155,77,255,.55));
}
.auth-card {
  background: rgba(12,10,18,.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-elevation-3), var(--shadow-glow-sm);
}
.auth-card-wide { max-width: 460px; }
.auth-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: .04em;
  margin-bottom: .25rem;
}
.auth-title span { color: var(--violet-neon); text-shadow: var(--shadow-glow-sm); }
.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}
.auth-form { display: flex; flex-direction: column; gap: .75rem; margin-top: 1rem; }
.auth-form label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 0;
}
.auth-form input[type="text"] {
  font-family: monospace;
  font-size: 1.6rem;
  letter-spacing: .4em;
  text-align: center;
  padding: .7rem;
}
.auth-form .btn {
  width: 100%;
  justify-content: center;
  margin-top: .5rem;
  padding: .75rem;
}
.auth-error {
  background: rgba(224,71,62,0.12);
  border: 1px solid rgba(224,71,62,0.45);
  color: var(--danger);
  border-radius: 8px;
  padding: .55rem .85rem;
  font-size: .85rem;
}
.auth-foot { text-align: center; margin-top: 1.25rem; }

/* Setup-only blocks */
.setup-steps {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.6;
}
.setup-steps li { margin-bottom: .3rem; }
.setup-qr {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: var(--surface2);
  border-radius: 10px;
  margin-bottom: 1rem;
}
.setup-secret {
  text-align: center;
  margin-bottom: 1rem;
}
.setup-secret label {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .4rem;
}
.setup-secret code {
  display: inline-block;
  background: var(--surface2);
  border: 1px dashed var(--border);
  padding: .5rem .85rem;
  border-radius: 6px;
  font-family: monospace;
  font-size: .9rem;
  word-break: break-all;
  color: var(--accent);
  user-select: all;
}

/* ── Sidebar logout button ────────────────────────────────────────────────── */
.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
/* Signed-in account. The role sits under the name so it stays legible once
   roles other than "admin" exist. */
.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: 0 .85rem .7rem;
}
.sidebar-user-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.sidebar-user-role {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--violet-neon);
}
.nav-item-logout {
  width: 100%;
  background: none;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.nav-item-logout:hover {
  background: rgba(224, 82, 82, .08);
  color: var(--danger);
}

/* ── Backup codes display ─────────────────────────────────────────────────── */
.warning-block {
  background: rgba(224,169,62,0.12);
  border: 1px solid rgba(224,169,62,0.45);
  color: var(--hp-warning);
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .88rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.warning-block strong { color: var(--text); }
.warning-block.warning-danger {
  background: rgba(224,71,62,0.12);
  border-color: rgba(224,71,62,0.45);
  color: var(--danger);
}

.backup-codes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
  margin-bottom: 1rem;
}
.backup-code {
  font-family: monospace;
  font-size: 1.05rem;
  letter-spacing: .12em;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .65rem .8rem;
  text-align: center;
  color: var(--accent);
  user-select: all;
}
.codes-actions {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .9rem;
  cursor: pointer;
  margin-bottom: 0;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Recovery (backup-code) login input */
.recovery-input {
  font-family: monospace;
  font-size: 1.1rem !important;
  letter-spacing: .25em !important;
  text-align: center;
  text-transform: uppercase;
}

/* Security settings page */
.security-stat {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin: .5rem 0 1.25rem;
}
.security-stat-value {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--success);
}
.security-stat-warning { color: var(--hp-warning); }
.security-stat-danger  { color: var(--danger); }
.security-stat-label {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

@media (max-width: 480px) {
  .backup-codes-grid { grid-template-columns: 1fr; }
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.alert-success { background: rgba(63,191,127,0.12); border: 1px solid rgba(63,191,127,0.45); color: var(--success); }
.alert-error   { background: rgba(224,71,62,0.12); border: 1px solid rgba(224,71,62,0.45); color: var(--danger); }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.header-actions { display: flex; gap: .75rem; flex-shrink: 0; flex-wrap: wrap; }

/* ── Quick actions ────────────────────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: .75rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.quick-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none !important;
  transition: border-color .15s, background .15s;
  flex: 1 1 auto;
  justify-content: center;
}
.quick-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}
.quick-icon { font-size: 1rem; line-height: 1; }

/* ── Welcome hub (home page) ──────────────────────────────────────────────── */
/* Branded landing that sits inside the content area (sidebar stays). A framed
   skyline-key-art hero under a violet-black veil, the circular logo mark, and
   four quick-launch tiles. */
.welcome-hero {
  min-height: 60vh;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-elevation-2);
  overflow: hidden;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(5,5,7,.68) 0%, rgba(5,5,7,.88) 100%),
    url("brand/skyline.jpg") center/cover no-repeat;
}
.welcome-logo {
  width: 128px;
  height: 128px;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 26px rgba(155,77,255,.55));
}
.welcome-title {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.5rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 2.5rem;
  /* "Henk" (white) carries a soft neon halo… */
  text-shadow: 0 0 20px rgba(155,77,255,.35);
}
/* …and "OS" is the bright neon focal point. */
.welcome-title span { color: var(--violet-neon); text-shadow: var(--shadow-glow-md); }
/* Little "Beta" pill riding the top-right of the S. */
.beta-tag {
  font-family: var(--font-mono);
  font-size: .24em;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--violet-neon);
  background: rgba(106,31,176,.28);
  border: 1px solid var(--violet-primary);
  border-radius: var(--radius-pill);
  padding: .35em .6em;
  margin-left: .35em;
  vertical-align: super;
  position: relative;
  top: -.15em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: none;
  box-shadow: var(--shadow-glow-sm);
}
.welcome-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 1rem;
  width: 100%;
  max-width: 480px;
}
.welcome-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: 1.4rem 1rem;
  border-radius: var(--radius-lg);
  background: rgba(12,10,18,.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border-default);
  text-decoration: none !important;
  transition: transform var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard),
              background var(--duration-base) var(--ease-standard);
}
.welcome-tile:hover {
  transform: translateY(-3px);
  border-color: var(--violet-neon);
  box-shadow: var(--shadow-glow-md);
  background: rgba(21,15,31,.82);
}
/* Line icon — thin geometric stroke, neon, per the DS icon recommendation. */
.tile-icon {
  width: 30px;
  height: 30px;
  margin-bottom: .55rem;
  color: var(--violet-neon);
  filter: drop-shadow(0 0 6px rgba(155,77,255,.35));
}
.welcome-tile-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.welcome-tile-hint { font-size: .8rem; color: var(--text-tertiary); }

/* Agenda below the hero — orders still to handle (scheduled + on hold). */
.welcome-agenda { margin-top: 2rem; }
.welcome-agenda-head {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.welcome-agenda-head h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-primary);
}
.welcome-agenda-empty { padding: 1.5rem; text-align: center; }

@media (max-width: 520px) {
  .welcome-tiles { grid-template-columns: 1fr; max-width: 320px; }
  .welcome-hero { min-height: 48vh; padding: 2rem 1rem; }
}

/* ── Stats row ────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stats-row-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.5px; }
.stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card-spent .stat-value { color: var(--danger); }

/* ── Period breakdown ─────────────────────────────────────────────────────── */
.period-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.period-title {
  font-size: .9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .75rem;
}
.period-table .num { text-align: right; }
.period-label { font-family: monospace; font-size: .85rem; }
.revenue-cell { color: var(--success); font-weight: 600; }
.spent-cell   { color: var(--danger);  font-weight: 600; }
.net-pos { color: var(--success); font-weight: 700; }
.net-neg { color: var(--danger);  font-weight: 700; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevation-1);
  overflow: hidden;
}
/* Emphasis card — solid violet border + soft glow. Reserve for accent (5% rule). */
.card-glow {
  border-color: var(--violet-primary);
  box-shadow: var(--shadow-glow-sm);
}
.card-title {
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .08em;
}
/* "Danger zone" — destructive action separated from the main form (delete order, delete purchase…).
   Visually set apart with a top border and a subtle red tint, so a misclick on Enter can't fire it. */
.danger-zone-form {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
}

.card-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface2); }

/* ── Badges & tags ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .25rem .6rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  font-size: .7rem;
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}
.badge-lg     { font-size: .8rem; padding: .3rem .75rem; }
/* Brand-toned badge (violet). */
.badge-brand {
  background: rgba(106,31,176,0.25);
  color: var(--violet-neon);
  border-color: var(--violet-primary);
}
/* Danger-toned badge used for paused referral states (program-wide + per-Henkie). */
.badge-danger {
  background: rgba(224,71,62,0.12);
  color:      var(--hp-danger);
  border-color: var(--hp-danger);
  font-weight: 600;
}

/* ── Referral program UI ──────────────────────────────────────────────────── */

/* The pause/resume control on the Henkie profile (separated from Delete by a
   border) lives in a .card-footer.referral-control wrapper. */
.referral-control {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: flex-start;
}
.referral-locked-banner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.referral-lock-reason { margin: 0; }

/* Non-blocking warning on the new/edit Henkie form when the chosen referrer is
   paused (or the program is paused globally). Stays compact, doesn't shout. */
.referral-warning {
  margin-top: .65rem;
  padding: .65rem .8rem;
  background: rgba(245,158,11,.10);
  border: 1px solid rgba(245,158,11,.35);
  border-radius: 8px;
  color: var(--text);
}
.referral-warning strong { color: var(--hp-warning); }

/* The global kill-switch card on /referral. When the program is paused, the
   card gets a red-tinted border so it's impossible to miss. */
.referral-global-card.is-paused {
  border-color: rgba(244,63,94,.55);
  background: linear-gradient(to bottom, rgba(244,63,94,.05), transparent);
}

.contact-cell { display: flex; flex-wrap: wrap; gap: .4rem; }
.contact-tag {
  font-size: .75rem;
  padding: .2rem .55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.contact-tag.phone     { background: #1a2533; color: #7ab3e0; border-color: var(--border-default); }
.contact-tag.signal    { background: rgba(63,191,127,0.12); color: var(--hp-success); border-color: rgba(63,191,127,0.45); }
.contact-tag.telegram  { background: #1a2533; color: #7ab3e0; border-color: var(--border-default); }
.contact-tag.instagram { background: #2e1a2b; color: #e07ab3; border-color: #5a2d4f; }

/* ── Status badges ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s;
  white-space: nowrap;
}
.status-badge:hover { opacity: .75; }
.status-scheduled { background: rgba(155,77,255,0.10); color: var(--grey-1);     border-color: var(--border-default); }
.status-on_hold   { background: rgba(224,169,62,0.12); color: var(--hp-warning);  border-color: rgba(224,169,62,0.45); }
.status-completed { background: rgba(63,191,127,0.12); color: var(--hp-success);  border-color: rgba(63,191,127,0.45); }
.status-canceled  { background: rgba(224,71,62,0.12);  color: var(--hp-danger);   border-color: rgba(224,71,62,0.45); }

/* ── Status dots ──────────────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-scheduled { background: var(--grey-1); }
.status-dot-on_hold   { background: var(--hp-warning); }
.status-dot-completed { background: var(--hp-success); }
.status-dot-canceled  { background: var(--hp-danger); }

/* Clickable status picker (All Orders list) */
.status-picker {
  position: relative;
  display: inline-block;
}
button.status-dot {
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: outline-color .12s, transform .12s;
}
button.status-dot:hover {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button.status-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.status-menu {
  /* position: fixed → anchored to the viewport, NOT to the .card. This lets the
     menu escape the card's `overflow: hidden`, so it's never clipped even when the
     table has only one or two rows. The top/left are set by JS when it opens. */
  position: fixed;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .25rem;
  z-index: 100;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.status-menu[hidden] { display: none; }
.status-menu form { margin: 0; }
.status-menu-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  padding: .45rem .65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  text-align: left;
  font-family: inherit;
}
.status-menu-item:hover { background: var(--surface2); }
.status-menu-item.current {
  color: var(--accent);
  font-weight: 600;
}
.status-menu-item .status-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
}

/* ── Status select (inline dropdown on order cards) ───────────────────────── */
.status-select {
  width: auto;
  padding: .2rem .5rem;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  background-position: right .4rem center;
  padding-right: 1.6rem;
}
.status-select-scheduled { background-color: rgba(155,77,255,0.10); color: var(--grey-1);    border-color: var(--border-default); }
.status-select-on_hold   { background-color: rgba(224,169,62,0.12); color: var(--hp-warning); border-color: rgba(224,169,62,0.45); }
.status-select-completed { background-color: rgba(63,191,127,0.12); color: var(--hp-success); border-color: rgba(63,191,127,0.45); }
.status-select-canceled  { background-color: rgba(224,71,62,0.12);  color: var(--hp-danger);  border-color: rgba(224,71,62,0.45); }

/* Locked indicators for terminal statuses (completed / canceled).
   - status-dot-locked: cursor=not-allowed, no hover ring (used on All Orders).
   - status-select-locked: same colour scheme as the editable select but
     rendered as an inert span. Padding/typography match so the table row
     height doesn't jump.
   - radio-group-locked: dims the disabled radios used on Edit Order. */
.status-dot-locked       { cursor: not-allowed; outline: none !important; }
.status-dot-locked:hover { transform: none !important; }
.status-select-locked    {
  display: inline-block;
  padding: .3rem .65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 600;
  cursor: not-allowed;
  user-select: none;
}
.radio-group-locked .radio-option { opacity: .55; cursor: not-allowed; }
.radio-group-locked input[type="radio"] { cursor: not-allowed; }

/* ── Filter bar ───────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  border-radius: 8px;
  font-size: .85rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none !important;
  transition: color .15s, border-color .15s;
}
.filter-btn:hover { color: var(--text); border-color: var(--accent); }
.filter-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.filter-count {
  font-size: .75rem;
  background: var(--surface2);
  padding: .1rem .4rem;
  border-radius: 4px;
}

/* ── Inline helpers ───────────────────────────────────────────────────────── */
.inline-form { display: inline; }
.stat-inline { font-size: .9rem; color: var(--muted); align-self: center; }
.client-cell { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.description-cell {
  max-width: 240px;
  font-size: .9rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.amount-cell { font-weight: 600; color: var(--success); white-space: nowrap; }
.amount-cell.spent { color: var(--danger); }

/* ── Detail grid ──────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.profile-card { padding: 1.5rem; }

.field-group { margin-bottom: 1.25rem; }
.field { margin-bottom: .6rem; }
.field-label {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .2rem;
}
.field-value { font-size: .95rem; }
.field-block .field-value { display: block; margin-top: .3rem; }
.note-text {
  display: block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .85rem;
  font-size: .9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.referral-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.referral-tag {
  font-size: .8rem;
  padding: .2rem .6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}
.referral-tag:hover { border-color: var(--accent); text-decoration: none; }

/* ── Orders section ───────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-header h2 { font-size: 1.1rem; font-weight: 600; }

/* Per-Henkie price rules */
.price-rules-section { margin-top: 2rem; }
.rule-actions { display: flex; gap: .4rem; justify-content: flex-end; align-items: center; }
/* The little "*" next to a product that has a negotiated price rule, in order forms */
.price-rule-flag {
  display: inline-block;
  margin-left: .25rem;
  color: var(--accent);
  font-weight: 700;
  cursor: help;
}
.revenue-badge {
  font-size: .85rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(63,191,127,0.12);
  border: 1px solid rgba(63,191,127,0.45);
  padding: .25rem .7rem;
  border-radius: 6px;
  white-space: nowrap;
}

.revenue-badges { display: flex; gap: .5rem; flex-wrap: wrap; }
.revenue-badge-pending {
  color: var(--hp-warning);
  background: rgba(224,169,62,0.12);
  border-color: rgba(224,169,62,0.45);
}

.orders-list { display: flex; flex-direction: column; gap: .75rem; }
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
  gap: .5rem;
  flex-wrap: wrap;
}
.order-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.order-number { font-family: monospace; font-size: .8rem; color: var(--muted); }
.order-amount { font-weight: 700; font-size: 1.05rem; color: var(--success); white-space: nowrap; }
.order-header-right { display: flex; align-items: center; gap: .6rem; }
.order-description { font-size: .95rem; margin-bottom: .4rem; line-height: 1.5; }
.order-date { display: block; }

/* ── Order items ──────────────────────────────────────────────────────────── */
.order-items-list {
  margin: .4rem 0;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.order-item-row {
  display: grid;
  grid-template-columns: 1fr 40px 80px;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  padding: .2rem 0;
}
.item-name { color: var(--text); }
.item-qty { text-align: center; }
.item-total { text-align: right; font-weight: 600; color: var(--success); }

/* ── Catalogue ────────────────────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.product-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: .75rem;
  flex-wrap: wrap;
}
.product-name { font-size: 1rem; font-weight: 600; flex: 1; }
.product-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* Drag-and-drop reordering */
.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 0 .25rem;
  user-select: none;
  line-height: 1;
}
.drag-handle:active { cursor: grabbing; }
.product-card { transition: box-shadow .15s, opacity .15s; }
.product-card.dragging { opacity: .35; }
.product-card.drag-over-before { box-shadow: 0 -3px 0 0 var(--accent); }
.product-card.drag-over-after  { box-shadow: 0  3px 0 0 var(--accent); }

.product-notes {
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px dashed var(--border);
  font-size: .85rem;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.5;
}

.price-table { display: flex; flex-direction: column; gap: .3rem; }
.price-row {
  display: grid;
  grid-template-columns: 110px 80px 1fr;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  padding: .3rem .5rem;
  border-radius: 6px;
}
.price-row-base { background: var(--surface2); }
.price-qty { color: var(--text); }
.price-total { font-weight: 600; color: var(--success); }
.price-per { color: var(--muted); font-size: .75rem; }
.price-type-badge {
  display: inline-block;
  font-size: .65rem;
  padding: .1rem .35rem;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-per-unit { background: rgba(155,77,255,0.15); color: var(--accent-h); }

/* ── Tiers form ───────────────────────────────────────────────────────────── */
.tiers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.tier-row { margin-bottom: .75rem; }
.tier-inputs {
  display: grid;
  grid-template-columns: 100px 1fr 1fr auto;
  gap: .75rem;
  align-items: end;
}
.tier-inputs .form-group { margin-bottom: 0; }
.tier-type-group select { font-size: .85rem; }

/* ── Order product picker ─────────────────────────────────────────────────── */
.picker-table {
  /* Column widths shared by the header and every row so they always line up.
     Tweak here in one place; the QTY column must stay wide enough for the
     whole "− [input] +" stepper. */
  --qty-col: 124px;
  --total-col: 104px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: .5rem;
}
.picker-header {
  display: grid;
  grid-template-columns: 1fr var(--qty-col) var(--total-col);
  gap: .5rem;
  padding: .6rem 1rem;
  background: var(--surface2);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.picker-row {
  display: grid;
  grid-template-columns: 1fr var(--qty-col) var(--total-col);
  gap: .5rem;
  align-items: center;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  transition: background .12s;
}
.picker-row.has-qty { background: var(--accent-dim); }
.picker-name { font-size: .95rem; font-weight: 500; }
.picker-qty-ctrl { display: flex; align-items: center; justify-content: center; gap: .3rem; }
/* Display unit next to the quantity (only for g / ml products). */
.picker-unit {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-tertiary);
  min-width: 1.6em;
  text-align: left;
}
.qty-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s;
  flex-shrink: 0;
}
.qty-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Scoped (.picker-qty-ctrl .qty-input) so it beats the global
   `input[type="text"] { width: 100% }` rule — this stepper field stays small. */
.picker-qty-ctrl .qty-input {
  width: 46px;
  flex: 0 0 46px;
  box-sizing: border-box;
  text-align: center;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .2rem;
  -moz-appearance: textfield;
}
.picker-qty-ctrl .qty-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: none;
}
.picker-line-total {
  font-weight: 600;
  color: var(--muted);
  font-size: .95rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: .2rem .5rem;
  width: 100%;
  box-sizing: border-box;
}
.picker-line-total:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface2);
  color: var(--text);
}
.picker-line-total.has-value { color: var(--success); }

.order-summary-section {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.order-summary-row { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.order-summary-row .form-group { min-width: 160px; }

/* ── Select with action button ────────────────────────────────────────────── */
.select-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
}
.select-with-action label { margin-bottom: 0; }

/* ── Quick Henkie inline panel ────────────────────────────────────────────── */
.quick-henkie-panel {
  margin-top: .75rem;
  padding: 1rem 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.quick-henkie-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  margin-bottom: .85rem;
}
.quick-henkie-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: .25rem;
  flex-wrap: wrap;
}
.quick-henkie-error {
  font-size: .82rem;
  color: var(--danger);
  flex: 1;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-container { max-width: 700px; }
.form-container-sm { max-width: 520px; }
.form-card { padding: 1.75rem; }

.form-section { margin-bottom: 1.75rem; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section-title {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.form-hint { font-size: .85rem; color: var(--muted); margin-bottom: .85rem; }

.field-error { border-color: var(--danger) !important; }
.contact-error {
  font-size: .85rem;
  color: var(--danger);
  background: rgba(224,71,62,0.12);
  border: 1px solid rgba(224,71,62,0.45);
  border-radius: 8px;
  padding: .5rem .85rem;
  margin-bottom: .75rem;
}

.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .4rem;
  color: var(--text);
}
.required { color: var(--accent); }

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  color-scheme: dark;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: .6rem .85rem;
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard);
  outline: none;
  -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
input:focus, textarea:focus, select:focus {
  border-color: var(--violet-neon);
  box-shadow: 0 0 0 3px rgba(155,77,255,.18);
}
textarea { resize: vertical; }
select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b80' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }
select option { background: var(--bg-surface); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Radio group ──────────────────────────────────────────────────────────── */
.radio-group { display: flex; gap: .75rem; margin-top: .25rem; flex-wrap: wrap; }
.radio-option { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: normal; margin-bottom: 0; }
.radio-option input[type="radio"] { width: auto; accent-color: var(--accent); }
.radio-label { font-size: .9rem; }

/* ── List filters ─────────────────────────────────────────────────────────── */
.list-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.filter-field { display: flex; flex-direction: column; gap: .3rem; }
.filter-field label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 0;
}
.filter-field input,
.filter-field select { padding: .4rem .6rem; font-size: .85rem; }
.filter-field > input[type="text"] { width: 190px; }
.filter-field select { width: 140px; }
.filter-range { display: flex; align-items: center; gap: .4rem; }
.filter-range input { width: 100px; }
.filter-field input[type="date"] { width: 150px; }
.range-sep { color: var(--muted); }
.filter-actions { display: flex; gap: .5rem; margin-left: auto; }

/* ── Sortable table headers ───────────────────────────────────────────────── */
th.sortable { padding: 0; }
th.sortable a {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .75rem 1rem;
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  text-decoration: none !important;
  transition: color .12s;
}
th.sortable a:hover { color: var(--text); }
th.sortable.sorted a { color: var(--accent); }
.sort-arrow { font-size: .7rem; opacity: .45; }
th.sortable.sorted .sort-arrow { opacity: 1; }

/* ── Henkies list — table card scrolls horizontally when needed ───────────── */
.henkie-table-card { overflow-x: auto; }
.henkie-table { min-width: 920px; }

/* ── Henkies list — mobile card layout (hidden on desktop) ────────────────── */
.henkie-cards { display: none; }
.mobile-sort { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .25rem; }
.mobile-sort label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 0;
}
.henkie-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-decoration: none !important;
  color: var(--text);
  transition: border-color .15s;
}
.henkie-card:hover { border-color: var(--accent); }
.henkie-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .6rem;
}
.henkie-card-name { font-weight: 600; font-size: 1rem; color: var(--accent); }
.henkie-card-contact {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .75rem;
}
.henkie-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem .75rem;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.hc-stat { display: flex; flex-direction: column; gap: .1rem; }
.hc-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.hc-value { font-size: .9rem; }

/* ── Helpers ──────────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.muted-link { color: var(--muted); font-size: .85rem; }
.muted-link:hover { color: var(--accent); }
.small { font-size: .8rem; }
.block { display: block; }
.amount-pending { color: var(--hp-warning); font-weight: 600; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state p { margin-bottom: 1rem; }
.empty-state.small { padding: 2rem 1rem; }

/* ══════════════════════════════════════════════════════════════════════════
   HENK BOARD (Kanban)
   ══════════════════════════════════════════════════════════════════════════ */

/* The board itself: columns side by side, horizontal scroll if needed. */
.board {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 1rem;
}
.board-column {
  flex: 0 0 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: calc(100vh - 200px);
}
.board-column-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: 0 .15rem;
}
.inline-rename { flex: 1; min-width: 0; margin: 0; }
.board-column-name {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: .25rem .4rem;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}
.board-column-name:hover { background: var(--surface2); }
.board-column-name:focus {
  background: var(--surface2);
  border-color: var(--accent);
  outline: none;
  box-shadow: none;
}

/* Cards container = the drop zone */
.board-cards {
  flex: 1;
  min-height: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .25rem;
  border-radius: 6px;
  transition: background .15s;
}
.board-cards.drag-over { background: var(--accent-dim); }

/* A single card on the board */
.board-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: grab;
  transition: border-color .12s, transform .08s, box-shadow .12s;
}
.board-card:hover { border-color: var(--accent); }
.board-card.dragging { opacity: .4; cursor: grabbing; }
.board-card-link {
  display: block;
  padding: .6rem .7rem;
  color: inherit;
  text-decoration: none;
}
.board-card-title {
  font-weight: 600;
  font-size: .95rem;
  word-break: break-word;
}
.board-card-desc {
  margin-top: .35rem;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.board-card-meta {
  margin-top: .4rem;
  display: flex;
  gap: .6rem;
  font-size: .78rem;
  color: var(--muted);
}

/* "Add a card" — collapsed button by default, expands to title+description form */
.board-add-card { margin: 0; }
.board-add-card-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: .45rem .55rem;
  font-size: .85rem;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.board-add-card-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}
.board-add-card-form {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin: 0;
}
.board-add-card-form input[type="text"],
.board-add-card-form textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .45rem .55rem;
  font-size: .9rem;
  color: var(--text);
  resize: vertical;
}
.board-add-card-form input[type="text"]:focus,
.board-add-card-form textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: none;
}
.board-add-card-actions { display: flex; gap: .4rem; }

/* ── Per-column / per-card colour palette ──────────────────────────────────── */

/* Curated palette — same keys server-side (BOARD_COLORS) and client-side.
   Each colour has a "1" accent and a "2" dim/translucent fill for tinted backgrounds. */
:root {
  --bc-slate-1:   #64748b;  --bc-slate-2:   rgba(100,116,139,.18);
  --bc-indigo-1:  #6366f1;  --bc-indigo-2:  rgba(99,102,241,.18);
  --bc-violet-1:  #a78bfa;  --bc-violet-2:  rgba(167,139,250,.18);
  --bc-rose-1:    #f43f5e;  --bc-rose-2:    rgba(244,63,94,.18);
  --bc-amber-1:   #f59e0b;  --bc-amber-2:   rgba(245,158,11,.18);
  --bc-emerald-1: #10b981;  --bc-emerald-2: rgba(16,185,129,.18);
  --bc-sky-1:     #38bdf8;  --bc-sky-2:     rgba(56,189,248,.18);
}

/* Tinted column header — a thin coloured top stripe. */
.board-column[data-color] .board-column-header {
  border-bottom: 2px solid currentColor;
  padding-bottom: .35rem;
}
.board-column[data-color="slate"]   { color: var(--bc-slate-1);   }
.board-column[data-color="indigo"]  { color: var(--bc-indigo-1);  }
.board-column[data-color="violet"]  { color: var(--bc-violet-1);  }
.board-column[data-color="rose"]    { color: var(--bc-rose-1);    }
.board-column[data-color="amber"]   { color: var(--bc-amber-1);   }
.board-column[data-color="emerald"] { color: var(--bc-emerald-1); }
.board-column[data-color="sky"]     { color: var(--bc-sky-1);     }
.board-column[data-color] .board-column-name { color: var(--text); }

/* Tinted card — soft background tint + matching border */
.board-card[data-color="slate"]   { background: var(--bc-slate-2);   border-color: var(--bc-slate-1);   }
.board-card[data-color="indigo"]  { background: var(--bc-indigo-2);  border-color: var(--bc-indigo-1);  }
.board-card[data-color="violet"]  { background: var(--bc-violet-2);  border-color: var(--bc-violet-1);  }
.board-card[data-color="rose"]    { background: var(--bc-rose-2);    border-color: var(--bc-rose-1);    }
.board-card[data-color="amber"]   { background: var(--bc-amber-2);   border-color: var(--bc-amber-1);   }
.board-card[data-color="emerald"] { background: var(--bc-emerald-2); border-color: var(--bc-emerald-1); }
.board-card[data-color="sky"]     { background: var(--bc-sky-2);     border-color: var(--bc-sky-1);     }

/* The small trigger button (round swatch) embedded in a column header / on a card */
.color-trigger {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.color-trigger-swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  transition: border-color .12s, transform .12s;
}
.color-trigger:hover .color-trigger-swatch { border-color: var(--accent); transform: scale(1.15); }
/* The card colour trigger sits in the top-right corner, on top of the link */
.color-trigger-card {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 2;
  opacity: 0;
  transition: opacity .12s;
}
.board-card { position: relative; }
.board-card:hover .color-trigger-card { opacity: 1; }
.board-card[data-color] .color-trigger-card { opacity: 1; }   /* keep visible if a colour is set */

/* When a card or column has a colour, mirror it in its swatch indicator */
.board-card[data-color="slate"]   .color-trigger-swatch { background: var(--bc-slate-1);   border-color: var(--bc-slate-1);   }
.board-card[data-color="indigo"]  .color-trigger-swatch { background: var(--bc-indigo-1);  border-color: var(--bc-indigo-1);  }
.board-card[data-color="violet"]  .color-trigger-swatch { background: var(--bc-violet-1);  border-color: var(--bc-violet-1);  }
.board-card[data-color="rose"]    .color-trigger-swatch { background: var(--bc-rose-1);    border-color: var(--bc-rose-1);    }
.board-card[data-color="amber"]   .color-trigger-swatch { background: var(--bc-amber-1);   border-color: var(--bc-amber-1);   }
.board-card[data-color="emerald"] .color-trigger-swatch { background: var(--bc-emerald-1); border-color: var(--bc-emerald-1); }
.board-card[data-color="sky"]     .color-trigger-swatch { background: var(--bc-sky-1);     border-color: var(--bc-sky-1);     }
.board-column[data-color="slate"]   .color-trigger-swatch { background: var(--bc-slate-1);   border-color: var(--bc-slate-1);   }
.board-column[data-color="indigo"]  .color-trigger-swatch { background: var(--bc-indigo-1);  border-color: var(--bc-indigo-1);  }
.board-column[data-color="violet"]  .color-trigger-swatch { background: var(--bc-violet-1);  border-color: var(--bc-violet-1);  }
.board-column[data-color="rose"]    .color-trigger-swatch { background: var(--bc-rose-1);    border-color: var(--bc-rose-1);    }
.board-column[data-color="amber"]   .color-trigger-swatch { background: var(--bc-amber-1);   border-color: var(--bc-amber-1);   }
.board-column[data-color="emerald"] .color-trigger-swatch { background: var(--bc-emerald-1); border-color: var(--bc-emerald-1); }
.board-column[data-color="sky"]     .color-trigger-swatch { background: var(--bc-sky-1);     border-color: var(--bc-sky-1);     }

/* Shared popover palette — position:fixed (set inline by JS) so it can never get clipped */
.color-palette {
  position: fixed;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  width: 180px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.color-palette[hidden] { display: none; }

/* A single swatch in any palette (popover or card detail page) */
.color-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  padding: 0;
  transition: transform .1s, border-color .12s;
}
.color-swatch:hover     { transform: scale(1.12); border-color: var(--text); }
.color-swatch.selected  { outline: 2px solid var(--accent); outline-offset: 2px; }
.color-swatch-none      { position: relative; }
.color-swatch-none::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-top: 1.5px solid var(--danger);
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
  top: 50%;
}
.color-swatch[data-swatch="slate"]   { background: var(--bc-slate-1);   border-color: var(--bc-slate-1);   }
.color-swatch[data-swatch="indigo"]  { background: var(--bc-indigo-1);  border-color: var(--bc-indigo-1);  }
.color-swatch[data-swatch="violet"]  { background: var(--bc-violet-1);  border-color: var(--bc-violet-1);  }
.color-swatch[data-swatch="rose"]    { background: var(--bc-rose-1);    border-color: var(--bc-rose-1);    }
.color-swatch[data-swatch="amber"]   { background: var(--bc-amber-1);   border-color: var(--bc-amber-1);   }
.color-swatch[data-swatch="emerald"] { background: var(--bc-emerald-1); border-color: var(--bc-emerald-1); }
.color-swatch[data-swatch="sky"]     { background: var(--bc-sky-1);     border-color: var(--bc-sky-1);     }

/* Card detail page — colour section */
.card-color-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.card-color-label {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .5rem;
}
.card-color-form {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: 0;
}

/* "Add column" zone, right after the last column */
.board-add-column {
  flex: 0 0 280px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: .65rem;
}
.board-add-column form {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0;
}

/* Small icon-only delete button (×) used in column header / link rows / attachments */
.btn-icon-danger {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.btn-icon-danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Card detail page — link & attachment lists */
.card-link-list, .card-att-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.card-link-list li, .card-att-list li {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .55rem;
  background: var(--surface2);
  border-radius: 6px;
}
.card-link-list li a, .card-att-list li a { color: var(--accent); }
.card-link-list li > .inline-form,
.card-att-list  li > .inline-form { margin-left: auto; }
.card-link-form, .card-upload-form { margin-top: .5rem; }
.card-link-form .form-row, .card-upload-form .form-row { gap: .5rem; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 900px) ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-row-4 { grid-template-columns: repeat(2, 1fr); }
  .period-sections { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .profile-card { order: -1; }
}

/* ── Mobile (≤ 767px) — sidebar collapses ─────────────────────────────────── */
@media (max-width: 767px) {
  /* Show mobile bar */
  .mobile-bar { display: flex; }

  /* Sidebar becomes an off-canvas drawer, starts below the mobile bar */
  .sidebar {
    top: 52px;
    height: calc(100vh - 52px);
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; pointer-events: none; }
  .sidebar-overlay.show { pointer-events: auto; }

  /* Push content down to make room for mobile bar */
  .main-content { margin-left: 0; padding-top: 52px; }

  /* Tighten container */
  .container { padding: 1.25rem 1rem 3rem; }

  /* Hide sidebar brand on desktop (shown above nav on sidebar) — show on mobile bar only */
  .sidebar .sidebar-brand { display: none; }

  /* Page headers stack */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 1.4rem; }
  .header-actions { width: 100%; }

  /* Stats */
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stats-row-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.3rem; }

  /* Quick actions — 2 per row */
  .quick-actions { gap: .5rem; }
  .quick-btn { flex: 1 1 calc(50% - .25rem); font-size: .85rem; padding: .6rem .75rem; }

  /* Tables — horizontal scroll */
  .card { overflow-x: auto; }
  .table { min-width: 520px; }
  .period-table { min-width: 420px; }

  /* List filters stack on mobile */
  .list-filters .filter-actions { margin-left: 0; width: 100%; }
  .filter-field { flex: 1 1 auto; }
  .filter-field > input[type="text"] { width: 100%; }

  /* Henkies list — swap table for cards */
  .henkie-table-card { display: none; }
  .henkie-cards { display: flex; flex-direction: column; gap: .75rem; }

  /* Picker — narrow the columns via the shared variables (QTY still fits the stepper) */
  .picker-table { --qty-col: 120px; --total-col: 92px; }
  .picker-header,
  .picker-row {
    font-size: .8rem;
    padding: .6rem .75rem;
  }

  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; gap: 1rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }
  .tier-inputs { grid-template-columns: 80px 1fr 1fr auto; gap: .5rem; }
  .form-card { padding: 1.25rem; }
  .order-summary-row { flex-direction: column; gap: .75rem; }

  /* Period sections already 1 column at 900px */
}

/* ══════════════════════════════════════════════════════════════════════════
   HENK ACADEMY
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tag chips ────────────────────────────────────────────────────────────── */
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none !important;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
  white-space: nowrap;
}
.tag-chip:hover {
  background: var(--accent-dim);
  color: var(--accent-h);
  border-color: var(--accent);
}
.tag-chip.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Tag filter bar ───────────────────────────────────────────────────────── */
.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.5rem;
  align-items: center;
}
.tag-filter-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-right: .25rem;
}

/* ── Article grid ─────────────────────────────────────────────────────────── */
.academy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* ── Article card ─────────────────────────────────────────────────────────── */
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  text-decoration: none !important;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.article-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
}
.article-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.article-card-excerpt {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}
.article-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.article-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.article-card-date {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Article tags row ─────────────────────────────────────────────────────── */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

/* ── Article body (rendered markdown) ────────────────────────────────────── */
.article-body {
  line-height: 1.75;
  font-size: .975rem;
}
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  font-weight: 700;
  letter-spacing: -.3px;
  margin-top: 1.75rem;
  margin-bottom: .5rem;
  color: var(--text);
  line-height: 1.3;
}
.article-body h1 { font-size: 1.6rem; }
.article-body h2 { font-size: 1.3rem; }
.article-body h3 { font-size: 1.1rem; }
.article-body h4, .article-body h5, .article-body h6 { font-size: 1rem; }
.article-body p { margin-bottom: 1rem; }
.article-body ul, .article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.article-body li { margin-bottom: .3rem; }
.article-body a { color: var(--accent); }
.article-body a:hover { color: var(--accent-h); }
.article-body code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: .875em;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .35em;
  color: var(--accent-h);
}
.article-body pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .875rem;
  color: var(--text);
}
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--muted);
  font-style: italic;
}
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.article-body img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: .5rem 0;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
.article-body th, .article-body td {
  border: 1px solid var(--border);
  padding: .5rem .75rem;
  text-align: left;
}
.article-body th { background: var(--surface2); font-weight: 600; }

/* ── Side-by-side editor ──────────────────────────────────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.editor-pane {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.editor-pane textarea {
  height: 560px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: .875rem;
  resize: vertical;
}
.preview-pane {
  overflow-y: auto;
  max-height: 600px;
  padding: 1rem 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: sticky;
  top: 1rem;
}
.preview-pane-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .6rem;
}

/* ── Editor toolbar ───────────────────────────────────────────────────────── */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
}
.editor-pane textarea {
  border-radius: 0 0 8px 8px;
}
.toolbar-btn {
  padding: .25rem .5rem;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: "SF Mono", "Fira Code", monospace;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.toolbar-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(155,77,255,0.3);
}

/* ── Tag selector (form) ──────────────────────────────────────────────────── */
.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 48px;
  align-items: center;
}
.tag-selector .tag-chip.selected {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}
.new-tag-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-top: .5rem;
}
.new-tag-row input {
  flex: 1;
  max-width: 220px;
}

/* ── Upload zone ──────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}
.upload-zone input[type="file"] { display: none; }

/* ── Attachment list ──────────────────────────────────────────────────────── */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .75rem;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
}
.attachment-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.attachment-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  font-size: .7rem;
  color: var(--muted);
  font-family: monospace;
  text-transform: uppercase;
  font-weight: 600;
}
.attachment-name {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-name a { color: var(--accent); }

/* ── Article detail header area ───────────────────────────────────────────── */
.article-header { margin-bottom: 1.5rem; }
.article-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: .75rem;
  line-height: 1.25;
}
.article-date {
  font-size: .82rem;
  color: var(--muted);
  margin-top: -.25rem;
  margin-bottom: .75rem;
}
.article-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Section divider ──────────────────────────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0 1.25rem;
}
.section-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* ── Mobile: editor collapses ─────────────────────────────────────────────── */
@media (max-width: 767px) {
  .editor-layout { grid-template-columns: 1fr; }
  .preview-pane { display: none; }
  .editor-pane textarea { height: 360px; }
  .academy-grid { grid-template-columns: 1fr; }
}

/* ── Small phones (≤ 390px) ───────────────────────────────────────────────── */
@media (max-width: 390px) {
  .stats-row,
  .stats-row-4 { grid-template-columns: 1fr 1fr; }
  .quick-btn { flex: 1 1 calc(50% - .25rem); }
  .picker-table { --qty-col: 116px; --total-col: 80px; }
  .picker-header,
  .picker-row { font-size: .75rem; }
}

/* ── Incidents ──────────────────────────────────────────────────────────────── */
.badge-success {
  background: #15281f;
  color: #7fd0a5;
  border-color: #2c4a3a;
  font-family: inherit;
  font-weight: 600;
}

.incident-list { display: flex; flex-direction: column; gap: .75rem; }
.incident-card { padding: 1rem 1.1rem; }
.incident-card-open { border-left: 3px solid var(--danger); }
.incident-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.incident-type { font-weight: 600; }
.incident-date { margin-left: auto; }
.incident-description { margin-top: .6rem; }
.incident-resolution { margin-top: .4rem; }
.incident-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.incident-links .badge { font-family: inherit; }
a.badge:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.incident-actions { display: flex; gap: .5rem; margin-top: .8rem; align-items: center; }
.incident-actions form { display: inline; }
.incident-type-filter { margin-left: auto; margin-bottom: 0; }
.incident-type-filter select { font-size: .85rem; padding: .4rem .6rem; width: auto; }

/* Multi-select pick-lists on the incident form: no fake dropdown arrow, normal height. */
.incident-multi {
  width: 100%;
  height: auto;
  background-image: none;
  padding-right: .6rem;
  cursor: default;
}
.incident-multi option { padding: .2rem .3rem; }

.radio-row { display: flex; gap: 1.5rem; }
.radio-inline { display: flex; align-items: center; gap: .4rem; font-weight: 400; cursor: pointer; }
.radio-inline input { width: auto; cursor: pointer; }
.form-section-hint { margin-bottom: .8rem; }

/* Red incident marker on list rows / cards (same visual language as the status dots). */
.incident-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--danger);
  vertical-align: middle;
  margin-left: .35rem;
}

/* Incident panel reused on the order / Henkie / product detail pages. */
.incident-section { margin-top: 1.25rem; }
.incident-panel { padding: 1rem 1.1rem; margin-top: 1rem; }
.incident-panel-flagged { border-left: 3px solid var(--danger); }
.incident-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.incident-panel-head h2 { margin: 0; }
.incident-panel-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.incident-panel-item { padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 8px; }
.incident-panel-item-open { border-left: 3px solid var(--danger); }
.incident-panel-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.incident-panel-desc { margin-top: .35rem; }

/* ── Markdown import (Henk Academy) ──────────────────────────────────────── */
/* Checkbox variant of .tag-chip: same pill, but driven by a real input so the
   page needs no JavaScript to record a selection. */
.tag-chip-check { cursor: pointer; user-select: none; }
.tag-chip-check input { margin-right: 6px; vertical-align: middle; }
.tag-chip-check:has(input:checked) {
  color: var(--violet-neon);
  border-color: var(--violet-neon);
  background: rgba(155, 77, 255, .10);
}

/* The front-matter example on the import screen. */
.md-sample {
  background: var(--bg-inset, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono, monospace);
  font-size: .82rem;
  line-height: 1.6;
  color: var(--text-secondary, var(--muted));
}
