/* ============================================================
   KWCP Marketing Ops — layout + components
   Reads tokens from tokens.css. Shared across all screens.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
:root { --topbar-h: 65px; --secnav-h: 45px; --filterbar-h: 61px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
}
/* desktop collapse — full-screen content. Toggled by .collapse-btn; persists
   via localStorage in app.js. On mobile the off-canvas drawer takes over. */
.app.is-collapsed { grid-template-columns: 0 1fr; }
.app.is-collapsed .sidebar { transform: translateX(-100%); }
.collapse-btn {
  display: inline-flex; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); align-items: center; justify-content: center; cursor: pointer;
}
.collapse-btn svg { width: 19px; height: 19px; stroke: var(--fg); fill: none; stroke-width: 1.8; }
@media (max-width: 760px) { .collapse-btn { display: none; } }

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--nav-bg);
  color: var(--nav-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--nav-border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--nav-border);
}
.brand__mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex: none;
}
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; line-height: 1.15; }
.brand__sub { color: var(--nav-muted); font-size: 11px; letter-spacing: 0.04em; }
.nav { padding: 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav__label { color: var(--nav-muted); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: var(--nav-muted);
  font-weight: 500;
  position: relative;
  transition: background .14s, color .14s;
}
.nav__item:hover { background: var(--nav-bg-2); color: var(--nav-fg); }
.nav__item.is-active { background: var(--nav-bg-2); color: var(--nav-fg); }
.nav__item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--champagne);
}
.nav__ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav__txt { white-space: nowrap; }
.nav__foot { padding: 14px; border-top: 1px solid var(--nav-border); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--champagne), var(--champagne-ink));
  color: var(--on-champagne); display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.nav__who { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.nav__role { color: var(--nav-muted); font-size: 11px; }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in oklch, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 26px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar__l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); align-items: center; justify-content: center; }
.menu-btn svg { width: 20px; height: 20px; stroke: var(--fg); fill: none; stroke-width: 1.8; }
.page-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.ccard__date { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.topbar__r { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* search + buttons */
.search { position: relative; }
.search input {
  width: 220px; max-width: 40vw;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--fg); font-size: 13px;
}
.search input:focus { outline: 2px solid color-mix(in oklch, var(--brand) 40%, transparent); outline-offset: 0; border-color: transparent; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 1.8; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background .14s, border-color .14s;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; }
.btn--brand { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn--brand:hover { background: var(--brand-ink); }

/* ---------- filter bar ---------- */
.filterbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 26px; border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: var(--topbar-h); z-index: 25;
}
.filterbar__lead { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin-right: 2px; }
/* mobile "Filters" toggle button — hidden on desktop */
.filterbar__toggle { display: none; }
.fld { position: relative; display: inline-flex; }
.fld select {
  appearance: none; -webkit-appearance: none;
  padding: 8px 30px 8px 12px; border: 1px solid var(--border); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--fg); font-size: 12.5px; font-weight: 600;
}
.fld::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px;
  transform: translateY(-65%) rotate(45deg); border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  pointer-events: none;
}
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: all .14s;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip[aria-pressed="true"] { color: var(--fg); border-color: var(--border-strong); background: var(--surface-2); }
.chip[data-channel="social"][aria-pressed="true"] { color: var(--ch-social); border-color: color-mix(in oklch, var(--ch-social) 45%, var(--border)); background: color-mix(in oklch, var(--ch-social) 9%, white); }
.chip[data-channel="email"][aria-pressed="true"]  { color: var(--ch-email);  border-color: color-mix(in oklch, var(--ch-email) 45%, var(--border));  background: color-mix(in oklch, var(--ch-email) 9%, white); }
.chip[data-channel="text"][aria-pressed="true"]   { color: var(--ch-text);   border-color: color-mix(in oklch, var(--ch-text) 45%, var(--border));   background: color-mix(in oklch, var(--ch-text) 11%, white); }
.chip[data-status][aria-pressed="true"] { color: var(--fg); }
/* platform sub-chips (injected under Social) */
.chips--pf { padding-left: 10px; margin-left: 4px; border-left: 1px solid var(--border); }
.chip--pf { font-size: 12px; padding: 6px 11px; }
.chip--pf[aria-pressed="true"] { color: var(--pf); border-color: color-mix(in oklch, var(--pf) 48%, var(--border)); background: color-mix(in oklch, var(--pf) 10%, white); }
.filterbar__div { width: 1px; align-self: stretch; background: var(--border); margin: 0 2px; }
.filter-reset { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; background: none; border: none; padding: 7px 4px; }
.filter-reset:hover { color: var(--brand); }

