  /* =========================================================
     Pinokkio — built on SnowUI tokens.
     Surfaces:    --background-{1,2,4,5}
     Borders:     var(--border-hairline) (= --black-10)
     Radius:      --radius-{8,12,16}
     Spacing:     --spacing-{4,8,12,16,20,24}
     Type:        Inter, scale 12/14/18/24/32
     Status accents: red (low), green (ok), orange (warning), indigo (transfer)
     ========================================================= */

  *, *::before, *::after { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0;
    background: var(--background-2);
    font-family: var(--font-inter);
    color: var(--fg-1);
    overflow: hidden;
    min-width: 1280px;
  }
  code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

  /* ---- App shell ---------------------------------------- */
  .app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }

  /* ---- Sidebar ---------------------------------------- */
  aside.sidebar {
    background: var(--background-1);
    border-right: 1px solid var(--border-hairline);
    padding: var(--spacing-16) var(--spacing-12);
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .brand {
    display: flex; align-items: center; gap: var(--spacing-12);
    padding: var(--spacing-8) var(--spacing-12) var(--spacing-20);
    border-bottom: 1px solid var(--border-hairline);
    margin-bottom: var(--spacing-12);
  }
  .brand-mark {
    width: 44px; height: 50px;
    flex: 0 0 44px;
    object-fit: contain;
    display: block;
  }
  .brand-text { display: flex; flex-direction: column; line-height: 1; }
  .brand-name { font-weight: 600; font-size: var(--text-14); color: var(--fg-1); letter-spacing: -0.01em; }
  .brand-tagline { font-size: 11px; color: var(--fg-3); margin-top: 3px; white-space: nowrap; }
  .brand .sidebar-toggle {
    margin-left: auto;
    width: 28px; height: 28px; flex: 0 0 28px;
    border: 0; background: transparent; border-radius: var(--radius-8);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .brand .sidebar-toggle:hover { background: var(--black-4); }
  .brand .sidebar-toggle img { width: 16px; height: 16px; opacity: 0.6; }

  /* Collapsed sidebar → icon rail. The class lives on <html> so the head
     script can apply the persisted state before first paint. */
  html.sidebar-collapsed .app { grid-template-columns: 68px 1fr; }
  html.sidebar-collapsed .brand-mark,
  html.sidebar-collapsed .brand-text,
  html.sidebar-collapsed .nav-group,
  html.sidebar-collapsed .nav-label,
  html.sidebar-collapsed .user-card .who,
  html.sidebar-collapsed .user-card .more { display: none; }
  html.sidebar-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  html.sidebar-collapsed .brand .sidebar-toggle { margin-left: 0; }
  html.sidebar-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
  html.sidebar-collapsed .user-card { justify-content: center; padding: var(--spacing-8); }

  .nav-group {
    font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em;
    padding: var(--spacing-12) var(--spacing-12) var(--spacing-4);
    font-weight: 600;
  }
  .nav-item {
    display: flex; align-items: center; gap: var(--spacing-12);
    padding: var(--spacing-8) var(--spacing-12);
    border-radius: var(--radius-8);
    font-size: var(--text-14);
    color: var(--fg-2);
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: background 150ms ease, color 150ms ease;
    margin-bottom: 2px;
  }
  .nav-item img { width: 18px; height: 18px; opacity: 0.7; }
  .nav-item:hover { background: var(--black-4); }
  .nav-item.active {
    background: var(--background-4);
    color: var(--fg-1);
    font-weight: 500;
  }
  .nav-item.active img { opacity: 1; }

  .sidebar-spacer { flex: 1 1 auto; min-height: var(--spacing-16); }

  .user-card {
    display: flex; align-items: center; gap: var(--spacing-12);
    padding: var(--spacing-12);
    background: var(--background-2);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-12);
  }
  .user-card img.ava { width: 36px; height: 36px; border-radius: var(--radius-full); flex: 0 0 36px; }
  .user-card .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .user-card .name { font-weight: 500; font-size: var(--text-14); color: var(--fg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-card .role { font-size: 11px; color: var(--fg-3); }
  .user-card .more { width: 28px; height: 28px; border: 0; background: transparent; border-radius: var(--radius-8); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
  .user-card .more:hover { background: var(--black-4); }
  .user-card .more img { width: 16px; height: 16px; opacity: 0.6; }

  /* ---- Main column ---------------------------------------- */
  main.col { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

  header.top {
    display: flex; align-items: center; gap: var(--spacing-12);
    padding: 0 var(--spacing-24);
    height: 60px;
    border-bottom: 1px solid var(--border-hairline);
    background: var(--background-1);
    flex: 0 0 60px;
  }
  /* Title on the first line, subtitle stacked beneath it (KAN-43 #26). */
  .top .page-heading { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; }
  .top .page-heading h1 {
    font-size: var(--text-16); font-weight: 600; letter-spacing: -0.01em;
    color: var(--fg-1); margin: 0; line-height: 1.2; white-space: nowrap;
  }
  .top .page-heading .sub {
    font-size: var(--text-12); color: var(--fg-3); line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .top .page-heading .sub:empty { display: none; }
  .top .page-actions { margin-left: auto; flex: 0 0 auto; align-items: center; }

  .iconbtn {
    width: 36px; height: 36px;
    border-radius: var(--radius-8);
    background: transparent; border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
    transition: background 150ms ease;
  }
  .iconbtn:hover { background: var(--black-4); }
  .iconbtn img { width: 18px; height: 18px; opacity: 0.7; }
  .iconbtn .dot {
    position: absolute; top: 8px; right: 8px;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--secondary-red);
    box-shadow: 0 0 0 2px var(--background-1);
  }

  /* ---- Page region ------------------------------------ */
  .page-scroll { overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; }
  .page { padding: var(--spacing-24) var(--spacing-24) var(--spacing-40); max-width: 1400px; margin: 0 auto; }
  .page-actions { display: flex; gap: var(--spacing-8); }

  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px;
    background: var(--background-1);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-8);
    font-size: var(--text-14); color: var(--fg-1);
    font-family: inherit; font-weight: 500;
    cursor: pointer;
    transition: background 150ms ease, border 150ms ease;
  }
  .btn img { width: 14px; height: 14px; opacity: 0.7; }
  .btn:hover { background: var(--black-4); }
  .btn.primary { background: var(--fg-1); color: var(--background-1); border-color: transparent; }
  .btn.primary img { filter: invert(1); opacity: 0.9; }
  .btn.primary:hover { background: var(--black-80); }
  .btn.sm { height: 30px; padding: 0 10px; font-size: var(--text-12); }
  .btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
  .btn.ghost:hover { background: var(--black-4); }

  /* ---- Cards ------------------------------------------ */
  .card {
    background: var(--background-1);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-16);
    padding: var(--spacing-20);
  }
  .card.tint-indigo { background: var(--background-4); border-color: transparent; }
  .card.tint-blue { background: var(--background-5); border-color: transparent; }
  .card.tint-mint { background: #E5FAF6; border-color: transparent; }
  .card.tint-orange { background: #FFEFD9; border-color: transparent; }

  .card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--spacing-16); gap: var(--spacing-12);
  }
  .card-head h2 {
    font-size: var(--text-18); font-weight: 600; letter-spacing: -0.01em;
    color: var(--fg-1); margin: 0;
  }
  .card-head .sub { font-size: var(--text-12); color: var(--fg-3); }

  /* ---- Stat cards ------------------------------------- */
  .stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--spacing-16); }
  .stat {
    padding: var(--spacing-20);
    border-radius: var(--radius-16);
    background: var(--background-1);
    border: 1px solid var(--border-hairline);
    display: flex; flex-direction: column; gap: var(--spacing-12);
    min-height: 120px;
  }
  .stat.tint-indigo { background: var(--background-4); border-color: transparent; }
  .stat.tint-blue { background: var(--background-5); border-color: transparent; }
  .stat.tint-mint { background: #E5FAF6; border-color: transparent; }
  .stat.tint-orange { background: #FFEFD9; border-color: transparent; }
  .stat-label { font-size: var(--text-14); font-weight: 500; color: var(--fg-1); display: flex; align-items: center; justify-content: space-between; }
  .stat-label .badge-soft { font-size: 11px; padding: 1px 8px; border-radius: var(--radius-80); background: var(--white-80); color: var(--fg-2); font-weight: 500; }
  .stat-bottom { display: flex; align-items: baseline; justify-content: space-between; margin-top: auto; gap: 12px; }
  .stat-value { font-size: var(--text-32); font-weight: 600; line-height: 1; letter-spacing: -0.025em; color: var(--fg-1); font-variant-numeric: tabular-nums; }
  .stat-delta {
    font-size: var(--text-12); font-weight: 500;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: var(--radius-80);
    background: var(--white-80);
    color: var(--fg-2);
  }
  .stat-delta.up { color: #1F8A5B; }
  .stat-delta.down { color: #B22B2B; }
  .stat-delta img { width: 12px; height: 12px; }
  .stat-spark { display: flex; align-items: end; gap: 3px; height: 28px; margin-top: var(--spacing-4); }
  .stat-spark span {
    flex: 1; min-width: 0;
    background: var(--black-10);
    border-radius: 2px;
    transition: background 150ms ease;
  }
  .stat.tint-indigo .stat-spark span { background: #ADADFB80; }
  .stat-spark span.hi { background: var(--fg-1); }

  /* ---- Generic row utilities -------------------------- */
  .row { display: flex; align-items: center; gap: var(--spacing-12); }
  .row-8 { display: flex; align-items: center; gap: var(--spacing-8); }
  .col-12 { display: flex; flex-direction: column; gap: var(--spacing-12); }
  .col-16 { display: flex; flex-direction: column; gap: var(--spacing-16); }
  .grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--spacing-16); }
  .gap-16 { gap: var(--spacing-16); }
  .mt-16 { margin-top: var(--spacing-16); }
  .mt-24 { margin-top: var(--spacing-24); }
  .muted { color: var(--fg-3); }

  /* ---- Badges ----------------------------------------- */
  .chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    font-size: 11px; font-weight: 500;
    border-radius: var(--radius-80);
    background: var(--black-4);
    color: var(--fg-2);
    line-height: 1.4;
    white-space: nowrap;
  }
  .chip.depot { background: #FFEFD9; color: #8A4B00; }
  .chip.apl { background: #FFE5D0; color: #934700; }
  .chip.pharmacom { background: #D6E8FF; color: #0A4488; }
  .chip.low { background: #FFD9D9; color: #B22B2B; }
  .chip.ok { background: #D8F4DD; color: #1F6E3D; }
  .chip.over { background: #E5E5FE; color: #4040B8; }
  .chip.soldout { background: #2B2B33; color: #FFFFFF; }
  .chip.dot::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
  }
  .chip.inbestelling { background: #FFE2C4; color: #8A4B00; }
  .chip.klaarmaken { background: #E1E1FE; color: #3030A4; }
  .chip.centralfilling { background: #D6E8FF; color: #0A4488; }
  .chip.klaarvooruitgifte { background: #D8F4DD; color: #1F6E3D; }
  .chip.archief { background: var(--black-4); color: var(--fg-3); }

  /* ---- Tables ----------------------------------------- */
  .table-card { padding: 0; overflow: hidden; }
  .table-card .table-head {
    padding: var(--spacing-20);
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--spacing-12);
  }
  .table-card .filters {
    display: flex; align-items: center; gap: var(--spacing-8);
    padding: 0 var(--spacing-20) var(--spacing-16);
    flex-wrap: wrap;
  }
  table {
    width: 100%; border-collapse: collapse;
    font-size: var(--text-14);
  }
  thead th {
    text-align: left;
    padding: var(--spacing-8) var(--spacing-20);
    font-weight: 500;
    font-size: var(--text-12);
    color: var(--fg-3);
    background: var(--background-2);
    border-top: 1px solid var(--border-hairline);
    border-bottom: 1px solid var(--border-hairline);
    white-space: nowrap;
  }
  tbody td {
    padding: var(--spacing-12) var(--spacing-20);
    border-bottom: 1px solid var(--border-hairline);
    color: var(--fg-1);
    vertical-align: middle;
  }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover { background: var(--black-4); }
  td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
  td.center, th.center { text-align: center; }
  td .sub { font-size: var(--text-12); color: var(--fg-3); }
  td code { background: var(--black-4); padding: 1px 6px; border-radius: 4px; color: var(--fg-2); font-size: 12px; }

  /* product cell */
  .prod { display: flex; align-items: center; gap: var(--spacing-12); min-width: 0; }
  .thumb {
    width: 36px; height: 36px;
    border-radius: var(--radius-8);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 36px;
    background: var(--background-4);
  }
  .thumb img { width: 18px; height: 18px; opacity: 0.7; }
  .thumb.alt { background: var(--background-5); }
  .thumb.alt2 { background: #E5FAF6; }
  .thumb.alt3 { background: #FFEFD9; }
  .prod .meta { min-width: 0; }
  .prod .name { font-weight: 500; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .prod .meta .sub { color: var(--fg-3); font-size: var(--text-12); margin-top: 2px; }

  /* stock bar */
  .stock-bar {
    display: flex; flex-direction: column; gap: 4px; min-width: 120px;
  }
  .stock-bar .nums {
    font-size: var(--text-12); color: var(--fg-2);
    display: flex; justify-content: space-between;
    font-variant-numeric: tabular-nums;
  }
  .stock-bar .nums b { color: var(--fg-1); font-weight: 600; }
  .stock-bar .track {
    height: 6px; border-radius: 3px;
    background: var(--black-4);
    position: relative; overflow: hidden;
  }
  .stock-bar .fill {
    position: absolute; left: 0; top: 0; height: 100%;
    background: var(--fg-1);
    border-radius: 3px;
  }
  .stock-bar .fill.low { background: var(--secondary-red); }
  .stock-bar .fill.warn { background: #E89017; }
  .stock-bar .fill.ok { background: #4FBB6E; }
  .stock-bar .min-mark {
    position: absolute; top: -2px; bottom: -2px; width: 1px;
    background: var(--fg-3);
  }

  /* ---- Pagination ------------------------------------- */
  .pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--spacing-16) var(--spacing-20);
    font-size: var(--text-14); color: var(--fg-3);
    border-top: 1px solid var(--border-hairline);
  }
  .pagination .pages { display: flex; gap: 4px; align-items: center; }
  .pg-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-8);
    background: transparent;
    border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--fg-2);
    font-size: var(--text-14);
    font-family: inherit;
    font-variant-numeric: tabular-nums;
  }
  .pg-btn:hover { background: var(--black-4); }
  .pg-btn.active { background: var(--fg-1); color: var(--background-1); }
  .pg-btn img { width: 14px; height: 14px; opacity: 0.7; }
  .pg-btn[disabled] { opacity: 0.3; cursor: not-allowed; }

  /* ---- Page sections (routing) ------------------------ */
  .screen { display: none; }
  .screen.active { display: block; }

  /* ---- Dashboard creative panels ---------------------- */
  .funnel { display: flex; flex-direction: column; gap: 6px; }
  .funnel-row {
    display: grid; grid-template-columns: 140px 1fr 60px;
    align-items: center; gap: var(--spacing-12);
    font-size: var(--text-14);
  }
  .funnel-row .lab { color: var(--fg-2); display: flex; align-items: center; gap: 6px; }
  .funnel-row .lab .dotcol { width: 8px; height: 8px; border-radius: 50%; }
  .funnel-row .bar { background: var(--black-4); border-radius: 4px; height: 24px; position: relative; overflow: hidden; }
  .funnel-row .bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
  .funnel-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

  .aging-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 8px; align-items: end;
    height: 180px;
  }
  .aging-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: end; }
  .aging-bar .bar {
    width: 100%; max-width: 48px;
    background: var(--background-4);
    border-radius: var(--radius-8) var(--radius-8) 4px 4px;
    position: relative;
    transition: transform 150ms ease;
  }
  .aging-bar .bar.danger { background: linear-gradient(to top, #FF4747 0%, #FF8484 100%); }
  .aging-bar .bar.warn { background: linear-gradient(to top, #FFB55B 0%, #FFD699 100%); }
  .aging-bar .bar.ok { background: linear-gradient(to top, #ADADFB 0%, #CFCFFB 100%); }
  .aging-bar .bar .num {
    position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
    font-size: var(--text-12); color: var(--fg-1); font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  .aging-bar .lab { font-size: var(--text-12); color: var(--fg-3); }

  /* pharmacy stack chart (redesigned KAN-43 #36 — single-line names, no overlap) */
  .ph-list { display: flex; flex-direction: column; }
  .ph-row {
    display: grid; grid-template-columns: 200px 1fr 64px;
    gap: var(--spacing-16); align-items: center;
    padding: var(--spacing-10) 0;
    font-size: var(--text-14);
  }
  .ph-row + .ph-row { border-top: 1px solid var(--border-hairline); }
  .ph-row .lab { display: flex; align-items: center; gap: var(--spacing-8); color: var(--fg-1); font-weight: 500; min-width: 0; }
  .ph-row .lab .ph-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ph-row .lab .init {
    width: 24px; height: 24px; border-radius: 6px; flex: 0 0 24px;
    background: var(--background-4);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 600; color: var(--fg-1);
    letter-spacing: 0.02em;
  }
  .ph-row .lab.depot .init { background: #FFEFD9; color: #8A4B00; }
  .ph-row .stack {
    display: flex; height: 16px; border-radius: 4px; overflow: hidden;
    background: var(--black-4); gap: 2px;
  }
  .ph-row .stack > * { height: 100%; }
  .ph-row .stack > *:not(:first-child) { box-shadow: -2px 0 0 var(--background-1); }
  .ph-row .stack .ok { background: #71DD8C; }
  .ph-row .stack .warn { background: #FFB55B; }
  .ph-row .stack .low { background: #FF4747; }
  .ph-row .total { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg-2); font-size: var(--text-12); }

  /* Universal depot marker (KAN-43 #37) — home icon = headquarters */
  .depot-marker {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; flex: 0 0 18px;
    border-radius: 5px; background: #FFEFD9;
  }
  .depot-marker img { width: 12px; height: 12px; opacity: 0.85; }

  /* depot transfer flow ring */
  .flow-card { padding: 0; overflow: hidden; }
  .flow-stage {
    position: relative;
    height: 280px;
    background:
      radial-gradient(circle at 50% 50%, transparent 30%, var(--background-4) 30.2%, transparent 30.4%),
      radial-gradient(circle at 50% 50%, transparent 36%, var(--background-4) 36.1%, transparent 36.2%);
    overflow: hidden;
  }
  .flow-node {
    position: absolute; transform: translate(-50%, -50%);
    background: var(--background-1);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-12);
    padding: 10px 12px;
    font-size: var(--text-12);
    box-shadow: 0 1px 2px var(--black-4);
    text-align: center;
    min-width: 92px;
  }
  .flow-node.depot {
    background: var(--fg-1); color: var(--background-1);
    border-color: transparent;
    box-shadow: 0 8px 24px var(--black-20), inset 0 1px 0 var(--white-20);
    z-index: 3;
  }
  .flow-node.satellite { z-index: 2; }
  .flow-node .nm { font-weight: 600; font-size: var(--text-14); letter-spacing: -0.01em; }
  /* football-substitution in/out badges: green ▲ received, red ▼ sent */
  .flow-node .io {
    display: flex; gap: 8px; justify-content: center; margin-top: 3px;
    font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  }
  .flow-node .io-in { color: #30A46C; }   /* green — units in */
  .flow-node .io-out { color: #E5484D; }  /* red — units out */
  .flow-node .io .zero { opacity: 0.4; font-weight: 500; }
  .flow-node.depot .io-in { color: #4ADE80; }   /* brighter on the dark hub */
  .flow-node.depot .io-out { color: #FF6B6B; }
  .flow-legend .io-in { color: #30A46C; }
  .flow-legend .io-out { color: #E5484D; }
  .flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
  .flow-lines .flow-link { fill: none; stroke: #9A9AF0; stroke-width: 1.5; opacity: 0.7; stroke-linecap: round; }
  .flow-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg-3); font-size: var(--text-12); }

  /* ---- Census tiles + transfer summary (KAN-43 round 3) ---- */
  .stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stat-grid.five .stat-value { font-size: 26px; }
  .stat-grid.five .stat { padding: var(--spacing-16); }
  .stat-foot { font-size: 11px; color: var(--fg-3); }
  .tf-tile { gap: var(--spacing-8); }
  .tf-tile .stat-label a.badge-soft { text-decoration: none; }
  .tf-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-8) var(--spacing-12); margin-top: auto; }
  .tf-metric { display: flex; flex-direction: column; line-height: 1.15; }
  .tf-metric b { font-size: var(--text-18); font-weight: 600; color: var(--fg-1); font-variant-numeric: tabular-nums; }
  .tf-metric b.warn { color: #B22B2B; }
  .tf-metric span { font-size: 10px; color: var(--fg-3); }

  /* ---- Source-split donut ---- */
  .donut-wrap { display: flex; align-items: center; gap: var(--spacing-20); }
  .donut {
    --apl-color: #C2410C; --pharm-color: #1D63B0;
    width: 132px; height: 132px; flex: 0 0 132px; border-radius: 50%;
    background: conic-gradient(var(--apl-color) 0 var(--apl), var(--pharm-color) var(--apl) 100%);
    display: grid; place-items: center;
  }
  .donut-hole {
    width: 88px; height: 88px; border-radius: 50%;
    background: var(--background-1);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
  }
  .donut-total { font-size: var(--text-18); font-weight: 600; color: var(--fg-1); font-variant-numeric: tabular-nums; }
  .donut-total-lab { font-size: 11px; color: var(--fg-3); }
  .donut-legend { display: flex; flex-direction: column; gap: var(--spacing-8); min-width: 0; flex: 1; }
  .legend-row { display: flex; align-items: center; gap: var(--spacing-8); font-size: var(--text-12); }
  .legend-row .swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
  .legend-row .swatch.apl { background: #C2410C; }
  .legend-row .swatch.pharmacom { background: #1D63B0; }
  .legend-row .legend-name { color: var(--fg-1); font-weight: 500; }
  .legend-row .legend-val { color: var(--fg-3); margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }

  /* ---- Spark bar charts (dispensing turnover / demand inflow) ---- */
  .spark-bars { display: flex; align-items: flex-end; gap: 8px; height: 124px; }
  .spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
  .spark-bar { width: 100%; max-width: 34px; background: linear-gradient(to top, #6D6DF0 0%, #A9A9F7 100%); border-radius: 5px 5px 3px 3px; }
  .spark-bar.alt { background: linear-gradient(to top, #2FA37A 0%, #7FD3B8 100%); }
  .spark-lab { font-size: 10px; color: var(--fg-3); white-space: nowrap; }
  .panel-foot { display: flex; justify-content: space-between; font-size: var(--text-12); color: var(--fg-3); }
  .panel-foot b { color: var(--fg-1); font-variant-numeric: tabular-nums; }
  .panel-empty { display: grid; place-items: center; min-height: 124px; color: var(--fg-3); font-size: var(--text-12); }

  /* ---- De-thumbed product / imports rows ---- */
  .prod-name { font-weight: 500; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .import-row { display: flex; align-items: flex-start; gap: var(--spacing-12); padding: var(--spacing-8) 0; border-bottom: 1px solid var(--border-hairline); }
  .import-row:last-child { border-bottom: 0; }
  .import-dot { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--background-4); }
  .import-dot img { width: 15px; height: 15px; opacity: 0.8; }
  .import-dot.success { background: #D8F4DD; }
  .import-dot.failed { background: #FFD9D9; }

  /* ---- Stock page details ----------------------------- */
  .filter-bar {
    display: flex; gap: var(--spacing-8); align-items: center;
    padding: var(--spacing-16) var(--spacing-20);
    border-bottom: 1px solid var(--border-hairline);
    flex-wrap: wrap;
  }
  .input, .select {
    height: 36px;
    background: var(--background-1);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-8);
    padding: 0 12px;
    font-size: var(--text-14);
    font-family: inherit;
    color: var(--fg-1);
    min-width: 140px;
  }
  .input:focus, .select:focus { outline: 4px solid var(--black-4); border-color: var(--fg-3); }
  .input.search-inline { width: 280px; padding-left: 36px; background-image: url("assets/icons/regular/magnifying-glass-regular.svg"); background-repeat: no-repeat; background-position: 12px center; background-size: 16px; }
  .select { padding-right: 32px; appearance: none; background-image: url("assets/icons/regular/caret-down-regular.svg"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
  .seg {
    display: inline-flex; padding: 3px;
    background: var(--background-2);
    border-radius: var(--radius-8);
    border: 1px solid var(--border-hairline);
    font-size: var(--text-12);
  }
  .seg button {
    height: 28px; padding: 0 12px;
    background: transparent; border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit; font-size: inherit; font-weight: 500;
    color: var(--fg-2);
  }
  .seg button.active { background: var(--background-1); color: var(--fg-1); box-shadow: 0 1px 2px var(--black-10); }

  /* Stock filter row: keep search + filters on one line (KAN-43 #39). */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; }
  .filter-bar .search-inline { width: 220px; flex: 0 0 220px; min-width: 0; }
  .filter-bar .select { flex: 0 0 190px; width: 190px; min-width: 0; }
  .filter-bar .seg { flex: 0 0 auto; }
  .filter-count { margin-left: auto; padding-left: var(--spacing-12); color: var(--fg-3); font-size: var(--text-12); white-space: nowrap; }
  .filter-count b { color: var(--fg-1); }

  /* Status column: keep the chip off the container's right edge (KAN-43 #38). */
  .table-scroll { overflow-x: auto; }
  th.status-col, td.status-col { padding-right: var(--spacing-24); white-space: nowrap; }

  /* Centred pagination with reachable first/last pages (KAN-43 #41). */
  .pagination { flex-direction: column; align-items: center; justify-content: center; gap: var(--spacing-8); }
  .pagination .pages { justify-content: center; flex-wrap: wrap; }
  .pagination-summary { font-size: var(--text-12); color: var(--fg-3); }
  .pagination-summary b { color: var(--fg-1); }
  .pg-ellipsis { padding: 0 4px; color: var(--fg-3); align-self: center; }

  /* ---- Transfer page ---------------------------------- */
  .tr-section {
    background: var(--background-1);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-16);
    margin-bottom: var(--spacing-16);
    overflow: hidden;
  }
  .tr-section .head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--spacing-16) var(--spacing-20);
    border-bottom: 1px solid var(--border-hairline);
    gap: var(--spacing-12);
  }
  .tr-section .head .l { display: flex; align-items: center; gap: var(--spacing-12); }
  .tr-section .head .l .ph-mark {
    width: 32px; height: 32px; border-radius: var(--radius-8);
    background: var(--background-4);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: var(--text-12); color: var(--fg-1);
  }
  .tr-section .head .l .ph-mark.depot { background: #FFEFD9; color: #8A4B00; }
  .tr-section .head h3 {
    margin: 0; font-size: var(--text-18); font-weight: 600; letter-spacing: -0.01em;
  }
  .tr-section .head .meta { color: var(--fg-3); font-size: var(--text-12); margin-top: 2px; }
  .tr-section .head .totals {
    display: flex; gap: var(--spacing-16); align-items: center;
  }
  .tr-section .head .total-num { font-size: var(--text-18); font-weight: 600; font-variant-numeric: tabular-nums; }
  .tr-section .head .total-label { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.06em; }

  .recipe-line-ids {
    font-family: var(--font-mono); font-size: 11px; color: var(--fg-3);
    line-height: 1.5;
  }
  .arrow-cell { display: inline-flex; align-items: center; gap: 8px; }
  .arrow-cell img { width: 14px; height: 14px; opacity: 0.4; }

  /* ---- Settings page (empty state) -------------------- */
  .settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--spacing-16); }
  .setting-tile {
    background: var(--background-1);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-16);
    padding: var(--spacing-20);
    display: flex; flex-direction: column; gap: var(--spacing-12);
    cursor: not-allowed;
    opacity: 0.65;
    transition: opacity 150ms ease;
  }
  .setting-tile.active { opacity: 1; cursor: pointer; }
  .setting-tile .ic {
    width: 40px; height: 40px;
    border-radius: var(--radius-12);
    background: var(--background-4);
    display: inline-flex; align-items: center; justify-content: center;
  }
  .setting-tile .ic img { width: 20px; height: 20px; opacity: 0.7; }
  .setting-tile h3 { margin: 0; font-size: var(--text-16); font-weight: 600; }
  .setting-tile p { margin: 0; color: var(--fg-3); font-size: var(--text-14); line-height: 1.5; }
  .setting-tile .stat-row { display: flex; gap: var(--spacing-12); margin-top: auto; padding-top: var(--spacing-8); border-top: 1px dashed var(--border-hairline); font-size: var(--text-12); color: var(--fg-3); }
  .empty-banner {
    background: var(--background-4);
    border-radius: var(--radius-16);
    padding: var(--spacing-24);
    display: flex; align-items: center; gap: var(--spacing-16);
    margin-bottom: var(--spacing-24);
  }
  .empty-banner .ic {
    width: 48px; height: 48px; border-radius: var(--radius-12);
    background: var(--background-1);
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 48px;
  }
  .empty-banner .ic img { width: 24px; height: 24px; }
  .empty-banner h3 { margin: 0 0 4px; font-size: var(--text-16); font-weight: 600; }
  .empty-banner p { margin: 0; font-size: var(--text-14); color: var(--fg-2); }

  /* ---- Misc ------------------------------------------- */
  .divider { height: 1px; background: var(--border-hairline); margin: var(--spacing-16) 0; }
  .text-r { text-align: right; }
