/* CRM Insights — brand-themed (YogurBara, HAAB, neutral default).
   One bold thing per brand: the header band in the brand colour with its logo
   (YogurBara: Bara Blue + mascot; HAAB: HAAB Red + the takeaway-box diamond
   pattern). Everything under it stays quiet so a data-dense dashboard reads
   easily. The brand's accent appears only in the restaurant tag and the
   "What the data says" panel. Features are identical for every brand. */

/* ──────────────────────────────────────────────────────────────── tokens ── */
/* One block per brand x mode, generated from a single table (keep them in step).
   <html data-brand="…"> is set by app.js from the restaurant on the login. */
:root {
  color-scheme: light;
  --brand: var(--accent);
  --brand-strong: var(--accent-deep);
  --brand-ink: var(--accent-ink);
  --radius-lg: 22px;   /* outer panels */
  --radius: 14px;      /* tiles, inner panels */
  --radius-sm: 9px;    /* inputs */
  --sans: "DM Sans", "IBM Plex Sans Thai", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
:root {
  --accent: #2f5bd3;
  --accent-deep: #2448ad;
  --accent-ink: #ffffff;
  --band: #24354a;
  --band-ink: #ffffff;
  --band-pattern: none;
  --sticker: #ffffff;
  --sticker-ink: #24354a;
  --highlight-soft: #eef3fb;
  --highlight-border: #d3dff2;
  --bg: #f5f7fa;
  --surface-1: #ffffff;
  --surface-2: #eef2f7;
  --border: #dfe5ee;
  --border-strong: #c8d2e0;
  --text-primary: #17202b;
  --text-secondary: #4b5a6c;
  --text-muted: #7b8798;
  --brand-soft: #e6ecfa;
  --series-1: #2f5bd3;
  --series-2: #aebfe9;
  --good: #127a4a;
  --warn: #a8620a;
  --bad: #c0392b;
  --display: "DM Sans", "IBM Plex Sans Thai", system-ui, sans-serif;
  --grid: rgba(15, 23, 35, 0.07);
  --axis: rgba(15, 23, 35, 0.5);
  --shadow: 0 1px 0 rgba(15, 23, 35, .04), 0 10px 30px -18px color-mix(in srgb, var(--accent) 45%, transparent);
}
:root[data-brand="yogurbara"] {
  --accent: #2c86e6;
  --accent-deep: #1d6cc2;
  --accent-ink: #ffffff;
  --band: #2c86e6;
  --band-ink: #ffffff;
  --band-pattern: none;
  --sticker: #f6df72;
  --sticker-ink: #2b2510;
  --highlight-soft: #fff7d1;
  --highlight-border: #f3e3a0;
  --bg: #f4f8fe;
  --surface-1: #ffffff;
  --surface-2: #eef4fc;
  --border: #dde8f6;
  --border-strong: #c4d7ee;
  --text-primary: #0f2742;
  --text-secondary: #4a6280;
  --text-muted: #7d93ad;
  --brand-soft: #e3effd;
  --series-1: #2c86e6;
  --series-2: #a9cdf6;
  --good: #127a4a;
  --warn: #a8620a;
  --bad: #e0554a;
  --display: "Fraunces", "IBM Plex Sans Thai", Georgia, serif;
  --grid: rgba(15, 23, 35, 0.07);
  --axis: rgba(15, 23, 35, 0.5);
  --shadow: 0 1px 0 rgba(15, 23, 35, .04), 0 10px 30px -18px color-mix(in srgb, var(--accent) 45%, transparent);
}
:root[data-brand="haab"] {
  --accent: #ca232b;
  --accent-deep: #a11b22;
  --accent-ink: #ffffff;
  --band: #ca232b;
  --band-ink: #ffffff;
  --band-pattern: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 22px), repeating-linear-gradient(-45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 22px);
  --sticker: #ffffff;
  --sticker-ink: #ca232b;
  --highlight-soft: #fff1da;
  --highlight-border: #f2cf8e;
  --bg: #fff8f7;
  --surface-1: #ffffff;
  --surface-2: #fbeeed;
  --border: #f1dedd;
  --border-strong: #e4c5c3;
  --text-primary: #2a1416;
  --text-secondary: #6b4a4c;
  --text-muted: #9b7d7f;
  --brand-soft: #fbe3e3;
  --series-1: #ca232b;
  --series-2: #f2b2ae;
  --good: #127a4a;
  --warn: #a8620a;
  --bad: #8f1219;
  --display: "Kanit", "IBM Plex Sans Thai", system-ui, sans-serif;
  --grid: rgba(15, 23, 35, 0.07);
  --axis: rgba(15, 23, 35, 0.5);
  --shadow: 0 1px 0 rgba(15, 23, 35, .04), 0 10px 30px -18px color-mix(in srgb, var(--accent) 45%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #6d8ff0;
    --accent-deep: #2f5bd3;
    --accent-ink: #0b1220;
    --band: #1b2838;
    --band-ink: #ffffff;
    --band-pattern: none;
    --sticker: #ffffff;
    --sticker-ink: #24354a;
    --highlight-soft: #16233a;
    --highlight-border: #25395a;
    --bg: #0f1520;
    --surface-1: #151e2b;
    --surface-2: #1c2737;
    --border: #253246;
    --border-strong: #33445d;
    --text-primary: #e8edf5;
    --text-secondary: #a8b4c6;
    --text-muted: #7a879b;
    --brand-soft: #1d2c4f;
    --series-1: #6d8ff0;
    --series-2: #2c3f6a;
    --good: #43c98c;
    --warn: #f0b049;
    --bad: #f27a70;
    --grid: rgba(240, 240, 245, 0.08);
    --axis: rgba(240, 240, 245, 0.5);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
  }
  :root[data-brand="yogurbara"]:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #3d93ee;
    --accent-deep: #2c86e6;
    --accent-ink: #ffffff;
    --band: #2c86e6;
    --band-ink: #ffffff;
    --band-pattern: none;
    --sticker: #f6df72;
    --sticker-ink: #2b2510;
    --highlight-soft: #3a3418;
    --highlight-border: #5a5126;
    --bg: #0b1828;
    --surface-1: #112338;
    --surface-2: #172d47;
    --border: #1f3756;
    --border-strong: #2c4a70;
    --text-primary: #eaf2fc;
    --text-secondary: #a9bdd6;
    --text-muted: #7690b0;
    --brand-soft: #18375c;
    --series-1: #4d9cf0;
    --series-2: #2f5f93;
    --good: #43c98c;
    --warn: #f0b049;
    --bad: #f27a70;
    --grid: rgba(240, 240, 245, 0.08);
    --axis: rgba(240, 240, 245, 0.5);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
  }
  :root[data-brand="haab"]:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #e5484f;
    --accent-deep: #ca232b;
    --accent-ink: #ffffff;
    --band: #b81f27;
    --band-ink: #ffffff;
    --band-pattern: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 22px), repeating-linear-gradient(-45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 22px);
    --sticker: #ffffff;
    --sticker-ink: #ca232b;
    --highlight-soft: #3a2a12;
    --highlight-border: #5c4320;
    --bg: #170f10;
    --surface-1: #211517;
    --surface-2: #2b1b1e;
    --border: #3a2629;
    --border-strong: #523437;
    --text-primary: #f7ecea;
    --text-secondary: #c9adab;
    --text-muted: #9a7f7d;
    --brand-soft: #4a1e22;
    --series-1: #ef5a60;
    --series-2: #6e2a2e;
    --good: #43c98c;
    --warn: #f0b049;
    --bad: #ff8a80;
    --grid: rgba(240, 240, 245, 0.08);
    --axis: rgba(240, 240, 245, 0.5);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #6d8ff0;
  --accent-deep: #2f5bd3;
  --accent-ink: #0b1220;
  --band: #1b2838;
  --band-ink: #ffffff;
  --band-pattern: none;
  --sticker: #ffffff;
  --sticker-ink: #24354a;
  --highlight-soft: #16233a;
  --highlight-border: #25395a;
  --bg: #0f1520;
  --surface-1: #151e2b;
  --surface-2: #1c2737;
  --border: #253246;
  --border-strong: #33445d;
  --text-primary: #e8edf5;
  --text-secondary: #a8b4c6;
  --text-muted: #7a879b;
  --brand-soft: #1d2c4f;
  --series-1: #6d8ff0;
  --series-2: #2c3f6a;
  --good: #43c98c;
  --warn: #f0b049;
  --bad: #f27a70;
  --grid: rgba(240, 240, 245, 0.08);
  --axis: rgba(240, 240, 245, 0.5);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
}
:root[data-brand="yogurbara"][data-theme="dark"] {
  color-scheme: dark;
  --accent: #3d93ee;
  --accent-deep: #2c86e6;
  --accent-ink: #ffffff;
  --band: #2c86e6;
  --band-ink: #ffffff;
  --band-pattern: none;
  --sticker: #f6df72;
  --sticker-ink: #2b2510;
  --highlight-soft: #3a3418;
  --highlight-border: #5a5126;
  --bg: #0b1828;
  --surface-1: #112338;
  --surface-2: #172d47;
  --border: #1f3756;
  --border-strong: #2c4a70;
  --text-primary: #eaf2fc;
  --text-secondary: #a9bdd6;
  --text-muted: #7690b0;
  --brand-soft: #18375c;
  --series-1: #4d9cf0;
  --series-2: #2f5f93;
  --good: #43c98c;
  --warn: #f0b049;
  --bad: #f27a70;
  --grid: rgba(240, 240, 245, 0.08);
  --axis: rgba(240, 240, 245, 0.5);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
}
:root[data-brand="haab"][data-theme="dark"] {
  color-scheme: dark;
  --accent: #e5484f;
  --accent-deep: #ca232b;
  --accent-ink: #ffffff;
  --band: #b81f27;
  --band-ink: #ffffff;
  --band-pattern: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 22px), repeating-linear-gradient(-45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 22px);
  --sticker: #ffffff;
  --sticker-ink: #ca232b;
  --highlight-soft: #3a2a12;
  --highlight-border: #5c4320;
  --bg: #170f10;
  --surface-1: #211517;
  --surface-2: #2b1b1e;
  --border: #3a2629;
  --border-strong: #523437;
  --text-primary: #f7ecea;
  --text-secondary: #c9adab;
  --text-muted: #9a7f7d;
  --brand-soft: #4a1e22;
  --series-1: #ef5a60;
  --series-2: #6e2a2e;
  --good: #43c98c;
  --warn: #f0b049;
  --bad: #ff8a80;
  --grid: rgba(240, 240, 245, 0.08);
  --axis: rgba(240, 240, 245, 0.5);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
}

