/* ============================================================
   STOCERS Command Center — design system
   ============================================================ */
:root {
  /* type */
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  /* warm-neutral light canvas */
  --bg: #f4f3f0;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-3: #f0efeb;
  --border: #e6e4df;
  --border-strong: #d8d5cf;

  --text: #1c1a17;
  --text-2: #6a655e;
  --text-3: #9b958c;

  /* brand (logo red) */
  --brand: #8f0009;
  --brand-ink: #5c0a10;     /* sidebar */
  --brand-ink-2: #480810;
  --brand-soft: #fbe9e8;

  /* functional accent (calm blue) */
  --accent: #2a62cc;
  --accent-strong: #1f4fb0;
  --accent-soft: #eaf1fc;
  --accent-line: #c9dbf6;

  /* status */
  --ok: #207f4c;        --ok-soft: #e6f3ea;   --ok-line:#bfe3cc;
  --warn: #b9760f;      --warn-soft: #fbf0db; --warn-line:#f0d9a8;
  --danger: #c5302b;    --danger-soft: #fbe8e6; --danger-line:#f2c4bf;
  --info: var(--accent);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(28,26,23,.05), 0 1px 1px rgba(28,26,23,.04);
  --shadow: 0 1px 3px rgba(28,26,23,.06), 0 4px 14px -6px rgba(28,26,23,.10);
  --shadow-lg: 0 8px 30px -10px rgba(28,26,23,.20);

  --sidebar-w: 250px;
  --topbar-h: 64px;
  --space: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.45;
}
#root { min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }

/* density modes (set on body) */
body[data-density="compact"] { --space: 16px; --radius: 11px; font-size: 13px; }
body[data-density="ruim"]    { --space: 30px; }

/* scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: #d9d6d0; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #c4c0b8; background-clip: content-box; }

/* ============================ layout ============================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }

/* sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--brand-ink) 0%, var(--brand-ink-2) 100%);
  color: #fff; height: 100vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.sb-brand { padding: 20px 22px 18px; display: flex; align-items: center; gap: 11px; }
.sb-brand img { height: 26px; width: auto; display: block; }
.sb-brand .sub {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.55); font-weight: 600; margin-top: 2px;
}
.sb-divider { height: 1px; background: rgba(255,255,255,.10); margin: 2px 16px 10px; }
.sb-nav { padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.sb-section { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: rgba(255,255,255,.4); font-weight: 600; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: 9px; color: rgba(255,255,255,.78); font-weight: 500; font-size: 13.5px;
  background: none; border: none; width: 100%; text-align: left; position: relative;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  background: #fff; border-radius: 0 3px 3px 0;
}
.nav-item .nav-ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item .nav-badge {
  margin-left: auto; background: #fff; color: var(--brand-ink); font-size: 11px;
  font-weight: 700; min-width: 19px; height: 19px; border-radius: 99px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono);
}
.nav-item.active .nav-badge { background: #fff; }
.nav-item.nav-key { background: #d97b3c; color: #fff; font-weight: 600; box-shadow: 0 1px 8px rgba(217,123,60,.30); }
/* AdPilot robot-animatie */
@keyframes adpFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 25% { transform: translateY(-2.5px) rotate(-4deg); } 60% { transform: translateY(1px) rotate(3deg); } }
.adp-bot { animation: adpFloat 3.2s ease-in-out infinite; box-shadow: 0 2px 10px rgba(184,32,37,.35); }
@media (prefers-reduced-motion: reduce) { .adp-bot { animation: none; } }
.nav-item.nav-key .nav-ico { color: #fff; }
.nav-item.nav-key:hover { background: #e58b4f; color: #fff; }
.nav-item.nav-key.active { background: #e58b4f; color: #fff; }
.sb-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.sb-user:hover { background: rgba(255,255,255,.08); }
.sb-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.16);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.sb-user .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.sb-user .em { font-size: 11.5px; color: rgba(255,255,255,.55); }

/* main */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow-y: scroll; scrollbar-gutter: stable; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
}
.tb-search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 9px;
  background: var(--surface-3); border: 1px solid transparent; border-radius: 10px;
  padding: 8px 12px; color: var(--text-3); transition: .15s;
}
.tb-search:focus-within { background: #fff; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.tb-search input { border: none; background: none; outline: none; flex: 1; font-size: 13.5px; color: var(--text); font-family: inherit; }
.tb-search-wrap { position: relative; flex: 1; max-width: 460px; }
.tb-search-wrap .tb-search { max-width: none; }
.tb-clear { border: none; background: none; color: var(--text-3); display: grid; place-items: center; padding: 0; cursor: pointer; }
.tb-clear:hover { color: var(--text); }
.tb-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; max-height: 360px; overflow-y: auto; }
.tb-result { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; padding: 8px 10px; border-radius: 9px; text-align: left; cursor: pointer; }
.tb-result:hover { background: var(--surface-2); }
.tb-noresult { padding: 14px 12px; color: var(--text-3); font-size: 13px; text-align: center; }
.tb-kbd { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: #fff; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tb-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text-2); display: grid; place-items: center; position: relative; transition: .14s; }
.tb-btn:hover { background: var(--surface-3); color: var(--text); }
.tb-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid #fff; }
.tb-date { font-size: 13px; color: var(--text-2); font-weight: 500; padding-right: 8px; border-right: 1px solid var(--border); margin-right: 4px; }
.sb-date { display: none; }

.content { padding: 28px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* page header */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 25px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.page-head .ph-sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.page-head .ph-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ============================ cards ============================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; font-weight: 600; margin: 0; letter-spacing: -.005em; }
.card-head .ch-sub { font-size: 12.5px; color: var(--text-3); }
.card-head .ch-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: var(--space); }
.grid > * { min-width: 0; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.col-7-5 { grid-template-columns: 1.6fr 1fr; }
.col-5-7 { grid-template-columns: 1fr 1.6fr; }
@media (max-width: 1180px){ .cols-4{grid-template-columns:repeat(2,1fr);} .col-7-5,.col-5-7,.cols-3,.cols-2{grid-template-columns:1fr;} }

/* kpi */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.kpi .k-top { display: flex; align-items: center; gap: 9px; }
.kpi .k-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.kpi .k-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.kpi .k-val { font-size: 27px; font-weight: 600; letter-spacing: -.02em; font-feature-settings: "tnum"; line-height: 1; }
.kpi .k-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }

/* delta */
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12.5px; font-family: var(--font-mono); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-3); }
.delta svg { width: 13px; height: 13px; }

/* status pill */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px 3px 8px; border-radius: var(--radius-pill); border: 1px solid; white-space: nowrap; }
.pill .pdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pill.ok .pdot { background: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.pill.warn .pdot { background: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.pill.danger .pdot { background: var(--danger); }
.pill.neutral { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.pill.neutral .pdot { background: var(--text-3); }
.pill.accent { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-line); }
.pill.accent .pdot { background: var(--accent); }

/* tag / chip */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 6px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); transition: .14s; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; border: 1px solid var(--border-strong); background: #fff; color: var(--text); transition: .14s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td, .tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.tbl .prod { display: flex; align-items: center; gap: 11px; }
.row-click { cursor: pointer; }

/* product thumb */
.thumb { width: 38px; height: 38px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; overflow: hidden; position: relative; }
.thumb svg { width: 19px; height: 19px; }

/* progress / bar */
.bar { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; }

/* stars */
.stars { display: inline-flex; gap: 1px; color: #e3a008; }
.stars svg { width: 14px; height: 14px; }
.stars .empty { color: var(--border-strong); }

/* attention list */
.att-item { display: flex; gap: 13px; padding: 14px 16px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); align-items: flex-start; transition: .14s; }
.att-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.att-ico { width: 36px; height: 36px; border-radius: 9px; flex: none; display: grid; place-items: center; }
.att-body { flex: 1; min-width: 0; }
.att-title { font-weight: 600; font-size: 13.5px; }
.att-desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.att-action { margin-top: 8px; }
.att-done { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; cursor: pointer; font-family: inherit; flex: none; }
.att-done:hover { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.cost-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 13.5px; }
.cost-row.sub { color: var(--text-2); font-size: 13px; padding: 5px 0; }
.cost-row.total { font-weight: 700; font-size: 14.5px; }
.cost-sep { height: 1px; background: var(--border); margin: 4px 0; }
.kpi-click { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi-click:hover { box-shadow: var(--shadow-lg, 0 4px 16px rgba(0,0,0,.08)); transform: translateY(-1px); }
.list-search { flex: 1 1 160px; min-width: 130px; max-width: 280px; padding: 6px 11px; }
@media (max-width: 820px) {
  .list-search { max-width: none; flex: 1 1 100%; }
  .card-head { flex-wrap: wrap; gap: 10px; }
}
.card-toggle { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 18px; background: none; border: none; cursor: pointer; font-family: inherit; color: inherit; }
.card-toggle:hover { background: var(--surface-2); }
.ch-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ch-title { display: block; font-weight: 600; font-size: 14.5px; }
.ch-sub { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

/* insight / tip banner */
.insight {
  background: linear-gradient(110deg, var(--brand-ink) 0%, var(--brand) 75%, var(--brand) 100%);
  color: #fff; border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden;
  display: flex; gap: 18px; align-items: flex-start;
}
.insight::after { content:""; position:absolute; right:-40px; top:-40px; width: 220px; height: 220px; background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%); }
.insight .ins-ico { width: 42px; height: 42px; border-radius: 11px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.insight h3 { margin: 0 0 4px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.7); font-weight: 600; }
.insight .ins-text { font-size: 15.5px; line-height: 1.5; max-width: 760px; }
.insight .ins-text b { font-weight: 600; }
.insight .ins-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.ins-btn { background: #fff; color: var(--brand-ink); border: none; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ins-btn.ghost { background: rgba(255,255,255,.12); color: #fff; }
.ins-btn svg { width: 15px; height: 15px; }

/* AI block */
.ai-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 3px 9px; border-radius: 99px; }
.ai-tag svg { width: 13px; height: 13px; }

/* review item */
.review { padding: 14px 0; border-bottom: 1px solid var(--border); }
.review:last-child { border-bottom: none; }
.review .rv-top { display: flex; align-items: center; gap: 10px; }
.review .rv-prod { font-size: 12px; color: var(--text-3); margin-left: auto; }
.review .rv-text { font-size: 13px; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.review .rv-meta { font-size: 11.5px; color: var(--text-3); margin-top: 6px; display: flex; gap: 10px; align-items: center; }

/* list rows */
.lrow { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.lrow:last-child { border-bottom: none; }

/* empty / placeholder */
.placeholder {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 40px;
  text-align: center; color: var(--text-3);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(0,0,0,.014) 9px, rgba(0,0,0,.014) 18px);
}
.placeholder .ph-mono { font-family: var(--font-mono); font-size: 12px; }

/* settings */
.set-field { padding: 16px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.set-field:last-child { border-bottom: none; }
.set-field .sf-label { font-weight: 600; font-size: 13.5px; }
.set-field .sf-help { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.input { width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text); transition: .14s; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-family: var(--font-mono); font-size: 12.5px; }
label.lbl { font-size: 12px; font-weight: 600; color: var(--text-2); display: block; margin-bottom: 5px; }

/* connection status row */
.conn { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.conn .c-logo { width: 42px; height: 42px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; flex: none; color: var(--text-2); font-size: 13px; }

/* misc */
.muted { color: var(--text-2); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.sec-title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin: 4px 0 0; }
.hr { height: 1px; background: var(--border); border: none; margin: 0; }
.flame-mini { color: var(--brand); }

/* entrance: opacity-only, capture-safe; transform removed to avoid ghosting in DOM-clone captures */
@keyframes fadeUp { from { opacity: .4; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) { .view { animation: fadeUp .2s ease-out; } }

/* tooltip-ish sparkline hover dot handled in JS */
.spark-wrap { position: relative; }

/* refresh spin + mobile orders button */
@keyframes spin { to { transform: rotate(360deg); } }
.tb-btn.spin svg { animation: spin .8s linear infinite; }
.tb-orders { text-decoration: none; }
@media (max-width: 820px) {
  .tb-orders-label { display: none; }
  .tb-orders { padding: 7px 9px; }
}

/* setup hero (frisse-start wizard) */
.setup-hero { background: linear-gradient(110deg, var(--brand-ink) 0%, var(--brand) 78%, var(--brand) 100%); border-radius: var(--radius); color: #fff; overflow: hidden; box-shadow: var(--shadow); }
.setup-top { display: flex; align-items: center; gap: 16px; padding: 20px 22px; }
.setup-ico { width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.setup-top h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.setup-sub { font-size: 13px; color: rgba(255,255,255,.78); margin: 2px 0 9px; }
.setup-bar { height: 7px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; max-width: 420px; }
.setup-bar > span { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .35s ease; }
.setup-count { font-size: 11.5px; color: rgba(255,255,255,.7); margin-top: 5px; }
.setup-btn { flex: none; display: inline-flex; align-items: center; gap: 7px; background: #fff; color: var(--brand-ink); border: none; padding: 11px 18px; border-radius: 11px; font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit; }
.setup-btn:hover { background: #f4eceb; }
.setup-body { background: var(--surface); color: var(--text); display: grid; grid-template-columns: 270px 1fr; border-top: 1px solid rgba(255,255,255,.12); }
.setup-steps { border-right: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.setup-step { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px; border: none; background: none; cursor: pointer; text-align: left; font-family: inherit; color: inherit; }
.setup-step:hover { background: var(--surface-2); }
.setup-step.active { background: var(--brand-soft); }
.setup-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-3); flex: none; }
.setup-check.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-step-label { display: block; font-size: 13px; font-weight: 600; }
.setup-step-hint { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.setup-panel { padding: 20px; min-width: 0; }
@media (max-width: 820px) {
  .setup-top { flex-wrap: wrap; }
  .setup-btn { width: 100%; justify-content: center; }
  .setup-body { grid-template-columns: 1fr; }
  .setup-steps { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .setup-step { flex-direction: column; min-width: 92px; text-align: center; gap: 5px; }
  .setup-step > svg { display: none; }
  .setup-step-hint { display: none; }
}

/* mobile card lists (replace wide tables on small screens) */
.m-cards { display: none; }
.m-card { display: block; width: 100%; text-align: left; border: none; background: none; padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; font-family: inherit; color: inherit; }
.m-card:last-child { border-bottom: none; }
.m-card:active { background: var(--surface-2); }
.m-card-top { display: flex; align-items: center; gap: 11px; }
.m-card-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-card-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; font-size: 12px; color: var(--text-2); align-items: center; }
.m-card-stats b { color: var(--text); font-weight: 600; }
@media (max-width: 820px) {
  .desk-only { display: none !important; }
  .m-cards { display: block; }
}

/* ============================ PIN gate ============================ */
.pin-screen { position: fixed; inset: 0; z-index: 999; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, var(--brand-ink) 0%, var(--brand-ink-2) 100%); }
.pin-card { background: #fff; border-radius: 18px; padding: 34px 30px; width: 350px; max-width: 100%;
  box-shadow: var(--shadow-lg); text-align: center; animation: fadeUp .25s ease-out; }
.pin-card img { display: block; margin: 0 auto; }
.pin-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.pin-sub { color: var(--text-2); font-size: 13.5px; margin: 4px 0 18px; }
.pin-input { text-align: center; font-size: 22px; letter-spacing: 8px; margin-bottom: 12px; }
.pin-input.pin-err { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.pin-errmsg { color: var(--danger); font-size: 12.5px; margin: -4px 0 10px; }

/* ============================ mobile ============================ */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100vh; }
  .sidebar { height: auto; z-index: 40; }
  .main { height: auto; min-height: 0; }
  .sb-brand { padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .sb-brand img { height: 22px; }
  .sb-date { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.15; color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); padding: 5px 12px; border-radius: 12px; }
  .sb-date-lbl { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .72; }
  .sb-date-val { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
  .sb-brand .sub { display: none; }
  .sb-divider { display: none; }
  .sb-nav { flex-direction: row; overflow-x: auto; padding: 4px 8px 8px; gap: 3px; -webkit-overflow-scrolling: touch; }
  .sb-section { display: none; }
  .nav-item { flex-direction: column; gap: 3px; padding: 7px 11px; font-size: 10.5px; white-space: nowrap; border-radius: 10px; }
  .nav-item.active::before { display: none; }
  .nav-item .nav-ico { width: 20px; height: 20px; }
  .nav-item .nav-badge { position: absolute; top: 3px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; }
  .sb-foot { display: none; }
  .content { padding: 16px; overflow-x: hidden; }
  .topbar { padding: 0 14px; gap: 10px; }
  .tb-date { display: none; }
  .tb-search { max-width: none; }
  .page-head h1 { font-size: 21px; }
  .set-field { grid-template-columns: 1fr !important; gap: 8px; }
  .insight { flex-direction: column; gap: 12px; }
}

/* ============================ Dagdoel-balk (Winst) ============================ */
.goalbar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 22px; margin-bottom: var(--space);
  transition: box-shadow .45s ease, border-color .45s ease;
}
.goalbar-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.goalbar-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.goalbar-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.goalbar-amount { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1; }
.goalbar-goal { font-size: 15px; font-weight: 600; color: var(--text-3); }
.goalbar-track { position: relative; height: 16px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.goalbar-fill { height: 100%; border-radius: 999px; min-width: 5px; transition: width .7s cubic-bezier(.2,.7,.2,1), background .6s ease; }
.goalbar-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-top: 9px; font-weight: 500; }
/* feest: helder groen, glow + puls */
.goalbar-done { border-color: #16c46a; box-shadow: 0 0 0 1px #16c46a, 0 0 30px rgba(22,196,106,.35); animation: goalpulse 1.9s ease-in-out infinite; }
.goalbar-done .goalbar-title { color: #0a8f48; }
.goalbar-done .goalbar-fill {
  background: linear-gradient(90deg, #16c46a, #4ee08c, #16c46a) !important; background-size: 200% 100%;
  box-shadow: 0 0 16px rgba(22,196,106,.7); animation: goalshine 1.8s linear infinite;
}
@keyframes goalpulse {
  0%, 100% { box-shadow: 0 0 0 1px #16c46a, 0 0 20px rgba(22,196,106,.30); }
  50% { box-shadow: 0 0 0 1px #16c46a, 0 0 42px rgba(22,196,106,.58); }
}
@keyframes goalshine { from { background-position: 0 0; } to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .goalbar-done { animation: none; }
  .goalbar-done .goalbar-fill { animation: none; }
}