/* ---------- section jump nav (dashboard) ---------- */
.section-nav {
  position: sticky; top: calc(var(--topbar-h) + var(--filterbar-h)); z-index: 24;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 7px 26px; min-height: var(--secnav-h);
  background: color-mix(in oklch, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.3) blur(10px);
  -webkit-backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--border);
}
.section-nav__lead { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin-right: 4px; }
.section-nav__link {
  padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: background .14s, color .14s; white-space: nowrap;
}
.section-nav__link:hover { color: var(--fg); background: var(--surface-2); }
.section-nav__link.is-active { color: var(--brand); background: color-mix(in oklch, var(--brand) 10%, white); }
/* land jumped-to sections below the three stacked sticky bars */
[data-jump] { scroll-margin-top: calc(var(--topbar-h) + var(--filterbar-h) + var(--secnav-h) + 16px); }

/* ---------- content grid ---------- */
.content { padding: 22px 26px 80px; display: flex; flex-direction: column; gap: 22px; }
.grid { display: grid; gap: var(--gap); }
.section__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 13px; }
.section__title { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.section__meta { color: var(--faint); font-size: 12px; }
.section__link { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.section__link:hover { color: var(--brand); }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card--pad { padding: var(--pad); }

/* ---------- KPI ---------- */
.kpi-grid { grid-template-columns: repeat(5, 1fr); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 15px 16px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.kpi__top { display: flex; align-items: center; gap: 8px; }
.kpi__label { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi__ico { width: 15px; height: 15px; stroke: var(--faint); fill: none; stroke-width: 1.8; flex: none; }
.kpi--hl { background: linear-gradient(170deg, color-mix(in oklch, var(--brand) 8%, white), var(--surface)); border-color: color-mix(in oklch, var(--brand) 22%, var(--border)); }
.kpi--hl .kpi__ico { stroke: var(--brand); }
.kpi__value { font-family: var(--font-display); font-size: 26px; font-weight: 750; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta--up { color: var(--pos); }
.delta--down { color: var(--neg); }
.delta svg { width: 12px; height: 12px; }
.spark { width: 64px; height: 22px; flex: none; overflow: visible; }

/* ---------- kanban / pipeline ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); display: flex; flex-direction: column; min-height: 120px; }
.col__head { display: flex; align-items: center; gap: 9px; padding: 13px 14px 11px; position: sticky; top: 0; }
.col__dot { width: 9px; height: 9px; border-radius: 50%; }
.col__title { font-weight: 700; font-size: 13px; }
.col__count { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 2px 8px; }
.col__body { padding: 0 11px 12px; display: flex; flex-direction: column; gap: 9px; }
.ccard { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border-strong)); border-radius: var(--r-sm); padding: 12px 13px; box-shadow: var(--sh-1); transition: box-shadow .14s, transform .14s; }
.ccard:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.ccard__top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.ccard__name { font-weight: 650; font-size: 13px; letter-spacing: -0.01em; line-height: 1.25; }
.ccard__meta { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 11.5px; margin-top: 9px; }
.ccard__stats { display: flex; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.cstat { display: flex; flex-direction: column; gap: 1px; }
.cstat b { font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.cstat span { color: var(--faint); font-size: 10.5px; letter-spacing: .02em; }
.cprog { margin-top: 9px; }

/* pills / badges */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; letter-spacing: .01em; }
.pill .pdot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--channel[data-channel="social"] { color: var(--ch-social); background: color-mix(in oklch, var(--ch-social) 12%, white); }
.pill--channel[data-channel="email"]  { color: var(--ch-email);  background: color-mix(in oklch, var(--ch-email) 13%, white); }
.pill--channel[data-channel="text"]   { color: var(--ch-text);   background: color-mix(in oklch, var(--ch-text) 14%, white); }
.pill--status[data-status="scheduled"]  { color: var(--st-scheduled); background: color-mix(in oklch, var(--st-scheduled) 12%, white); }
.pill--status[data-status="in_process"] { color: oklch(48% 0.14 60); background: color-mix(in oklch, var(--st-process) 18%, white); }
.pill--status[data-status="executed"]   { color: var(--st-executed); background: color-mix(in oklch, var(--st-executed) 13%, white); }
.tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: var(--r-pill); }
/* platform pill (social campaigns) + production-status pill */
.pill--pf { color: var(--pf, var(--ch-social)); background: color-mix(in oklch, var(--pf, var(--ch-social)) 13%, white); }
.pill--prod { color: var(--ps, var(--muted)); background: color-mix(in oklch, var(--ps, var(--muted)) 15%, white); }
/* segment tag tinted by its segment color */
.tag--seg { color: var(--sc, var(--muted)); background: color-mix(in oklch, var(--sc, var(--muted)) 12%, white); border-color: color-mix(in oklch, var(--sc, var(--muted)) 24%, var(--border)); }
/* grouped-section subheader (segment groups, etc.) */
.subhead { display: flex; align-items: center; gap: 9px; margin: 4px 0 12px; }
.subhead__t { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.subhead__rule { flex: 1; height: 1px; background: var(--border); }
.subhead__n { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--muted); }
/* compact stat strip (production / platform summary cards) */
.statstrip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ministat { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border-strong)); border-radius: var(--r-md); padding: 13px 14px; box-shadow: var(--sh-1); }
.ministat__top { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; color: var(--fg); margin-bottom: 8px; }
.ministat__top .legend__dot { width: 9px; height: 9px; }
.ministat__big { font-family: var(--font-display); font-size: 22px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.ministat__sub { color: var(--faint); font-size: 11px; margin-top: 4px; }

/* progress */
.progress { height: 6px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--brand)); }
.progress__lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }

