/* LeadsUpward reporting dashboard. Colors are role tokens; dark mode is its own set of steps. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --raised: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.04);
  --accent: #2a78d6;
  --google: #2a78d6;
  --meta: #eb6834;
  --single: #2a78d6;
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --warning-ink: #8a5a00;
  --critical: #d03b3b;
  --critical-ink: #b12d2d;
  --neutral: #898781;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --raised: #1f1f1e;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #9a9890;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.05);
    --accent: #3987e5;
    --google: #3987e5;
    --meta: #d95926;
    --single: #3987e5;
    --good-ink: #0ca30c;
    --warning-ink: #fab219;
    --critical-ink: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --raised: #1f1f1e; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a9890;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,0.10); --wash: rgba(255,255,255,0.05);
  --accent: #3987e5; --google: #3987e5; --meta: #d95926; --single: #3987e5;
  --good-ink: #0ca30c; --warning-ink: #fab219; --critical-ink: #e66767;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
h1 { font-size: 26px; line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 620; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; color: var(--ink-2); }

.top { background: var(--surface); border-bottom: 1px solid var(--ring); }
.top-row { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.brand { font-weight: 680; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent);
  clip-path: polygon(50% 8%, 92% 60%, 66% 60%, 66% 92%, 34% 92%, 34% 60%, 8% 60%); }
.through { color: var(--muted); font-size: 13px; text-align: right; }
.top-right { display: flex; align-items: center; gap: 18px; }
.nav { display: flex; gap: 4px; }
.nav:empty { display: none; }
.nav a { font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.nav a:hover { background: var(--wash); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--wash); }
@media (max-width: 640px) { .top-right .through { display: none; } .nav a { padding: 6px 8px; } }

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 28px 0 20px; }
.head .sub { color: var(--ink-2); margin-top: 4px; }
.crumb { font-size: 13px; margin-bottom: 6px; }
.crumb a { text-decoration: none; }

.period { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.custom { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 12px; font-size: 13px; color: var(--ink-2); }
.custom label { display: flex; align-items: center; gap: 6px; }
.custom input { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--ring); border-radius: 8px; padding: 5px 8px; }
.custom .muted { font-size: 12px; flex-basis: 100%; text-align: right; }
td a.nm { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--axis); }
td a.nm:hover { color: var(--accent); border-color: var(--accent); }
td a.sm { display: block; font-size: 12px; margin-top: 4px; text-decoration: none; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--ring); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--ink-2); padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button:hover { background: var(--wash); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--ring); }

.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 14px; padding: 18px; }
.grid { display: grid; gap: 14px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 14px; }
.stack { margin-bottom: 14px; }

.hero { display: flex; flex-wrap: wrap; gap: 24px 40px; align-items: flex-end; }
.hero .big { font-size: 48px; font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.hero .lbl { color: var(--ink-2); font-size: 14px; margin-bottom: 8px; }
.tile .lbl { color: var(--ink-2); font-size: 13px; }
.tile .val { font-size: 26px; font-weight: 640; line-height: 1.2; margin-top: 4px; }
.tile .foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.delta { font-size: 12.5px; font-weight: 600; }
.delta.good { color: var(--good-ink); } .delta.bad { color: var(--critical-ink); } .delta.flat { color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px 3px 7px;
  border-radius: 999px; background: var(--wash); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.badge.good { color: var(--good-ink); } .badge.good::before { background: var(--good); }
.badge.warning { color: var(--warning-ink); } .badge.warning::before { background: var(--warning); }
.badge.critical { color: var(--critical-ink); } .badge.critical::before { background: var(--critical); }
.badge .ic { font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11.5px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--ring); color: var(--ink-2); white-space: nowrap; }
.chip.off { color: var(--muted); border-style: dashed; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.key.google { background: var(--google); } .key.meta { background: var(--meta); }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td:first-child { white-space: normal; min-width: 180px; }
th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: none; }
td { font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--wash); }
tr.subrow td { color: var(--ink-2); font-size: 13px; }
tr.subrow td:first-child { padding-left: 26px; }
tr.total td { font-weight: 640; border-bottom: 0; }
td .nm { font-weight: 560; overflow-wrap: anywhere; } td .sm { display: block; font-size: 12px; color: var(--muted); }
.over { color: var(--critical-ink); font-weight: 600; } .under { color: var(--good-ink); font-weight: 600; }

.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.chart { position: relative; margin-top: 8px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .bl { stroke: var(--axis); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit:focus { fill: var(--wash); outline: none; }
.linkbtn { font: inherit; font-size: 12.5px; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
.tview { margin-top: 10px; }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--raised); color: var(--ink); border: 1px solid var(--ring);
  border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 140px; }
.tip .d { color: var(--muted); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .r .k { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip .r .k i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.tip .r b { font-variant-numeric: tabular-nums; }

.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--grid); font-size: 13.5px; }
.list li:last-child { border-bottom: 0; }
.list .when { color: var(--muted); font-size: 12px; margin-right: 6px; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; }
details[open] summary { margin-bottom: 8px; }
.note { font-size: 12.5px; color: var(--muted); margin: 18px 0 40px; line-height: 1.6; }
.note p { margin: 0 0 6px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 6px 0; }
.landing { padding: 60px 16px; max-width: 560px; }
.landing p { margin-top: 10px; }
.loading { padding: 40px 0; }

details.settings > summary.sum { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; cursor: pointer; }
details.settings > summary.sum::-webkit-details-marker { display: none; }
details.settings > summary.sum::after { content: "Edit"; margin-left: auto; font-size: 13px; color: var(--accent); }
details.settings[open] > summary.sum::after { content: "Close"; }
details.settings > summary .nm { font-weight: 620; font-size: 15.5px; }
details.settings { padding-top: 14px; padding-bottom: 14px; }
.settings .block { border-top: 1px solid var(--grid); padding-top: 14px; margin-top: 14px; }
.settings .row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.settings .st { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1 1 170px; max-width: 320px; }
.fl { font-size: 12.5px; color: var(--ink-2); font-weight: 560; }
.fh { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.in { font: inherit; font-size: 14px; color: var(--ink); background: var(--raised); border: 1px solid var(--ring); border-radius: 8px; padding: 7px 9px; width: 100%; }
.in:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.btn { font: inherit; font-size: 13.5px; font-weight: 600; border: 0; border-radius: 8px; padding: 8px 14px; background: var(--accent); color: #fff; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: default; }
.seg.small button { padding: 5px 12px; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.list.accts li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.list.accts .linkbtn { margin-left: auto; }
.linkbtn.danger { color: var(--critical-ink); }
.notice { font-size: 13.5px; border-radius: 10px; padding: 9px 12px; margin: 10px 0 0; background: var(--wash); color: var(--ink-2); border-left: 3px solid var(--neutral); }
.notice.good { border-left-color: var(--good); } .notice.critical { border-left-color: var(--critical); color: var(--critical-ink); }
.notice.busy { border-left-color: var(--accent); }
@media (max-width: 640px) {
  .fld { max-width: none; }
  .hero .big { font-size: 40px; }
  .head { margin-top: 20px; }
  h1 { font-size: 22px; }
  .card { padding: 14px; border-radius: 12px; }
  .two { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period { width: 100%; align-items: stretch; }
  .custom { justify-content: flex-start; }
  .custom .muted { text-align: left; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 6px 4px; font-size: 12.5px; }
  td:first-child { min-width: 150px; max-width: 200px; }
  .hero { gap: 16px 28px; }
}
@media print { .seg, .linkbtn { display: none; } body { background: #fff; } }
