/* BBB Sales Floor Command Center — executive dashboard theme.
   Palette roles follow the validated dataviz reference palette;
   light/dark swap in one place via custom properties. */

:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;          /* series-1 blue */
  --accent-ink: #ffffff;
  --series-2: #1baf7a;
  --series-3: #eda100;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --critical: #d03b3b;
  --good-bg: rgba(12, 163, 12, 0.12);
  --warning-bg: rgba(250, 178, 25, 0.18);
  --critical-bg: rgba(208, 59, 59, 0.12);
  --shadow: 0 1px 3px rgba(11, 11, 11, 0.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --good-text: #0ca30c;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.45;
}
#root { height: 100%; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex: 0 0 218px; background: var(--surface);
  border-right: 1px solid var(--hairline); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-weight: 800; font-size: 15px; padding: 4px 10px 14px; letter-spacing: .2px; }
.brand small { display: block; font-weight: 500; color: var(--ink-muted); font-size: 11px; }
.navlink {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 8px; color: var(--ink-2); cursor: pointer; border: none;
  background: none; text-align: left; width: 100%; font-size: 13.5px;
}
.navlink:hover { background: var(--surface-2); color: var(--ink); }
.navlink.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--ink-muted); padding: 14px 10px 4px; }
.sidebar .spacer { flex: 1; }

.main { flex: 1; min-width: 0; padding: 20px 26px 60px; }
.topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar h1 { margin: 0; flex: 1; }

/* ---------- controls ---------- */
select, input[type=text], input[type=password], input[type=date], textarea {
  background: var(--surface); color: var(--ink); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 7px 10px; font: inherit;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { width: 100%; resize: vertical; }
label.field { display: block; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2); }
label.field > span { display: block; margin-bottom: 3px; font-weight: 600; }
label.field input, label.field select { width: 100%; }

.btn {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px;
  padding: 8px 15px; font-weight: 600; cursor: pointer; font-size: 13.5px;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--hairline); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- cards & stats ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; margin-bottom: 16px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid > .card { margin-bottom: 0; }

.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-muted); }
.stat .value { font-size: 28px; font-weight: 750; margin: 2px 0; }
.stat .sub { font-size: 12px; color: var(--ink-2); }
.stat .value .unit { font-size: 15px; font-weight: 500; color: var(--ink-muted); }

/* ---------- status ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px;
  padding: 2px 10px; font-size: 12px; font-weight: 650; }
.pill.green { background: var(--good-bg); color: var(--good-text); }
.pill.yellow { background: var(--warning-bg); color: #8a5b00; }
.pill.red { background: var(--critical-bg); color: var(--critical); }
@media (prefers-color-scheme: dark) {
  .pill.yellow { color: var(--warning); }
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--good); } .dot.yellow { background: var(--warning); }
.dot.red { background: var(--critical); }

/* ---------- progress ---------- */
.progress { background: var(--surface-2); border-radius: 6px; height: 10px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 6px 0 0 6px; background: var(--accent); }
.progress.big { height: 16px; border-radius: 8px; }
.progress > div.green { background: var(--good); }
.progress > div.yellow { background: var(--warning); }
.progress > div.red { background: var(--critical); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-muted);
  cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); }
th.sorted { color: var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }

/* ---------- copy blocks ---------- */
.copyblock { position: relative; background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 14px 16px; margin: 10px 0; }
.copyblock pre { margin: 0; white-space: pre-wrap; font-family: inherit; font-size: 13.5px; }
.copyblock .btn { position: absolute; top: 10px; right: 10px; }

/* ---------- misc ---------- */
.muted { color: var(--ink-muted); } .small { font-size: 12px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.chartbox { position: relative; height: 260px; }
.list-plain { margin: 6px 0; padding-left: 18px; }
.list-plain li { margin-bottom: 5px; }
.banner { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.banner.warn { background: var(--warning-bg); }
.banner.ok { background: var(--good-bg); color: var(--good-text); }
.banner.err { background: var(--critical-bg); color: var(--critical); }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 340px; }
.login-card .brandmark { font-size: 34px; text-align: center; }

/* ---------- slides ---------- */
.slide { border: 1px solid var(--hairline); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.slide .slide-n { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .6px; }
.slide .copy { font-weight: 700; font-size: 15px; margin: 4px 0 8px; white-space: pre-wrap; }
.slide .meta { font-size: 12.5px; color: var(--ink-2); margin: 3px 0; }
.slide .meta b { color: var(--ink); }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; }
  .nav-section, .brand small, .spacer { display: none; }
}
@media print {
  .sidebar, .topbar select, .btn { display: none !important; }
  .main { padding: 0; }
}