/* ──────────────────────────────────────────────────────────────── base ── */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 {
  font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -.01em;
  font-variation-settings: "SOFT" 100, "opsz" 72;
}
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; color: var(--text-secondary); font-weight: 600; margin-bottom: 12px; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
small, .muted { color: var(--text-muted); }
a { color: var(--brand); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

button, .file-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 18px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary);
}
button:hover, .file-btn:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--accent-ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small { padding: 5px 12px; font-size: 13px; }
.file-btn input { display: none; }

input, textarea, select {
  font: inherit; color: var(--text-primary); background: var(--surface-1);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px;
}
textarea { width: 100%; font-family: var(--mono); font-size: 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--brand-soft); border-color: var(--accent); }

/* ──────────────────────────────────────────────────── the blue band ── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; background-color: var(--band); background-image: var(--band-pattern); color: var(--band-ink);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mascot {
  width: 48px; height: 48px; border-radius: 50%; background: #fff; flex: none; object-fit: cover;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .35);
}
/* HAAB's logo is the red wordmark tile itself — keep it square-ish */
:root[data-brand="haab"] .mascot, :root[data-brand="default"] .mascot, :root:not([data-brand]) .mascot { border-radius: 12px; }
:root[data-brand="haab"] .wordmark .name { font-weight: 800; letter-spacing: 0; }
:root[data-brand="haab"] h1 { font-weight: 700; }
.wordmark { display: flex; flex-direction: column; min-width: 0; }
.wordmark .name {
  font-family: var(--display); font-weight: 900; font-size: 28px; line-height: 1;
  font-variation-settings: "SOFT" 100, "opsz" 96; letter-spacing: -.01em;
}
.wordmark .sub { font-size: 13px; opacity: .85; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; gap: 10px; align-items: center; }
.chip {
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; white-space: nowrap;
  background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .3);
}
/* the restaurant tag: plain by default, the brand's own label where it has one */
#restaurantChip { background: var(--sticker); color: var(--sticker-ink); border-color: transparent; }
/* YogurBara: the "100% Fresh" product-label sticker */
:root[data-brand="yogurbara"] #restaurantChip {
  border-radius: 6px; transform: rotate(-2deg); box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
  font-family: var(--display); font-weight: 800; font-variation-settings: "SOFT" 100;
}
/* HAAB: the "Redefined Southern Thai Classics" ribbon off the paper bag */
:root[data-brand="haab"] #restaurantChip {
  border-radius: 3px; transform: skewX(-10deg); border: 2px solid var(--accent-deep);
  font-family: var(--display); font-weight: 700; font-style: italic; letter-spacing: .02em;
}
.chip.warn { background: #ffe9a8; color: #3a2a00; border-color: transparent; }
.chip.bad { background: var(--bad); color: #fff; border-color: transparent; }
.icon-btn { padding: 5px 11px; background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .35); }
.icon-btn:hover { color: #fff; border-color: #fff; }

/* ──────────────────────────────────────────────────────────── layout ── */
main { max-width: 1280px; margin: 0 auto; padding: 24px 28px 64px; }
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 24px;
}
.setup-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; }
.step h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.num {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 13px; font-family: var(--display); font-weight: 800;
}
.hint { margin: 0 0 10px; color: var(--text-secondary); font-size: 13.5px; }
.cred-status { margin-top: 8px; font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; }
.ok { color: var(--good); }
.err { color: var(--bad); }
.warn { color: var(--warn); }
.check { display: flex; gap: 8px; align-items: baseline; margin: 8px 0; }
.check input { accent-color: var(--accent); }
.check small { margin-left: auto; padding-left: 8px; }
.inline { display: flex; gap: 8px; align-items: center; margin: 8px 0 0 26px; font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 0 26px; font-size: 13.5px; }
.period-label { color: var(--text-secondary); font-weight: 600; }
.period input[type="date"] { width: 148px; }
.period-hint { margin: 6px 0 0 26px; font-size: 12.5px; }
.banner { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--brand-soft); font-size: 13.5px; }
details.settings { margin-top: 12px; font-size: 13.5px; color: var(--text-secondary); }
details.settings summary { cursor: pointer; }
details.settings label { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
details.settings input { flex: 1; min-width: 0; }

.progress { margin-top: 20px; display: grid; gap: 10px; }
.phase { display: grid; grid-template-columns: 120px 1fr 230px; gap: 12px; align-items: center; font-size: 13.5px; }
.phase .bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.phase .bar i { display: block; height: 100%; background: var(--accent); width: 0; border-radius: 99px; transition: width .3s; }
.phase .note { color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.log { margin-top: 12px; font-size: 12.5px; color: var(--text-secondary); display: grid; gap: 2px; }
.log .err { font-weight: 600; }

/* ──────────────────────────────────────────────────────────── dashboard ── */
#dash { margin-top: 28px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-head p { margin: 6px 0 0; color: var(--text-secondary); font-size: 13.5px; }
.range { display: flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--text-secondary); flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.tabs button {
  border: none; background: none; border-radius: 0; padding: 11px 14px; color: var(--text-secondary);
  position: relative; white-space: nowrap;
}
.tabs button:hover { color: var(--accent); }
.tabs button[aria-selected="true"] { color: var(--text-primary); }
.tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -2px; height: 4px;
  border-radius: 4px 4px 0 0; background: var(--accent);
}
.tab-panel[hidden] { display: none; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-size: 12.5px; color: var(--text-secondary); }
.kpi .value {
  font-family: var(--display); font-weight: 800; font-size: 30px; margin-top: 2px; line-height: 1.15;
  font-variation-settings: "SOFT" 100, "opsz" 48; font-variant-numeric: lining-nums tabular-nums; color: var(--text-primary);
}
.kpi .foot { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.grid2 > .panel, .grid3 > .panel { margin-bottom: 0; }
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; min-width: 0; margin-bottom: 16px; }
.panel .note { font-size: 12.5px; color: var(--text-muted); margin: -6px 0 10px; }

/* the one place the sticker yellow speaks */
.panel:has(> .insights) { background: var(--highlight-soft); border-color: var(--highlight-border); }
.panel:has(> .insights) h3 { color: var(--text-primary); font-family: var(--display); font-weight: 800; font-size: 18px; font-variation-settings: "SOFT" 100; }
.insights { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.insights li::marker { color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 12.5px; padding: 8px 10px; border-bottom: 1.5px solid var(--border-strong); white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data td.n, table.data th.n { text-align: right; white-space: nowrap; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--accent-deep); white-space: nowrap; }
:root[data-theme="dark"] .pill { color: var(--text-primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill { color: var(--text-primary); } }

/* charts */
svg .grid { stroke: var(--grid); }
svg .axis-label { fill: var(--axis); font-size: 11px; font-family: var(--sans); }
svg .bar.s1 { fill: var(--series-1); }
svg .bar.s2 { fill: var(--series-2); }
svg .hit { fill: transparent; }
svg .bar-group:hover .bar { opacity: .82; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.s1 { background: var(--series-1); }
.sw.s2 { background: var(--series-2); }
.chart-empty { color: var(--text-muted); font-size: 13.5px; padding: 24px 0; text-align: center; }
.chart-tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 280px;
  background: var(--text-primary); color: var(--bg); font-size: 12.5px; padding: 6px 10px; border-radius: 8px;
}
.hbars { display: grid; gap: 7px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 64px; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 99px; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); }

table.heat { border-collapse: separate; border-spacing: 3px; font-size: 11px; width: 100%; }
table.heat th { color: var(--text-muted); font-weight: 500; padding: 0 4px; text-align: right; white-space: nowrap; }
table.heat thead th { text-align: center; }
table.heat td {
  height: 22px; min-width: 18px; border-radius: 5px; text-align: center; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--series-1) calc(var(--a, 0) * 100%), var(--surface-2));
}
table.heat.values td { color: var(--text-primary); }

