/* Vantage dashboard. Colours follow one validated chart palette; light and dark are both selected. */
:root {
  color-scheme: light;
  --page: #f6f6f4;
  --surface: #ffffff;
  --ink: #191919;
  --ink-2: #666666;
  --hairline: #e7e7e7;
  --axis: #c2c2c2;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.04);
  --accent: #257de0;
  --accent-ink: #1757ac;
  --track: #cce3fd;
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600; --s5: #ee7fac; --s6: #008a17; --s7: #6a4ce2; --s8: #ec4647;
  --neutral: #c2c2c2;
  --good: #0aac23; --warning: #fbb315; --serious: #f18a59; --critical: #dc3c3d;
  --good-ink: #006c10; --critical-ink: #b3261e;
  --banner: #fff6dd; --banner-ink: #5c4300; --banner-edge: #f2d58a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --bar-muted: #a8a8a8; --mark-brand: #d6e8fc; --mark-comp: rgba(11, 11, 11, 0.07);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface: #191919;
    --ink: #efefef;
    --ink-2: #9c9c9c;
    --hairline: #303030;
    --axis: #474747;
    --border: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.05);
    --accent: #338ced;
    --accent-ink: #84b9f3;
    --track: #0e3d7e;
    --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05; --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
    --neutral: #474747;
    --good-ink: #53c556; --critical-ink: #eb6263;
    --banner: #2b2410; --banner-ink: #f1dca0; --banner-edge: #5c4a12;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
    --bar-muted: #5c5c5c; --mark-brand: #12365f; --mark-comp: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-ink); }
button, select, textarea, input { font: inherit; color: inherit; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.brandmark { display: flex; align-items: center; gap: 12px; }
.logo { width: 30px; height: 30px; display: block; }
.wordmark { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.tagline { font-size: 12px; color: var(--ink-2); }
.controls { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.control label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented button { border: 0; background: none; padding: 7px 14px; cursor: pointer; border-right: 1px solid var(--border); }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-selected="true"] { background: var(--accent); color: #fff; font-weight: 600; }
select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); min-width: 220px; }

.banner { background: var(--banner); color: var(--banner-ink); border-bottom: 1px solid var(--banner-edge); padding: 9px 28px; font-size: 13px; }

.tabs { display: flex; gap: 4px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--hairline); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 10px 10px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tabs .count { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: var(--wash); font-size: 12px; font-weight: 600; color: var(--ink); }

.view { padding: 24px 28px 64px; max-width: 1280px; margin: 0 auto; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pagehead h1 { font-size: 22px; letter-spacing: -0.01em; }
.pagehead .sub { color: var(--ink-2); margin-top: 2px; }
.pagehead .meta { color: var(--ink-2); font-size: 13px; text-align: right; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 15px; }
.card .cardsub { color: var(--ink-2); font-size: 13px; margin: 2px 0 14px; }
.grid2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
@media (max-width: 980px) { .grid2 { grid-template-columns: 1fr; } }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.tile .delta { font-size: 12.5px; margin-top: 2px; color: var(--ink-2); }
.delta .up-good, .delta .down-good { color: var(--good-ink); font-weight: 600; }
.delta .up-bad, .delta .down-bad { color: var(--critical-ink); font-weight: 600; }
.tile .note { font-size: 12px; color: var(--ink-2); margin-top: 6px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px 10px 8px 0; border-bottom: 1px solid var(--axis); white-space: nowrap; }
td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--wash); }

