/* VendInsights. Chrome: deep teal + amber. Data colours: the validated dataviz reference palette (light + dark). */
/* VendInsights brand: Vend Navy, Insights Blue, Electric Blue, Growth Orange; Montserrat headings, Inter UI.
   Chart series use validated steps of the brand hues (colour-blind safe on white): --s1 #0055D4, --s2 #DB7400, --s3 #0094D9. */
:root {
  --primary: #0055D4; --navy: #071B41; --electric-blue: #00A8F3; --orange: #FF9800;
  --background: #F4F7FB; --hover: #EFF6FF; --text-primary: #1E293B; --text-secondary: #64748B;
  --success: #16A34A; --warning: #D97706; --danger: #DC2626; --info: #0055D4;
  --font-heading: 'Montserrat', 'Inter', system-ui, sans-serif; --font-body: 'Inter', system-ui, sans-serif;

  /* app tokens mapped onto the brand */
  --bg: #F4F7FB; --surface: #FFFFFF; --surface-2: #F1F5F9; --border: #E2E8F0;
  --text: #1E293B; --text-2: #475569; --muted: #64748B;
  --brand: #0055D4; --brand-2: #0055D4; --accent: #FF9800; --accent-soft: #FFF4E5;
  --on-brand: #FFFFFF; --link: #0055D4; --grid: #E2E8F0; --axis: #CBD5E1;
  --s1: #0055D4; --s2: #DB7400; --s3: #0094D9; --s-muted: #94A3B8;
  --good: #16A34A; --good-text: #15803D; --critical: #DC2626; --bad-text: #B91C1C; --serious: #EA580C;
  --good-soft: #DCFCE7; --warning-soft: #FEF3C7; --serious-soft: #FFEDD5; --critical-soft: #FEE2E2; --info-soft: #EFF6FF;
  --h0: #EEF2F7; --h1: #DBE8FB; --h2: #BCD4F6; --h3: #94BAF0; --h4: #6A9DE7; --h5: #3B7FDD; --h6: #0055D4; --h7: #0043A8; --h8: #07306F;
  --shadow: 0 1px 2px rgba(7,27,65,.05), 0 4px 14px rgba(7,27,65,.05);
  --sidebar-w: 252px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; color: var(--navy); }
