:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --ink: #15202b;
  --ink-2: #55606b;
  --line: #e2ded6;
  --brand: #12324a;
  --brand-ink: #ffffff;
  --accent: #0f6e8c;
  --crit: #c2341f;
  --crit-bg: #fbe9e5;
  --warn: #a96300;
  --warn-bg: #fdf1dc;
  --info: #2a5ea8;
  --info-bg: #e6eefa;
  --ok: #24794a;
  --ok-bg: #e3f3e9;
  --muted-bg: #eeebe5;
  --radius: 10px;
  --fbb: #0f6e8c;
  --fbr: #c9a24a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b; --surface: #17212a; --ink: #e8edf1; --ink-2: #9aa7b2; --line: #26323d;
    --brand: #0b1a26; --accent: #4fb3d1;
    --crit: #ff8a75; --crit-bg: #3a1a15; --warn: #f0b45a; --warn-bg: #36280f;
    --info: #8ab4f0; --info-bg: #172840; --ok: #6fd39b; --ok-bg: #12301f; --muted-bg: #1e2a34;
    --fbb: #4fb3d1; --fbr: #d9b45c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 4px 0 14px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 22px 0 10px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* top bar */
.top {
  background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; gap: 18px; padding: 10px 16px;
  position: sticky; top: 0; z-index: 10;
}
.top .logo { font-weight: 700; letter-spacing: 0.02em; color: #fff; }
.top .logo span { color: #f0b45a; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: #cfe0ea; padding: 6px 10px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.top form { margin: 0; }
.top .who { color: #cfe0ea; font-size: 13px; }
.linkbtn { background: none; border: 0; color: #cfe0ea; cursor: pointer; font: inherit; font-size: 13px; padding: 4px; }

/* bottom nav (mobiel) */
.bottom {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom a { flex: 1; text-align: center; padding: 10px 0 8px; font-size: 12px; color: var(--ink-2); }
.bottom a.on { color: var(--accent); font-weight: 600; }
.bottom svg { display: block; margin: 0 auto 2px; width: 22px; height: 22px; }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px; }
.banner { background: var(--warn-bg); color: var(--warn); padding: 8px 16px; font-size: 13px; text-align: center; }

/* kaarten & tegels */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.grid { display: grid; gap: 12px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile .label { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 26px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--ink-2); }
.two { grid-template-columns: 1.4fr 1fr; }

.sevcount { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.sevcount a { padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; text-decoration: none; }

/* chips */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.crit, .chip.KRITIEK { background: var(--crit-bg); color: var(--crit); }
.warn, .chip.BELANGRIJK { background: var(--warn-bg); color: var(--warn); }
.info, .chip.INFO { background: var(--info-bg); color: var(--info); }
.ok { background: var(--ok-bg); color: var(--ok); }
.chip.muted, .muted-chip { background: var(--muted-bg); color: var(--ink-2); }

/* meldingenlijst */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.alerts li:last-child { border-bottom: 0; }
.alerts .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; }
.alerts .dot.KRITIEK { background: var(--crit); }
.alerts .dot.BELANGRIJK { background: var(--warn); }
.alerts .dot.INFO { background: var(--info); }
.alerts .t { font-weight: 600; }
.alerts .d { color: var(--ink-2); font-size: 13px; }

/* tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); font-weight: 600; }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; }
.prodname { font-weight: 600; }
.ean { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* formulieren */
form.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  padding: 11px 18px; background: var(--accent); color: #fff; display: inline-block; text-align: center;
}
.btn.secondary, button.secondary { background: var(--muted-bg); color: var(--ink); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { flex: 1; min-width: 180px; }
.filters select { width: auto; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.check input { width: auto; }

/* login */
.login { max-width: 380px; margin: 8vh auto; }
.login .logo { font-size: 22px; font-weight: 700; color: var(--brand); margin-bottom: 14px; }
@media (prefers-color-scheme: dark) { .login .logo { color: var(--ink); } }
.qr { background: #fff; padding: 10px; border-radius: 8px; width: 220px; height: 220px; }
code { background: var(--muted-bg); padding: 2px 6px; border-radius: 4px; word-break: break-all; }

/* voorraad: kaarten op mobiel */
.stockcards { display: none; }
.sc { display: block; color: inherit; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sc:hover { text-decoration: none; }
.sc .head { display: flex; justify-content: space-between; gap: 8px; }
.sc .nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.sc .nums div { font-size: 12px; color: var(--ink-2); }
.sc .nums b { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* product */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kv > div { background: var(--bg); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.kv .k { font-size: 12px; color: var(--ink-2); }
.kv .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.bars text { fill: var(--ink-2); font-size: 11px; }
.bars .fbb { fill: var(--fbb); }
.bars .fbr { fill: var(--fbr); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend .fbb { background: var(--fbb); }
.legend .fbr { background: var(--fbr); }

@media (max-width: 760px) {
  .top nav, .top .who { display: none; }
  .top { justify-content: space-between; }
  .bottom { display: flex; }
  .two { grid-template-columns: 1fr; }
  table.stock { display: none; }
  .stockcards { display: block; }
  h1 { font-size: 20px; }
  main { padding: 14px 12px; }
}

/* --- homepage "Je dag" --- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-head h1 { margin-bottom: 2px; }
.dash-head p { margin: 0; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; overflow-x: auto; }
.tabs a { padding: 6px 12px; border-radius: 999px; color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tabs a.on { background: var(--brand); color: #fff; }
.tabs a:hover { text-decoration: none; }
.critbar { display: block; background: var(--crit-bg); color: var(--crit); font-weight: 650; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; }
.hero { grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
.tile.big .value { font-size: 30px; }
.tile.neg .value { color: var(--crit); }
.delta { margin-left: 6px; font-weight: 700; font-size: 12px; padding: 1px 6px; border-radius: 999px; }
.delta.up { background: var(--ok-bg); color: var(--ok); }
.delta.down { background: var(--crit-bg); color: var(--crit); }
.kpis { grid-template-columns: repeat(8, 1fr); gap: 8px; margin-bottom: 6px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; display: flex; flex-direction: column; }
.kpi span { font-size: 11.5px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.kpi b { font-size: 18px; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 11.5px; color: var(--ink-2); }
.kpi.bad b { color: var(--crit); }
.trend .base { stroke: var(--line); }
.trend .rev { fill: var(--fbb); opacity: .35; }
.trend .rev.we { opacity: .22; }
.trend .mar { fill: var(--ok); }
.trend text { fill: var(--ink-2); font-size: 11px; }
.legend .rev { background: var(--fbb); opacity: .5; }
.legend .mar { background: var(--ok); }
.stack { border-radius: 6px; overflow: hidden; display: block; margin-bottom: 10px; }
.b1 { fill: #9aa7b2; background: #9aa7b2; }
.b2 { fill: #c9a24a; background: #c9a24a; }
.b3 { fill: #7c5ba6; background: #7c5ba6; }
.b4 { fill: #0f6e8c; background: #0f6e8c; }
.b5 { fill: #c2341f; background: #c2341f; }
.b6 { fill: #24794a; background: #24794a; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: -1px; }
table.compact td, table.compact th { padding: 6px 6px; }
table.compact tr.tot td { font-weight: 650; border-top: 1px solid var(--line); }
.small-kv { grid-template-columns: repeat(4, 1fr); }
.small-kv .v { font-size: 18px; }
.set-note { background: var(--info-bg); color: var(--info); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 10px 0; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile.big .value { font-size: 22px; }
  .tile.big { padding: 11px 12px; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .kpi { padding: 7px 8px; }
  .kpi span { font-size: 10px; }
  .kpi b { font-size: 15px; }
  .kpi small { font-size: 10px; }
  .small-kv { grid-template-columns: repeat(2, 1fr); }
  .dash-head { align-items: flex-start; }
  .tabs { width: 100%; }
}

/* platform- en producttabellen */
table.pl th { white-space: nowrap; font-size: 11px; }
table.pl td { font-size: 14px; }
table.pl .delta { display: inline-block; margin: 2px 0 0; }
tr.subrow td { font-size: 13px; color: var(--ink-2); padding-top: 3px; padding-bottom: 5px; }
tr.subrow td:first-child { padding-left: 18px; }
tr.offrow td { color: var(--ink-2); }
tr.tot td { font-weight: 700; border-top: 2px solid var(--line); }
tr.negrow { background: var(--crit-bg); }
.negtxt { color: var(--crit); }
.pace .base { stroke: var(--line); }
.pace .typ { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-dasharray: 5 5; }
.pace .tod { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.pace .tod-dot { fill: var(--accent); }
.pace text { fill: var(--ink-2); font-size: 11px; }
.legend .tod { background: var(--accent); }
.legend .typ { background: none; border-top: 2px dashed var(--ink-2); height: 0; width: 14px; }
.pace-sum { margin: 0 0 6px; }
.grid > *, section { min-width: 0; }
table.pl { min-width: 760px; }

/* inkoop & cashflow */
.subtabs { margin-bottom: 14px; width: fit-content; max-width: 100%; }
.crit-text { color: var(--crit); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
input.qty { width: 84px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
form.inline select { width: auto; }
.stack-fields { display: grid; gap: 12px; }
.small-btn { padding: 6px 10px; font-size: 13px; }
button.ok { background: var(--ok-bg); color: var(--ok); }
.steps { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.steps li { padding: 4px 10px; border-radius: 999px; background: var(--muted-bg); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.steps li.done { background: var(--ok-bg); color: var(--ok); }
.steps li.now { background: var(--brand); color: #fff; }
#status-form { margin-bottom: 8px; }
svg.cf .zero { stroke: var(--line); stroke-dasharray: 4 4; }
svg.cf polyline { fill: none; stroke-width: 2.5; }
svg.cf polyline.main { stroke: var(--accent); }
svg.cf polyline.concept { stroke: var(--warn); stroke-dasharray: 6 4; }
svg.cf circle.pos { fill: var(--accent); }
svg.cf circle.neg { fill: var(--crit); }
svg.cf text { font-size: 11px; fill: var(--ink-2); }
.legend i.concept { background: var(--warn); }
table.cashtable { min-width: 640px; }
table.cashtable details { margin-top: 4px; }
tr.muted td { opacity: .6; }
td.num, .num { white-space: nowrap; }
table.modeltable input { padding: 7px 9px; }
table.modeltable td { padding: 6px 6px; vertical-align: middle; }

/* dashboard: gelijke hoogte rij + volle breedte bestsellers */
.eqrow { align-items: stretch; }
section.col { display: flex; flex-direction: column; }
section.col > .card.fill { flex: 1; }
.card.split { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.card.split table.compact td { padding-top: 12px; padding-bottom: 12px; }
table.bests { min-width: 860px; }

/* productfoto's */
.pcell { display: flex; gap: 10px; align-items: center; }
.thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.thumb.sm { width: 28px; height: 28px; border-radius: 4px; }
.thumb.lg { width: 84px; height: 84px; border-radius: 10px; }
.thumb.ph { background: var(--muted-bg); }
.phead { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.phead h1 { margin: 0; }
.sc .head .thumb { margin-right: 8px; }
.sc .head { justify-content: flex-start; align-items: flex-start; gap: 8px; }
.sc .head .prodname { flex: 1; min-width: 0; }
.sc .head .chip { flex: none; align-self: flex-start; }
.sc .head .thumb { margin-right: 0; }

/* TACoS-doelen */
.tacos-goals { margin: 10px 0 4px; }
.tg-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tg-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.tg-top b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tg-bar { display: block; width: 100%; height: 12px; margin: 6px 0 4px; }
.tg-bar .track { fill: var(--muted-bg); }
.tg-bar .ok { fill: var(--ok); }
.tg-bar .warn { fill: var(--warn); }
.tg-bar .bad { fill: var(--crit); }
.tg-bar .goal { fill: var(--ink); }
.tg.off { opacity: .55; }
.oktxt { color: var(--ok); }
.warntxt { color: var(--warn); }
@media (max-width: 760px) { .tg-grid { grid-template-columns: 1fr 1fr; } }

/* kopregel, sparklines, vandaag doen */
.headline { font-size: 17px; line-height: 1.6; margin: 0 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.headline .dot-sep { color: var(--ink-2); margin: 0 4px; }
.headline .oktxt, .oktxt { color: var(--ok); }
.headline .badtxt, .badtxt { color: var(--crit); }
.headline .warntxt { color: var(--warn); }
svg.spark { display: block; width: 100%; height: 28px; margin: 6px 0 2px; }
svg.spark.sm { height: 18px; margin: 4px 0 0; }
svg.spark polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
svg.spark.up polyline { stroke: var(--ok); }
svg.spark.down polyline { stroke: var(--crit); }
svg.spark.neutral polyline { stroke: var(--ink-2); }
.kpi.ok b { color: var(--ok); } .kpi.ok { background: var(--surface); }
.kpi.warn b { color: var(--warn); } .kpi.warn { background: var(--surface); }
.kpi.bad b { color: var(--crit); }
.actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
a.action { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ink-2); border-radius: var(--radius); padding: 11px 13px; color: var(--ink); text-decoration: none; }
a.action:hover { border-color: var(--accent); }
a.action.KRITIEK { border-left-color: var(--crit); }
a.action.BELANGRIJK { border-left-color: var(--warn); }
a.action .sev { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--ink-2); }
a.action.KRITIEK .sev { color: var(--crit); }
a.action.BELANGRIJK .sev { color: var(--warn); }
a.action .go { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--accent); }
a.action.more { border-left-color: var(--line); background: var(--muted-bg); }
@media (max-width: 900px) { .actions-grid { grid-template-columns: 1fr; } .headline { font-size: 15px; } }

a.action .tags { display: flex; gap: 6px; align-items: center; }
a.action .cat { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; background: var(--muted-bg); color: var(--ink-2); }
.cat-voorraad { background: var(--info-bg) !important; color: var(--info) !important; }
.cat-inkoop { background: var(--warn-bg) !important; color: var(--warn) !important; }
.cat-content { background: #efe6f7 !important; color: #6b3fa0 !important; }
.cat-advertenties { background: var(--crit-bg) !important; color: var(--crit) !important; }
.cat-prijs { background: var(--ok-bg) !important; color: var(--ok) !important; }
.card.split { justify-content: flex-start; }
.card.split table.compact { flex: 1; height: 100%; }