/* marks */
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter .track { flex: 1; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.meter .val { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 2px; height: 20px; width: 100%; }
.stack .seg { height: 100%; min-width: 2px; }
.stack .seg:last-child { border-radius: 0 4px 4px 0; }
.stack.thin { height: 8px; }
.stack.thin .seg:first-child { border-radius: 4px 0 0 4px; }
.stack.tall { height: 28px; }
.stack.tall .seg { border-radius: 4px; color: #fff; font-size: 12px; font-weight: 600; padding: 5px 7px; overflow: visible; white-space: nowrap; }
.stack.tall .seg.dark-label { color: #0b0b0b; }
.sov-row { display: grid; grid-template-columns: 110px 1fr 46px; gap: 12px; align-items: center; padding: 7px 0; }
.sov-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.sov-row.total { border-top: 1px solid var(--hairline); margin-top: 6px; padding-top: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; font-size: 13px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.hbar { display: grid; grid-template-columns: 210px 1fr; gap: 12px; align-items: center; padding: 5px 0; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .barline { display: flex; align-items: center; gap: 8px; }
.hbar .bar { height: 14px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.spark-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.spark h3 { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.spark svg { width: 100%; height: auto; display: block; overflow: visible; }
.spark text { font: 11px system-ui, sans-serif; fill: var(--ink-2); }
.spark text.end { fill: var(--ink); font-weight: 600; font-size: 12px; }
details.tableview { margin-top: 12px; font-size: 13px; }
details.tableview summary { cursor: pointer; color: var(--ink-2); }

/* chips, badges, buttons */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px; background: var(--wash); font-size: 12px; white-space: nowrap; }
.chip.on { background: var(--accent); color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 6px; border: 1px solid var(--border); white-space: nowrap; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ghost { border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filters button { border: 1px solid var(--border); background: var(--surface); border-radius: 20px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--track); display: inline-block; }
.dots i.on { background: var(--accent); }
.dots i.fail { background: none; border: 1.5px dashed var(--axis); }

/* list cards */
.item { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; background: var(--surface); }
.item .row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.item h3 { font-size: 15px; }
.item .body { margin-top: 8px; }
.item .actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin-top: 10px; font-size: 13.5px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.quote { border-left: 3px solid var(--axis); padding: 2px 0 2px 10px; color: var(--ink-2); margin-top: 6px; }
.status-line { font-size: 12.5px; color: var(--ink-2); }
.dismissed { opacity: 0.55; }
.empty { text-align: center; color: var(--ink-2); padding: 40px 16px; }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
code, pre { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--wash); padding: 10px 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0 0; }

/* answers drawer */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 96vw); background: var(--page); border-left: 1px solid var(--border); box-shadow: var(--shadow); transform: translateX(102%); transition: transform 0.18s ease; z-index: 30; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--hairline); }
.drawer-head h2 { font-size: 16px; }
.drawer-body { overflow-y: auto; padding: 16px 20px 40px; }
.answer .text { margin-top: 10px; max-height: 190px; overflow: hidden; position: relative; }
.answer.expanded .text { max-height: none; }
.answer .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.claims { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.claims li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; padding: 3px 0; }
.claims .ic { font-weight: 700; }
.engine-head { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); margin: 18px 0 8px; }
.engine-head:first-child { margin-top: 0; }

textarea { width: 100%; min-height: 84px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); resize: vertical; }
.ask-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 16px; }

.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: 6px; font-size: 12.5px; max-width: 280px; box-shadow: var(--shadow); }
.tip b { font-weight: 600; }

/* sign-in and forms */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card .brandmark { margin-bottom: 22px; }
.auth-card h1 { font-size: 19px; margin-bottom: 4px; }
.auth-card .lead { color: var(--ink-2); margin-bottom: 18px; }
.auth-foot { color: var(--ink-2); font-size: 12.5px; margin-top: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"] { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible, tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-error { color: var(--critical-ink); font-size: 13px; margin: -4px 0 12px; }
.form-error:empty { display: none; }
.btn.wide { width: 100%; padding: 10px 12px; }
.btn.danger { color: var(--critical-ink); }
.btn.sm { padding: 3px 9px; font-size: 13px; }

/* top bar additions */
.controls { align-items: flex-end; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; display: flex; gap: 8px; align-items: center; }
.menu summary::-webkit-details-marker { display: none; }
.menu .avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.menu .pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; z-index: 15; }
@media (max-width: 900px) { .menu .pop { right: auto; left: 0; } }
.menu .who { padding: 6px 8px 10px; border-bottom: 1px solid var(--hairline); margin-bottom: 6px; }
.menu .pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.menu .pop button:hover { background: var(--wash); }