.rfm-grid { display: grid; grid-template-columns: 34px repeat(5, 1fr); gap: 4px; font-size: 12px; }
.rfm-grid .ax { color: var(--text-muted); display: grid; place-items: center; }
.rfm-cell {
  border-radius: 10px; padding: 8px 7px; min-height: 64px; display: flex; flex-direction: column; justify-content: space-between;
  background: color-mix(in srgb, var(--series-1) calc(var(--a, 0) * 100%), var(--surface-2)); cursor: pointer;
}
.rfm-cell .seg { font-size: 10.5px; line-height: 1.2; opacity: .85; }
.rfm-cell .cnt { font-family: var(--display); font-weight: 800; font-size: 17px; font-variation-settings: "SOFT" 100; font-variant-numeric: lining-nums; }
.rfm-cell.dark { color: #fff; }

.exports { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.export { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-1); }
.export p { margin: 0; font-size: 12.5px; color: var(--text-secondary); flex: 1; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { flex: 1; min-width: 180px; }

.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(640px, 100vw); z-index: 40;
  background: var(--surface-1); border-left: 1px solid var(--border); box-shadow: -20px 0 40px -20px rgba(15, 39, 66, .35);
  padding: 22px; overflow-y: auto;
}
.drawer header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.drawer header h2 { font-family: var(--display); font-weight: 800; font-size: 22px; font-variation-settings: "SOFT" 100; }
.drawer .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.drawer .facts div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; color: var(--text-secondary); }
.drawer .facts b { display: block; font-size: 15px; color: var(--text-primary); }
.bill { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; font-size: 13.5px; }
.bill .head { display: flex; justify-content: space-between; gap: 8px; }
.bill ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-secondary); }

/* ──────────────────────────────────────────────────────────────── narrow ── */
@media (max-width: 900px) {
  .setup-grid, .grid2, .grid3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .phase { grid-template-columns: 90px 1fr; }
  .phase .note { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 560px) {
  main { padding: 16px 16px 48px; }
  .top { padding: 12px 16px; flex-wrap: wrap; }
  .wordmark .name { font-size: 22px; }
  .wordmark .sub { display: none; }
  .mascot { width: 38px; height: 38px; }
  .kpi .value { font-size: 24px; }
  .drawer .facts { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .phase .bar i { transition: none; }
}