h1 { font: 700 28px/1.2 var(--font-heading); }
h2 { font: 600 20px/1.3 var(--font-heading); }
.card h2, .card-head h2 { font: 600 16px/1.35 var(--font-body); color: var(--text); }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.num, td.r, .r { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.chg { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chg.up { color: var(--good-text); } .chg.down { color: var(--bad-text); } .chg.flat { color: var(--muted); }
.neg { color: var(--bad-text); }

/* App shell: navy sidebar + white top bar */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--navy); color: #C7D2E5; display: flex; flex-direction: column; z-index: 50; transition: transform .2s; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 20px 8px; color: #fff; font: 700 18px var(--font-heading); letter-spacing: -0.01em; }
.sb-brand:hover { text-decoration: none; }
.sb-brand img { width: 36px; height: 36px; border-radius: 9px; }
.sb-brand b { color: #4FA8FF; font-weight: 700; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; scrollbar-color: #1C3466 transparent; }
.sb-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: #7D8DAB; padding: 12px 10px 4px; }
.sb-nav a { display: flex; align-items: center; gap: 11px; padding: 6px 10px; border-radius: 8px; color: #C7D2E5; font-size: 14px; font-weight: 500; margin-bottom: 1px; }
.sb-nav a svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sb-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sb-nav a.on { background: var(--primary); color: #fff; }
.sb-nav a.on svg { opacity: 1; }
.sb-nav a .badge { margin-left: auto; background: var(--orange); color: #1A1205; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; }
.sb-nav a .ai { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--electric-blue); border: 1px solid rgba(0,168,243,.5); border-radius: 999px; padding: 0 6px; }
.sb-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; }
.sb-foot .who { color: #fff; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot .role { color: #7D8DAB; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 28px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .crumbs { flex: 1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs strong { color: var(--text); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; flex: none; font-size: 13px; }
.userbox form { margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--hover); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.demo-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: #B45309; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--text); }
.menu-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.sb-scrim { display: none; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; color: var(--text); }
.brand:hover { text-decoration: none; }
@media (max-width: 1080px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(7,27,65,.45); z-index: 45; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
}

.flash-wrap { max-width: 1360px; width: 100%; margin: 16px auto 0; padding: 0 28px; }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; }
.flash-error { border-color: var(--critical); color: var(--bad-text); }
.flash-success { border-color: var(--good); }

.container { max-width: 1360px; width: 100%; margin: 0 auto; padding: 24px 28px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head p { margin: 5px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head p { margin: 2px 0 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mt { margin-top: 14px; }
.eyebrow { color: #C2410C; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .09em; margin: 0 0 8px; }

/* Filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg a, .seg button { font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 5px 10px; border-radius: 7px; border: 0; background: none; cursor: pointer; white-space: nowrap; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.filters select, .filters input[type=date] { font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; max-width: 220px; }
.filters .custom { display: none; gap: 6px; align-items: center; }
.filters .custom.show { display: inline-flex; }
.filters .spacer { flex: 1; }
.filters .range { font-size: 12.5px; color: var(--muted); }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--primary); background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: #0047B3; border-color: #0047B3; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-ghost-danger { color: var(--danger); }
.btn-ghost-danger:hover { border-color: var(--danger); background: var(--critical-soft); }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #1A1205; }
.btn-accent:hover { background: #F08C00; border-color: #F08C00; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .6; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.linkbtn:hover { color: var(--bad-text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.field input:not([type=checkbox]), .field select, .field textarea, .input { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,85,212,.15); }
.field.check label { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13.5px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 3px; }
ul.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--bad-text); font-size: 12.5px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th.r { text-align: right; }
table.data td.r { white-space: nowrap; }
table.data td { padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--hover); }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
.strong { font-weight: 700; color: var(--text); }
.sub { display: block; font-size: 12px; color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbar { position: relative; min-width: 90px; }
.inbar i { position: absolute; left: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--s1); opacity: .22; }
.inbar span { position: relative; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.kpis-4, .kpis.kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .value { white-space: nowrap; font-size: 26px; color: var(--navy); font-weight: 750; letter-spacing: -0.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi .vs { font-size: 11.5px; color: var(--muted); }
.kpi.hero .value { font-size: 32px; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill.critical { background: var(--critical-soft); color: var(--bad-text); }
.pill.warning { background: var(--warning-soft); color: var(--text); }
.pill.opportunity { background: var(--good-soft); color: var(--good-text); }
.pill.info { background: var(--info-soft); color: var(--link); }
.pill.A { background: var(--info-soft); color: var(--link); } .pill.B { background: var(--surface-2); } .pill.C { background: var(--surface-2); color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.critical { background: var(--critical); } .dot.warning { background: var(--warning); } .dot.opportunity { background: var(--good); } .dot.info { background: var(--s1); }
.status { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* Insights */
.insight { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.insight:last-child { border-bottom: 0; }
.insight .ico { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.insight .ico.critical { background: var(--critical-soft); color: var(--bad-text); }
.insight .ico.warning { background: var(--warning-soft); color: var(--text); }
.insight .ico.opportunity { background: var(--good-soft); color: var(--good-text); }
.insight .ico.info { background: var(--info-soft); color: var(--link); }
.insight h3 { font-size: 14px; }
.insight p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.insight .impact { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.insight .impact strong { display: block; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.insight .meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

/* Charts */
.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 340px; }
.chart-box.small { height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; height: 2px; }
.legend i.box { height: 10px; width: 10px; border-radius: 3px; }

/* Heatmap */
.heat { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 11px; }
.heat .day { color: var(--muted); align-self: center; font-weight: 600; }
.heat .c { aspect-ratio: 1.25; border-radius: 3px; background: var(--h0); position: relative; }
.heat .c:hover { outline: 2px solid var(--text); outline-offset: 0; z-index: 2; }
.heat .hr { color: var(--muted); text-align: center; font-size: 10px; }
.heat .l1 { background: var(--h1); } .heat .l2 { background: var(--h2); } .heat .l3 { background: var(--h3); } .heat .l4 { background: var(--h4); }
.heat .l5 { background: var(--h5); } .heat .l6 { background: var(--h6); } .heat .l7 { background: var(--h7); } .heat .l8 { background: var(--h8); }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.heat-scale i { width: 16px; height: 10px; border-radius: 2px; display: inline-block; }

/* Bars (HTML) */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 3px; }
.hbar .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .track b { display: block; height: 100%; border-radius: 4px; background: var(--s1); }
.stock { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.stock b { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.stock.low b { background: var(--warning); } .stock.out b { background: var(--critical); }

/* Planogram */
.planogram { display: flex; flex-direction: column; gap: 8px; }
.prow { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.cell { border: 1px solid var(--border); border-radius: 10px; padding: 8px 9px; background: var(--surface); font-size: 12px; position: relative; }
.cell .code { font-weight: 800; font-size: 11.5px; color: var(--muted); }
.cell .pname { font-weight: 600; font-size: 12.5px; line-height: 1.25; margin: 2px 0 6px; min-height: 31px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cell .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.cell.out { border-color: var(--critical); background: var(--critical-soft); }
.cell.low { border-color: var(--warning); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.stats div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.stats div span:first-child { color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.list li:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.note { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 12px; }
.callout { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 13px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 13.5px; }
.tabs a.on { background: var(--primary); color: #fff; }
.tabs a:hover { text-decoration: none; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 12px; font-size: 13px; }

/* P&L */
table.pl td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
table.pl tr.sub td { font-weight: 700; background: var(--surface-2); }
table.pl tr.total td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--text); border-bottom: 0; }
table.pl tr.rev td { font-weight: 700; }

/* AI */
.prose { font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3 { color: var(--navy); margin: 18px 0 8px; font: 600 16px var(--font-heading); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; } .prose ul, .prose ol { margin: 0 0 10px; padding-left: 22px; } .prose li { margin-bottom: 4px; }
.prose table { border-collapse: collapse; width: 100%; margin: 8px 0 14px; font-size: 13px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.busy { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: var(--bad-text); }

/* Landing */
.landing { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: center; max-width: 1140px; margin: 0 auto; padding: 46px 18px; }
.landing h1 { font-size: clamp(30px, 4.2vw, 44px); letter-spacing: -0.03em; }
.landing h1 em { font-style: normal; color: var(--brand-2); }
.landing .lede { font-size: 16.5px; color: var(--text-2); margin: 14px 0 20px; }
.features { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 14px; }
.features li { display: flex; gap: 8px; }
.features li::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); margin-top: 7px; flex: none; }
.auth-card { padding: 26px; }
.auth-card form p { margin: 0 0 12px; }
.auth-card label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.auth-card input[type=text], .auth-card input[type=password], .auth-card input[type=email] { width: 100%; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; }
.auth-card .helptext, .auth-card ul:not(.errorlist) { font-size: 12px; color: var(--muted); }
.or { text-align: center; color: var(--muted); font-size: 12.5px; margin: 14px 0; }
.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 0 30px; }

@media print {
  .topbar, .filters, .no-print, .flash-wrap { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; break-inside: avoid; }
}
@media (max-width: 1000px) { .g-main, .g3, .landing { grid-template-columns: minmax(0, 1fr); } .features { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .g2, .form-grid, .stats { grid-template-columns: minmax(0, 1fr); }
  .userbox .who, .topbar .crumbs { display: none; }
  .container { padding: 18px 14px 50px; }
  .card { padding: 13px; }
  .heat { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 1px; }
  .heat .hr:nth-child(odd) { visibility: hidden; }
}

/* CRUD lists and forms */
.container.narrow { max-width: 860px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1 1 240px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: var(--muted); stroke-width: 2; }
.toolbar input[type=search] { width: 100%; padding: 8px 10px 8px 32px; }
.toolbar input, .toolbar select { font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,85,212,.15); }
.toolbar select { max-width: 220px; }
.toolbar .dt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.table-card { padding: 0; overflow: hidden; }
.table-card .table-wrap { margin: 0; }
.table-card table.data th { background: #F8FAFC; padding: 10px 12px; }
.table-card table.data td { padding: 10px 12px; }
.table-card table.data th:first-child, .table-card table.data td:first-child { padding-left: 18px; }
th a.sort { color: inherit; } th a.sort:hover { color: var(--primary); text-decoration: none; } th a.sort span { color: var(--primary); }
.bulk-bar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--hover); border-bottom: 1px solid var(--border); font-size: 13.5px; }
.bulk-bar[hidden] { display: none; }
.actions-cell { white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: var(--muted); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--hover); color: var(--primary); text-decoration: none; }
.icon-btn.danger:hover { background: var(--critical-soft); color: var(--danger); }
.table-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border); }
.table-foot .per a { margin-left: 6px; color: var(--muted); padding: 2px 7px; border-radius: 6px; }
.table-foot .per a.on { background: var(--hover); color: var(--primary); font-weight: 600; }
.table-foot .pages { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.form-card { padding: 24px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.req { color: var(--danger); }
.warn-box { background: var(--warning-soft); border: 1px solid #FCD34D; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; }
.warn-box ul { margin: 6px 0; padding-left: 20px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* Import & export */
.step-card { position: relative; padding: 22px 24px; }
.step-card h2 { font: 600 18px var(--font-heading); color: var(--navy); margin: 4px 0 8px; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 700; font-size: 13px; }
.dl-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 16px; }
.btn .ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
table.data.mini { font-size: 12.5px; }
table.data.mini td, table.data.mini th { padding: 6px 8px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; border: 2px dashed var(--border); border-radius: 12px; text-align: center; cursor: pointer; background: #F8FAFC; position: relative; margin-top: 12px; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--hover); }
.dropzone svg { width: 28px; height: 28px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.grid.export-grid { align-items: end; }
.form-section { font: 600 13px var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
[hidden] { display: none !important; }

/* Tax */
.meter { position: relative; height: 12px; background: var(--surface-2); border-radius: 6px; margin: 6px 0 4px; }
.meter b { display: block; height: 100%; border-radius: 6px; background: var(--primary); }
.meter b.over { background: var(--orange); }
.meter i { position: absolute; top: -5px; width: 3px; height: 22px; margin-left: -1px; background: var(--navy); border-radius: 2px; }
.meter-label { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.meter-label strong { color: var(--text); }
.meter-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
table.vat201 td.box { font-weight: 700; color: var(--primary); }
table.vat201 tr.tot td { font-weight: 700; background: #FFF7EB; }
table.pl tr.hdr td { font: 600 12px var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--primary); padding-top: 16px; border-bottom: 1px solid var(--border); }
table.pl td .sub { max-width: none; }

/* Help & tutorials */
.help-hero { padding: 30px; background: linear-gradient(135deg, #071B41, #0B2D66); border: 0; color: #fff; }
.help-hero h1 { color: #fff; }
.help-hero p { color: #C7D2E5; margin: 6px 0 18px; }
.help-search { position: relative; max-width: 640px; }
.help-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; fill: none; stroke: var(--muted); stroke-width: 2; }
.help-search input { width: 100%; font: inherit; font-size: 15px; padding: 13px 14px 13px 42px; border-radius: 10px; border: 0; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.help-cat { font: 600 16px var(--font-heading); color: var(--navy); margin-bottom: 8px; }
.help-list { list-style: none; margin: 0; padding: 0; }
.help-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.help-list li:last-child { border-bottom: 0; }
.help-list a { font-weight: 600; }
.help-list span { display: block; font-size: 12.5px; color: var(--muted); }
.help-results { list-style: none; padding: 0; margin: 0; }
.help-results li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.help-results p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 18px; align-items: start; }
.help-nav { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; padding: 14px; }
.help-nav a { display: block; padding: 5px 8px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.help-nav a.on, .help-nav a:hover { background: var(--hover); color: var(--primary); text-decoration: none; }
.help-nav-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 8px 4px; }
.help-toc { position: sticky; top: 76px; font-size: 12.5px; }
.help-toc a { display: block; padding: 4px 0 4px 10px; border-left: 2px solid var(--border); color: var(--text-2); }
.help-toc a.lvl3 { padding-left: 22px; font-size: 12px; }
.help-toc a:hover { border-left-color: var(--primary); color: var(--primary); text-decoration: none; }
.help-article { padding: 30px 38px; }
.prose.doc { font-size: 15px; line-height: 1.7; }
.prose.doc h1 { font: 700 28px/1.2 var(--font-heading); color: var(--navy); margin: 4px 0 14px; }
.prose.doc h2 { font: 600 21px var(--font-heading); color: var(--navy); margin: 30px 0 10px; padding-top: 8px; border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.prose.doc h3 { font: 600 16px var(--font-body); color: var(--text); margin: 20px 0 8px; scroll-margin-top: 80px; }
.prose.doc table { display: table; font-size: 13.5px; }
.prose.doc th { background: #F8FAFC; }
.prose.doc blockquote { margin: 14px 0; padding: 12px 16px; background: var(--hover); border-left: 4px solid var(--primary); border-radius: 0 8px 8px 0; }
.prose.doc blockquote p:last-child { margin: 0; }
.prose.doc code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.prose.doc ol li, .prose.doc ul li { margin-bottom: 6px; }
.help-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--border); }
.help-pager a { display: block; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; max-width: 48%; }
.help-pager a span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.help-pager a.nx { text-align: right; margin-left: auto; }
.help-pager a:hover { border-color: var(--primary); text-decoration: none; }
@media (max-width: 1200px) { .help-layout { grid-template-columns: 230px minmax(0, 1fr); } .help-toc { display: none; } }
@media (max-width: 860px) { .help-layout { grid-template-columns: minmax(0, 1fr); } .help-nav { position: static; max-height: 260px; } .help-article { padding: 20px; } }
/* Subtotal rows use class "sub" too; keep them as normal table rows (not the caption style). */
tr.sub { display: table-row !important; max-width: none !important; font-size: inherit !important; color: inherit !important;
         white-space: normal !important; overflow: visible !important; }
.prose.doc td:first-child, .prose.doc th:first-child { white-space: nowrap; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--good-text); background: var(--good-soft); padding: 3px 10px; border-radius: 999px; white-space: nowrap; align-self: center; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.flash-info { border-color: var(--primary); background: var(--hover); }
.flash-warning { border-color: var(--warning); background: var(--warning-soft); }
