/* ==========================================================================
   NED Agency Dashboard — brand stylesheet
   Source of truth: ned-brand (Ink Black, Electric Lime, Pure White, Cool Grey;
   Cormorant Garamond headings, Outfit body). Dark-first, same tokens as the
   Internal Hub. Chart series colors are validated steps for the black surface
   (dataviz validator, Sep 2026): Meta #8a9a1f, Google #3987e5.
   ========================================================================== */

:root {
  --ink: #000000;
  --white: #ffffff;
  --lime: #eaf790;
  --grey: #a6a6a6;

  --surface: #0c0c0c;
  --surface-2: #141414;
  --line: #262626;
  --line-strong: #333333;
  --grey-dim: #6f6f6f;
  --lime-tint: rgba(234, 247, 144, 0.08);
  --lime-glow: rgba(234, 247, 144, 0.18);

  /* data-viz roles */
  --series-meta: #8a9a1f;
  --series-google: #3987e5;
  --series-shopify: #eaf790;      /* used only as a swatch beside text, never as a chart mark */
  --series-mono: #8a9a1f;         /* single-series line */
  --de-emphasis: #4a4a4a;         /* sparklines, prior-period */
  --grid: #1c1c1c;
  --delta-good: #7ed49a;
  --delta-bad: #f08a8a;

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius: 14px;
  --radius-sm: 8px;
  --max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--ink); }
body {
  margin: 0;
  overflow-x: clip;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 4px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px var(--gutter);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.brand-mark { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-weight: 400; font-size: 20px; letter-spacing: 0.02em; }
.brand-sub { font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lime); }
.hub-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--grey); padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.hub-link svg { width: 14px; height: 14px; }
.hub-link:hover { color: var(--lime); border-color: var(--lime); }

/* ---------- page + hero ---------- */
.page { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: clamp(32px, 6vw, 72px) var(--gutter) 64px; }
.kicker { margin: 0 0 12px; font-size: 12px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--lime); }
.display { margin: 0; max-width: 18ch; font-family: var(--font-display); font-weight: 300; font-size: clamp(38px, 6vw, 64px); line-height: 1.05; }
.display em, .section-title em { font-style: italic; font-weight: inherit; color: var(--lime); }
.lede { margin: 18px 0 0; max-width: 58ch; font-size: 16px; color: var(--grey); }

/* ---------- filters ---------- */
.filters {
  position: sticky; top: 73px; z-index: 9;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  margin: 36px 0 8px; padding: 12px 0;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.range { display: inline-flex; gap: 6px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.fbtn {
  padding: 6px 14px; border: 0; border-radius: 999px; background: transparent;
  font-size: 13px; font-weight: 400; color: var(--grey); cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.fbtn:hover { color: var(--white); }
.fbtn[aria-pressed="true"] { background: var(--lime); color: var(--ink); font-weight: 500; }
.status { margin: 0; font-size: 12px; letter-spacing: 0.02em; color: var(--grey-dim); }
.status.warn { color: var(--delta-bad); }

/* ---------- sections ---------- */
.section { margin-top: clamp(44px, 6vw, 72px); }
.section[hidden] { display: none; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.section-head .kicker { margin-bottom: 8px; }
.section-title { margin: 0; font-family: var(--font-display); font-weight: 300; font-size: clamp(26px, 3.2vw, 36px); line-height: 1.1; }
.section-blurb { margin: 8px 0 0; max-width: 70ch; font-size: 14px; color: var(--grey); }
.section-count { flex-shrink: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--grey-dim); padding-bottom: 4px; white-space: nowrap; }

/* ---------- attention ---------- */
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.attention li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; }
.attention .sev { flex-shrink: 0; margin-top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); }
.attention .sev.high { background: var(--delta-bad); }
.attention .sev.mid { background: #e0b25c; }
.attention .who { font-weight: 500; color: var(--white); }
.attention .what { color: var(--grey); }
.attention a:hover .who { color: var(--lime); }

/* ---------- tiles ---------- */
.hero-row { display: grid; grid-template-columns: minmax(280px, 1.2fr) 2fr; gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 0;
}
.tile .label { font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey); }
.tile .value { font-size: 28px; font-weight: 500; line-height: 1.1; color: var(--white); font-variant-numeric: normal; letter-spacing: -0.01em; }
.tile .sub { font-size: 12px; color: var(--grey-dim); }
.tile .spark { margin-top: 6px; width: 100%; height: 34px; display: block; }
.tile .spark path { fill: none; stroke: var(--de-emphasis); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.tile .spark path.cur { stroke: var(--series-mono); stroke-width: 2; }
.tile .spark circle { fill: var(--series-mono); stroke: var(--surface); stroke-width: 2; }
.hero-figure { justify-content: center; padding: 26px 26px 22px; }
.hero-figure .value { font-size: clamp(44px, 5vw, 64px); font-weight: 500; }
.hero-figure .spark { height: 56px; margin-top: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-content: start; }
.kpis.compact .tile { padding: 14px 14px 12px; gap: 4px; }
.kpis.compact .value { font-size: 22px; }

.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--grey-dim); white-space: nowrap; }
.delta .arr { font-size: 10px; }
.delta.d-good { color: var(--delta-good); }
.delta.d-bad { color: var(--delta-bad); }
.delta .vs { font-weight: 300; color: var(--grey-dim); }