/* dialog */
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: min(440px, 92vw); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.dialog h2 { font-size: 17px; margin-bottom: 4px; }
.dialog .lead { color: var(--ink-2); margin-bottom: 16px; font-size: 13.5px; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

/* page head actions, toolbar */
.pagehead .right { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .filters { margin-bottom: 0; }
.toolbar select { min-width: 150px; padding: 5px 8px; }
.toolbar .grow { flex: 1; }
.note-input { flex: 1; min-width: 200px; }

/* key findings */
.findings { list-style: none; margin: 0; padding: 0; }
.findings li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--hairline); font-size: 14.5px; }
.findings li:last-child { border-bottom: 0; padding-bottom: 0; }
.findings .ic { font-weight: 700; text-align: center; }
.tile .label .chip { margin-left: 6px; }
.chip.warn { background: var(--banner); color: var(--banner-ink); }

/* ranked product chart */
.rank-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; padding: 6px 0; }
.rank-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row.is-brand .name { font-weight: 700; }
.rank-row .barline { display: flex; align-items: center; gap: 8px; }
.rank-row .bar { height: 16px; border-radius: 0 4px 4px 0; min-width: 2px; background: var(--bar-muted); }
.rank-row.is-brand .bar { background: var(--accent); }
.rank-row .val { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* formatted answers */
.md p { margin: 0 0 8px; }
.md h4 { font-size: 14px; margin: 12px 0 6px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md hr { border: 0; border-top: 1px solid var(--hairline); margin: 10px 0; }
.md table { font-size: 13px; margin: 0 0 8px; }
.md td, .md th { padding: 5px 8px 5px 0; vertical-align: top; white-space: normal; }
.md a { overflow-wrap: anywhere; }
mark { color: inherit; border-radius: 3px; padding: 0 2px; }
mark.brand { background: var(--mark-brand); font-weight: 600; }
mark.comp { background: var(--mark-comp); }

/* portfolio, users */
.linklike { border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent-ink); font-weight: 600; text-align: left; }
.role-help { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 13.5px; }
.role-help dt { font-weight: 600; }
.role-help dd { margin: 0; color: var(--ink-2); }
td select { min-width: 130px; padding: 4px 8px; }
.report-head { border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 18px; }
.report-head h1 { font-size: 24px; }
.report h2.section { font-size: 15px; margin: 22px 0 10px; }
.report-foot { color: var(--ink-2); font-size: 12.5px; margin-top: 22px; border-top: 1px solid var(--hairline); padding-top: 10px; }

/* organizations, products, usage */
.row-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.row-head > div:first-child { flex: 1; min-width: 0; }
.row-head .head-actions { flex: none; }
@media (max-width: 720px) { .row-head { flex-wrap: wrap; } }
.row-head .cardsub { margin-bottom: 0; }
.row-head + table, .row-head + div, .row-head + dl, .row-head + p { margin-top: 14px; }
.kv.wide { grid-template-columns: 150px 1fr; }
.kv .chip { margin: 0 4px 4px 0; }
td.actions-cell { white-space: nowrap; text-align: right; padding-right: 0; }
td.actions-cell .btn { margin-left: 4px; }
tr.total td { font-weight: 600; border-top: 1px solid var(--axis); border-bottom: 0; }
td.wrap { min-width: 260px; }
.dialog textarea { min-height: 110px; }
.dialog .field select, .dialog .field input { width: 100%; }
.dialog input:disabled { opacity: 0.6; }
.dialog.wide { width: min(560px, 94vw); }

@media print {
  .topbar, .tabs, .banner, .no-print, .drawer, .scrim, .tip, details.tableview { display: none !important; }
  body { background: #fff; }
  .view { padding: 0; max-width: none; }
  .card, .tile, .item { break-inside: avoid; box-shadow: none; }
  .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
