/* Marketing dashboard styles.
   Light + dark from one visual system, built on the dataviz reference palette
   (chrome/ink + the 8-slot categorical series). Light is the default; dark is a
   selected set (its own steps), applied by OS setting or the header toggle. */

:root {
  color-scheme: light;
  /* surfaces & ink */
  --plane:        #f9f9f7;
  --surface:      #fcfcfb;
  --surface-2:    #f2f1ec;
  --text:         #0b0b0b;
  --text-2:       #52514e;
  --muted:        #898781;
  --grid:         #e1e0d9;
  --axis:         #c3c2b7;
  --line:         #e1e0d9;
  --border:       rgba(11,11,11,0.10);
  /* categorical series (light steps) */
  --series-1:     #2a78d6;
  --series-2:     #008300;
  --series-3:     #e87ba4;
  --series-4:     #eda100;
  --series-5:     #1baf7a;
  --series-6:     #eb6834;
  --series-7:     #4a3aa7;
  --series-8:     #e34948;
  /* status */
  --good:         #0ca30c;
  --warning:      #fab219;
  --serious:      #ec835a;
  --critical:     #d03b3b;
  --good-text:    #006300;
  --accent:       var(--series-1);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane:      #0d0d0d;
    --surface:    #1a1a19;
    --surface-2:  #232322;
    --text:       #ffffff;
    --text-2:     #c3c2b7;
    --muted:      #898781;
    --grid:       #2c2c2a;
    --axis:       #383835;
    --line:       #2c2c2a;
    --border:     rgba(255,255,255,0.10);
    --series-1:   #3987e5;
    --series-2:   #008300;
    --series-3:   #d55181;
    --series-4:   #c98500;
    --series-5:   #199e70;
    --series-6:   #d95926;
    --series-7:   #9085e9;
    --series-8:   #e66767;
    --good-text:  #0ca30c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:      #0d0d0d;
  --surface:    #1a1a19;
  --surface-2:  #232322;
  --text:       #ffffff;
  --text-2:     #c3c2b7;
  --muted:      #898781;
  --grid:       #2c2c2a;
  --axis:       #383835;
  --line:       #2c2c2a;
  --border:     rgba(255,255,255,0.10);
  --series-1:   #3987e5;
  --series-2:   #008300;
  --series-3:   #d55181;
  --series-4:   #c98500;
  --series-5:   #199e70;
  --series-6:   #d95926;
  --series-7:   #9085e9;
  --series-8:   #e66767;
  --good-text:  #0ca30c;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--plane); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.45;
}
a { color: inherit; text-decoration: none; }

/* ---- header ---- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 15px; line-height: 1.25; }
.brand span {
  display: block; color: var(--muted); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; margin-top: 3px;
}
.nav { display: flex; gap: 6px; margin-left: 20px; flex-wrap: wrap; }
.nav a {
  padding: 7px 13px; border-radius: 8px; color: var(--text-2);
  font-weight: 600; font-size: 13px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.spacer { margin-left: auto; }
.themetoggle {
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.themetoggle:hover { color: var(--text); }

.content { padding: 24px 28px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---- sample-data banner ---- */
.sample-banner {
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line));
  color: var(--text); border-radius: 12px; padding: 12px 16px; margin-bottom: 20px;
}
.sample-tag {
  background: var(--warning); color: #241a00; font-weight: 800; font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px;
  white-space: nowrap;
}
.sample-banner .msg { color: var(--text-2); font-size: 13px; }

/* ---- section headings ---- */
.section { margin: 8px 0 14px; scroll-margin-top: 76px; }
.section h2 {
  margin: 26px 0 4px; font-size: 18px; display: flex; align-items: center; gap: 10px;
}
.section .sub { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.section:first-of-type h2 { margin-top: 6px; }

/* ---- KPI tiles ---- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi-v { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.kpi-l {
  color: var(--muted); font-size: 11px; margin-top: 5px;
  text-transform: uppercase; letter-spacing: .04em;
}
.kpi-d { font-size: 12px; margin-top: 6px; font-weight: 600; }
.kpi-d.pos { color: var(--good-text); }
.kpi-d.neg { color: var(--critical); }
.kpi-d.flat { color: var(--muted); }

.minirow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.mini b { font-size: 19px; }
.mini span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px;
  text-transform: uppercase; letter-spacing: .03em; }

/* ---- cards & charts ---- */
.charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.card .cap { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.chart { position: relative; height: 280px; }
.chart canvas { position: absolute; inset: 0; }
.legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
table.data td.r, table.data th.r { text-align: right; }
table.data .cap-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
table.data tbody tr:hover { background: var(--surface-2); }

.empty { color: var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }

/* ---- footer note ---- */
.foot { color: var(--muted); font-size: 12px; margin: 28px 0 8px; }

/* ---- login ---- */
body.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px; width: 340px;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card .sub { margin: 4px 0 20px; color: var(--muted); }
.login-card label { display: block; margin-bottom: 14px; color: var(--text-2); font-size: 13px; }
.login-card input {
  display: block; width: 100%; margin-top: 6px; padding: 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 14px;
}
.login-card button {
  width: 100%; padding: 11px; border: 0; border-radius: 8px; background: var(--accent);
  color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; margin-top: 6px;
}
.login-card .err {
  background: color-mix(in srgb, var(--critical) 15%, var(--surface));
  color: var(--critical); padding: 10px; border-radius: 8px; margin-bottom: 14px; font-size: 13px;
}

@media (max-width: 1100px) {
  .kpis, .minirow { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .card.wide { grid-column: auto; }
}
@media (max-width: 640px) {
  .kpis, .minirow { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
}