/* ---------- breakdown (donut + bars) ---------- */
.split-2 { grid-template-columns: 1.15fr 1fr; }
.split-3 { grid-template-columns: 1fr 1fr 1fr; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 132px; height: 132px; border-radius: 50%; flex: none; position: relative; }
.donut::after { content: ""; position: absolute; inset: 24px; background: var(--surface); border-radius: 50%; box-shadow: inset 0 0 0 1px var(--border); }
.donut__c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 1; }
.donut__c b { font-family: var(--font-display); font-size: 22px; font-weight: 750; }
.donut__c span { color: var(--faint); font-size: 11px; }
.legend { display: flex; flex-direction: column; gap: 11px; flex: 1; min-width: 0; }
.legend__row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend__name { font-weight: 600; }
.legend__val { margin-left: auto; font-family: var(--font-mono); font-weight: 700; }
.legend__pct { color: var(--faint); font-size: 11.5px; width: 42px; text-align: right; font-family: var(--font-mono); }

.bars { display: flex; flex-direction: column; gap: 14px; }
.barrow__top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.barrow__top b { margin-left: auto; font-family: var(--font-mono); }
.bartrack { height: 9px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.bartrack > i { display: block; height: 100%; border-radius: inherit; }

/* ---------- lists / rows ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 13px; padding: 13px 4px; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.row__main { min-width: 0; flex: 1; }
.row__name { font-weight: 650; font-size: 13.5px; letter-spacing: -0.01em; }
.row__sub { color: var(--faint); font-size: 11.5px; margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row__right { text-align: right; flex: none; }
.owner { display: inline-flex; align-items: center; gap: 7px; }
.owner .av { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; flex: none; }

/* ---------- table ---------- */
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--faint); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- segments ---------- */
.seg { display: flex; flex-direction: column; gap: 9px; padding: 14px 0; border-top: 1px solid var(--border); }
.seg:first-child { border-top: 0; }
.seg__top { display: flex; align-items: center; gap: 10px; }
.seg__name { font-weight: 650; }
.seg__size { margin-left: auto; font-family: var(--font-mono); font-weight: 700; }