/* ---------- platforms ---------- */
.platforms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.platform { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.platform-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.platform-head h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1; }
.platform-sub { margin-left: auto; font-size: 12px; color: var(--grey-dim); text-align: right; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--grey); vertical-align: middle; }
.swatch.meta { background: var(--series-meta); }
.swatch.google { background: var(--series-google); }
.swatch.shopify { background: var(--series-shopify); }
.platform .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.platform .tile { background: var(--surface-2); }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { position: relative; margin: 0; padding: 16px 16px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.chart-card figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.chart-title { font-size: 13px; font-weight: 500; letter-spacing: 0.04em; }
.chart-note { font-size: 12px; color: var(--grey-dim); }
.legend { display: inline-flex; gap: 14px; font-size: 12px; color: var(--grey); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; }
.chart { position: relative; width: 100%; min-height: 220px; outline-offset: 4px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--grey-dim); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart .bar.meta { fill: var(--series-meta); }
.chart .bar.google { fill: var(--series-google); }
.chart .line { fill: none; stroke: var(--series-mono); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-mono); opacity: 0.1; }
.chart .dot { fill: var(--series-mono); stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--grey); stroke-width: 1; opacity: 0; }
.chart .hit { fill: transparent; }
.chart.hovering .crosshair { opacity: 0.8; }
.chart .endlabel { fill: var(--white); font-size: 11px; font-weight: 500; font-family: var(--font-body); }
.chart.loading { opacity: 0.5; }
.tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 150px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.8); font-size: 12px; line-height: 1.5;
}
.tip .tdate { color: var(--grey); margin-bottom: 4px; }
.tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .row .name { color: var(--grey); display: inline-flex; align-items: center; gap: 6px; }
.tip .row .name i { display: inline-block; width: 12px; height: 2px; background: var(--grey); }
.tip .row .name i.meta { background: var(--series-meta); }
.tip .row .name i.google { background: var(--series-google); }
.tip .row .name i.mono { background: var(--series-mono); }
.tip .row .v { font-weight: 600; color: var(--white); font-variant-numeric: tabular-nums; }
.tip .row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }

/* ---------- tables ---------- */
.table-view { margin-top: 12px; }
.table-view summary { cursor: pointer; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey); padding: 8px 0; }
.table-view summary:hover { color: var(--lime); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.clients { font-size: 12.5px; }
th { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey); background: var(--surface-2); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tfoot td { font-weight: 500; color: var(--white); background: var(--surface-2); border-top: 1px solid var(--line-strong); }
table.clients th.sortable { cursor: pointer; user-select: none; }
table.clients th.sortable:hover { color: var(--white); }
table.clients th[aria-sort="descending"]::after { content: " ↓"; color: var(--lime); }
table.clients th[aria-sort="ascending"]::after { content: " ↑"; color: var(--lime); }
table.clients td.name a { font-weight: 500; color: var(--white); }
table.clients td.name a:hover { color: var(--lime); }
table.clients td.name .meta { display: block; font-size: 11px; color: var(--grey-dim); margin-top: 2px; }
table.clients td .flag { display: inline-block; font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--grey); margin-right: 4px; }
table.clients td .flag.bad { color: var(--delta-bad); border-color: rgba(240,138,138,.4); }
table.clients td .flag.warn { color: #e0b25c; border-color: rgba(224,178,92,.4); }
table.clients td .flag.ok { color: var(--delta-good); border-color: rgba(126,212,154,.35); }
table.clients td .cell-delta { display: block; margin-top: 2px; }
td.na { color: var(--grey-dim); }

/* ---------- footer ---------- */
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; width: 100%; max-width: var(--max); margin: 0 auto; padding: 22px var(--gutter) 32px; border-top: 1px solid var(--line); font-size: 12px; letter-spacing: 0.04em; color: var(--grey-dim); }
.footer .dot { margin: 0 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .platforms { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
  .hero-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .filters { position: static; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-count { white-space: normal; }
  .hub-link span { display: none; }
  .tile .value { font-size: 24px; }
  .hero-figure .value { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