/* ---------- timeline (mini) ---------- */
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.tl:first-child { border-top: 0; }
.tl__when { width: 58px; flex: none; text-align: right; }
.tl__when b { display: block; font-family: var(--font-display); font-size: 15px; font-weight: 750; line-height: 1; }
.tl__when span { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.tl__line { width: 2px; background: var(--border); position: relative; flex: none; border-radius: 2px; }
.tl__line::before { content: ""; position: absolute; top: 3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--brand)); box-shadow: 0 0 0 3px var(--surface); }
.tl__body { flex: 1; min-width: 0; padding-bottom: 2px; }
.tl__title { font-weight: 600; font-size: 13px; }
.tl__sub { color: var(--faint); font-size: 11.5px; margin-top: 2px; }

/* ---------- empty / stub ---------- */
.empty { display: grid; place-items: center; text-align: center; padding: 70px 20px; color: var(--muted); gap: 12px; }
.empty svg { width: 40px; height: 40px; stroke: var(--faint); fill: none; stroke-width: 1.5; }
.empty h3 { font-family: var(--font-display); color: var(--fg); font-size: 16px; }

/* ---------- mobile bottom nav ---------- */
.botnav { display: none; }
.scrim { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1080px) {
  /* icon rail */
  .app { grid-template-columns: 72px 1fr; }
  .brand__name, .brand__sub, .nav__txt, .nav__label, .nav__who, .nav__role { display: none; }
  .brand { justify-content: center; padding: 18px 0; }
  .nav { align-items: center; }
  .nav__item { justify-content: center; padding: 11px; }
  .nav__item.is-active::before { left: -12px; }
  .nav__foot { justify-content: center; }
  .split-2 { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .split-3 { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 256px; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--sh-pop); }
  .sidebar .brand__name, .sidebar .brand__sub, .sidebar .nav__txt, .sidebar .nav__label,
  .sidebar .nav__who, .sidebar .nav__role { display: block; }
  .sidebar .brand { justify-content: flex-start; padding: 20px 18px 18px; }
  .sidebar .nav { align-items: stretch; }
  .sidebar .nav__item { justify-content: flex-start; padding: 9px 11px; }
  .sidebar .nav__foot { justify-content: flex-start; }
  .menu-btn { display: inline-flex; }
  .scrim.is-open { display: block; position: fixed; inset: 0; z-index: 55; background: oklch(20% 0.02 265 / 0.4); }
  :root { --topbar-h: 58px; --secnav-h: 42px; --filterbar-h: 56px; }
  .topbar { padding: 12px 16px; top: 0; }
  .section-nav { padding: 6px 16px; gap: 3px; top: calc(var(--topbar-h) + var(--filterbar-h)); overflow-x: auto; flex-wrap: nowrap; }
  .section-nav__lead { display: none; }
  /* filterbar becomes a collapsible dropdown panel — no more horizontal overflow */
  .filterbar {
    padding: 10px 16px; top: var(--topbar-h);
    flex-wrap: wrap; overflow: visible; row-gap: 10px;
  }
  .filterbar__lead { display: none; }
  .filterbar__toggle {
    display: inline-flex; align-items: center; gap: 8px; width: 100%;
    padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--r-pill);
    background: var(--surface-2); color: var(--fg); font-size: 13px; font-weight: 650; cursor: pointer;
  }
  .filterbar__toggle svg { width: 16px; height: 16px; stroke: var(--fg); fill: none; stroke-width: 1.8; }
  .filterbar__toggle .chev { margin-left: auto; transition: transform .18s; }
  .filterbar.is-open .filterbar__toggle .chev { transform: rotate(180deg); }
  /* hide the controls until expanded; when open, stack them full-width */
  .filterbar > :not(.filterbar__toggle) { display: none; }
  .filterbar.is-open > :not(.filterbar__toggle) { display: flex; width: 100%; }
  .filterbar.is-open .fld, .filterbar.is-open .fld select { width: 100%; }
  .filterbar.is-open .chips { flex-wrap: wrap; }
  .filterbar.is-open .filter-reset { margin-left: 0; }
  .content { padding: 16px 16px 96px; gap: 18px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi__value { font-size: 22px; }
  .search input { width: 150px; }

  /* bottom tab nav */
  .botnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in oklch, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .botnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: var(--muted); font-size: 10px; font-weight: 600; border-radius: var(--r-sm); }
  .botnav a svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; }
  .botnav a.is-active { color: var(--brand); }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
}
