/* Demo dashboard: the Moonshine "glass" dashboard style.
   Frosted cards over a soft colour field; header and filters share one
   floating panel. Chart colours are the validated categorical palette. */
:root {
  color-scheme: light;
  --brand: #1f4d3a;
  --brand-ink: #ffffff;
  --accent: #c98a16;
  --field:
    radial-gradient(60% 55% at 4% 0%, rgba(31, 122, 88, .42) 0, transparent 70%),
    radial-gradient(55% 50% at 98% 4%, rgba(232, 168, 60, .48) 0, transparent 70%),
    radial-gradient(60% 60% at 80% 100%, rgba(84, 120, 220, .34) 0, transparent 70%),
    radial-gradient(55% 55% at 0% 100%, rgba(214, 120, 150, .30) 0, transparent 70%),
    linear-gradient(160deg, #eaf3ee 0%, #f3efe6 55%, #ecedf6 100%);
  --glass: rgba(255, 255, 255, .60);
  --glass-strong: rgba(255, 255, 255, .74);
  --glass-border: rgba(255, 255, 255, .80);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .85);
  --blur: blur(24px) saturate(150%);
  --pop: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77756f;
  --border: rgba(30, 30, 20, .16);
  --hairline: rgba(30, 30, 20, .09);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --shadow: 0 1px 1px rgba(30, 30, 20, .04), 0 10px 34px rgba(30, 30, 20, .09);
  --good: #006300;
  --bad: #c22f2f;
  --warn-bg: rgba(250, 178, 25, .16);
  --crit-bg: rgba(208, 59, 59, .12);
  --ok-bg: rgba(12, 163, 12, .12);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --cmp: #898781;
  --radius: 22px; --radius-sm: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--font);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #3f8a68;
  --accent: #e8b84a;
  --field:
    radial-gradient(70% 60% at 0% 0%, rgba(40, 140, 100, .34) 0, transparent 70%),
    radial-gradient(60% 60% at 100% 0%, rgba(232, 168, 60, .20) 0, transparent 70%),
    radial-gradient(70% 70% at 70% 100%, rgba(70, 100, 210, .26) 0, transparent 70%),
    radial-gradient(55% 55% at 0% 100%, rgba(190, 90, 130, .18) 0, transparent 70%),
    linear-gradient(160deg, #0b0e0c 0%, #101214 55%, #13121a 100%);
  --glass: rgba(255, 255, 255, .06);
  --glass-strong: rgba(14, 16, 15, .70);
  --glass-border: rgba(255, 255, 255, .13);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .12);
  --pop: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #96948d;
  --border: rgba(255, 255, 255, .20);
  --hairline: rgba(255, 255, 255, .10);
  --grid: #2c2c2a;
  --axis: #383835;
  --shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 12px 40px rgba(0, 0, 0, .45);
  --good: #0ca30c;
  --bad: #e66767;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --brand: #3f8a68;
    --accent: #e8b84a;
    --field:
      radial-gradient(70% 60% at 0% 0%, rgba(40, 140, 100, .34) 0, transparent 70%),
      radial-gradient(60% 60% at 100% 0%, rgba(232, 168, 60, .20) 0, transparent 70%),
      radial-gradient(70% 70% at 70% 100%, rgba(70, 100, 210, .26) 0, transparent 70%),
      radial-gradient(55% 55% at 0% 100%, rgba(190, 90, 130, .18) 0, transparent 70%),
      linear-gradient(160deg, #0b0e0c 0%, #101214 55%, #13121a 100%);
    --glass: rgba(255, 255, 255, .06);
    --glass-strong: rgba(14, 16, 15, .70);
    --glass-border: rgba(255, 255, 255, .13);
    --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .12);
    --pop: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #96948d;
    --border: rgba(255, 255, 255, .20);
    --hairline: rgba(255, 255, 255, .10);
    --grid: #2c2c2a;
    --axis: #383835;
    --shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 12px 40px rgba(0, 0, 0, .45);
    --good: #0ca30c;
    --bad: #e66767;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--field); background-attachment: fixed; background-color: #eeece6; }
:root[data-theme="dark"] { background-color: #0c0d0c; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { background-color: #0c0d0c; } }
body { margin: 0; min-height: 100vh; background: transparent; color: var(--text-primary); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
h2 { font: 600 16px/1.25 var(--display); margin: 0; letter-spacing: -.005em; }
h3 { font: 600 17px/1.25 var(--display); margin: 0; }

/* Demo strip */
.demo-bar {
  display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 8px max(16px, calc((100% - 1384px) / 2 + 8px)); font-size: 13px;
  background: var(--brand); color: #fff;
}
.demo-bar a { color: #f3d27f; font-weight: 600; text-decoration: none; white-space: nowrap; }
.demo-bar a:hover { text-decoration: underline; }

/* Glass */
.card, .head-shell {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-hi), var(--shadow);
}
.head-shell {
  position: sticky; top: 10px; z-index: 6; border-radius: 22px; background: var(--glass-strong);
  max-width: 1384px; margin: 12px max(16px, calc((100% - 1384px) / 2)) 0;
}
.topbar { display: flex; align-items: center; gap: 18px; padding: 10px 12px 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand img { border-radius: 9px; }
.brand-name { font: 700 15px/1.1 var(--display); letter-spacing: -.01em; }
/* The brand block is the page's h1; it keeps the two-line brand look. */
.brand-title { margin: 0; font: inherit; }
.brand-title span { display: block; }
.brand-sub { font-size: 12px; color: var(--text-muted); }
.tabs {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin: 0 auto; border-radius: 999px;
  background: rgba(30, 30, 20, .07); box-shadow: inset 0 1px 2px rgba(30, 30, 20, .07);
}
:root[data-theme="dark"] .tabs { background: rgba(0, 0, 0, .32); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .tabs { background: rgba(0, 0, 0, .32); } }
.tabs button {
  border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  color: var(--text-secondary); font-weight: 500; white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.tabs button:hover { background: rgba(255, 255, 255, .55); color: var(--text-primary); }
:root[data-theme="dark"] .tabs button:hover { background: rgba(255, 255, 255, .08); }
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); box-shadow: 0 4px 14px rgba(31, 77, 58, .25); }
.pill-new { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 6px; background: var(--accent); color: #111; margin-left: 2px; vertical-align: 1px; }
.top-actions { display: flex; gap: 6px; flex: 0 0 auto; }
button.ghost {
  border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 6px 12px;
  cursor: pointer; font-size: 13px; color: var(--text-secondary);
}
button.ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }
button.ghost.icon { padding: 6px 10px; }
button.ghost[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
button.primary { border: 0; background: var(--brand); color: #fff; border-radius: 999px; padding: 9px 18px; font-weight: 600; cursor: pointer; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 10px 20px 12px; border-top: 1px solid var(--glass-border); }
.field { display: flex; flex-direction: column; gap: 3px; }
.field > span { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
select, input[type="date"], input[type="search"], input[type="text"] {
  border: 1px solid var(--border); background: var(--pop); border-radius: 10px; padding: 6px 10px; min-height: 34px;
}
.custom-only { display: none; }
body.custom .custom-only { display: flex; }
.status { margin-left: auto; font-size: 12px; color: var(--text-muted); }

main { max-width: 1384px; margin: 16px auto 0; padding: 0 16px; }
.panel { display: flex; flex-direction: column; gap: 16px; }
.panel[hidden], [hidden] { display: none !important; }
.card { border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.card-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .tabs { margin: 0; } .topbar { flex-wrap: wrap; } .head-shell { position: static; } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.kpi {
  position: relative; text-align: left; border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .45); padding: 12px 14px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
:root[data-theme="dark"] .kpi { background: rgba(255, 255, 255, .04); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .kpi { background: rgba(255, 255, 255, .04); } }
.kpi:hover, .kpi:focus-visible { transform: translateY(-1px); border-color: var(--border); box-shadow: 0 6px 20px rgba(0, 0, 0, .08); outline: none; }
.kpi .k-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; display: flex; justify-content: space-between; gap: 6px; }
.kpi .k-src { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .k-value { font: 600 22px/1.2 var(--display); letter-spacing: -.01em; }
.kpi .k-delta { font-size: 12px; font-weight: 600; }
.kpi .k-delta .cmpv { color: var(--text-muted); font-weight: 400; }
.k-delta.good { color: var(--good); }
.k-delta.bad { color: var(--bad); }
.k-delta.flat { color: var(--text-muted); }
.kpi svg { width: 100%; height: 30px; margin-top: 4px; }
.kpi svg .cur { fill: none; stroke: var(--s1); stroke-width: 1.6; }
.kpi svg .prev { fill: none; stroke: var(--cmp); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .7; }

/* Insights */
.insights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.insights li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--hairline); font-size: 13.5px; }
.insights li .ic { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.insights li.up .ic { background: var(--ok-bg); color: var(--good); }
.insights li.down .ic { background: var(--crit-bg); color: var(--bad); }
.insights li.watch .ic { background: var(--warn-bg); color: #8a5a00; }
:root[data-theme="dark"] .insights li.watch .ic { color: #fab219; }
.insights li b { font-weight: 600; }
.insights li .src { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Charts */
.chart-wrap { position: relative; height: 320px; }
.chart-wrap.short { height: 260px; }
.chart-wrap .data-table { position: absolute; inset: 0; overflow: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; }
.legend i.dash { height: 0; border-top: 2px dashed var(--cmp); border-radius: 0; background: none !important; }

/* Tables */
.table-scroll { overflow: auto; max-height: 520px; border-radius: 12px; }
table { width: 100%; background: var(--pop); border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--pop); z-index: 1; }
thead th { position: sticky; top: 0; background: var(--pop); z-index: 2; font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; cursor: pointer; user-select: none; }
thead th:first-child { z-index: 3; }
thead th.sorted::after { content: " ↓"; }
thead th.sorted.asc::after { content: " ↑"; }
tbody tr:hover td { background: rgba(42, 120, 214, .06); }
tbody tr:hover td:first-child { background: var(--pop); }
td .sub { display: block; font-size: 11.5px; color: var(--text-muted); }
td.left, th.left { text-align: left; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.tag.ok { background: var(--ok-bg); color: var(--good); }
.tag.warn { background: var(--warn-bg); color: #8a5a00; }
.tag.crit { background: var(--crit-bg); color: var(--bad); }
:root[data-theme="dark"] .tag.warn { color: #fab219; }
tr.total td { font-weight: 600; border-top: 1px solid var(--border); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

/* Merchant Center status */
.mc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.mc-grid div { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 12px; }
.mc-grid b { display: block; font: 600 22px/1.2 var(--display); }
.mc-grid span { font-size: 12px; color: var(--text-secondary); }
.mc-issues { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mc-issues li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hairline); }

/* Ask */
.ask-card { min-height: 560px; display: flex; flex-direction: column; }
.ask-log { flex: 1; display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.ask-empty { color: var(--text-muted); font-size: 14px; padding: 24px 0 8px; }
.msg { max-width: 860px; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 16px 16px 4px 16px; }
.msg.bot { align-self: flex-start; border: 1px solid var(--hairline); background: rgba(255, 255, 255, .5); padding: 14px 16px; border-radius: 16px 16px 16px 4px; width: 100%; }
:root[data-theme="dark"] .msg.bot { background: rgba(255, 255, 255, .04); }
.msg.bot p { margin: 0 0 8px; }
.msg.bot p:last-child { margin-bottom: 0; }
.msg .steps { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; font-family: ui-monospace, Consolas, monospace; }
.msg .steps div::before { content: "› "; }
.msg .chart-wrap { height: 240px; margin: 10px 0; }
.msg details { margin-top: 10px; font-size: 12px; }
.msg details pre { white-space: pre-wrap; background: var(--pop); border: 1px solid var(--hairline); border-radius: 10px; padding: 10px; font-size: 12px; overflow: auto; }
.msg .meta { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ask-chips button { border: 1px solid var(--border); background: var(--pop); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: 13px; text-align: left; }
.ask-chips button:hover { border-color: var(--brand); }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-height: 42px; border-radius: 999px; padding: 8px 16px; }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Dialogs */
.dlg { border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 20px 22px; width: min(920px, calc(100% - 32px)); background: var(--pop); color: var(--text-primary); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.dlg.wide { width: min(1100px, calc(100% - 32px)); }
.dlg::backdrop { background: rgba(10, 12, 10, .35); backdrop-filter: blur(4px); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg-sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 14px; }

.foot { max-width: 1384px; margin: 22px auto 30px; padding: 0 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.foot a { color: var(--brand); font-weight: 600; text-decoration: none; }
:root[data-theme="dark"] .foot a { color: var(--accent); }

/* In-tab filter rows (Paid Media, Email, Inventory) */
.subfilters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 12px 14px; margin: -2px 0 12px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .35); }
:root[data-theme="dark"] .subfilters { background: rgba(255, 255, 255, .03); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .subfilters { background: rgba(255, 255, 255, .03); } }
.subfilters input[type="search"] { min-width: 220px; }
.subfilters button.ghost { min-height: 34px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px; }
.chip i { width: 9px; height: 9px; border-radius: 3px; opacity: .35; }
.chip[aria-pressed="true"] { background: var(--pop); color: var(--text-primary); border-color: var(--text-muted); }
.chip[aria-pressed="true"] i { opacity: 1; }
.chip:hover { border-color: var(--text-muted); }
.attr-note { margin: -4px 0 12px; font-size: 12.5px; color: var(--text-secondary); }
.attr-note:empty { display: none; }
.attr-note b { font-weight: 600; color: var(--text-primary); }
label.mini { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
label.mini .sw { margin: 0; width: 12px; height: 3px; border-radius: 2px; }
.sw-a { background: var(--s1); }
.sw-b { background: var(--s2); }
.kpi.static { cursor: default; }
.kpi.static:hover { transform: none; box-shadow: none; border-color: var(--hairline); }
.kpi .k-sub { font-size: 12px; color: var(--text-muted); }

/* Inventory cards (product × colour; one cell per variant) */
:root {
  --inv-out: #d93a3a; --inv-out-ink: #ffffff;
  --inv-critical: #f4b0aa; --inv-critical-ink: #6b1414;
  --inv-low: #f9d68a; --inv-low-ink: #5c4000;
  --inv-ok: #d3ebd8; --inv-ok-ink: #1d4a2a;
  --inv-slow: #ececeb; --inv-slow-ink: #7b7b7b;
  --inv-inc: #2a78d6;
}
:root[data-theme="dark"] {
  --inv-out: #c23a3a; --inv-critical: rgba(255, 120, 120, .30); --inv-critical-ink: #ffd4d0; --inv-low: rgba(245, 193, 90, .30); --inv-low-ink: #ffe3a3;
  --inv-ok: rgba(70, 200, 130, .26); --inv-ok-ink: #bfe6c9; --inv-slow: rgba(255, 255, 255, .10); --inv-slow-ink: #9a9a9a; --inv-inc: #6aa8f0;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --inv-out: #c23a3a; --inv-critical: rgba(255, 120, 120, .30); --inv-critical-ink: #ffd4d0; --inv-low: rgba(245, 193, 90, .30); --inv-low-ink: #ffe3a3;
    --inv-ok: rgba(70, 200, 130, .26); --inv-ok-ink: #bfe6c9; --inv-slow: rgba(255, 255, 255, .10); --inv-slow-ink: #9a9a9a; --inv-inc: #6aa8f0;
  }
}
.s-out { background: var(--inv-out); color: var(--inv-out-ink); }
.s-critical { background: var(--inv-critical); color: var(--inv-critical-ink); }
.s-low { background: var(--inv-low); color: var(--inv-low-ink); }
.s-ok { background: var(--inv-ok); color: var(--inv-ok-ink); }
.s-slow, .s-none { background: var(--inv-slow); color: var(--inv-slow-ink); }
.inv-count { font-size: 12.5px; color: var(--text-muted); }
.inv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-secondary); margin: 0 0 14px; align-items: center; }
.inv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.inv-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; position: relative; }
.inv-legend .inc-key { background: none; border: 1px solid var(--border); }
.inv-legend .inc-key::after, .inv-cell .inc { content: ""; position: absolute; top: 0; right: 0; border: 4px solid transparent; border-top-color: var(--inv-inc); border-right-color: var(--inv-inc); }
.inv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
.inv-card { display: grid; grid-template-columns: 96px 1fr; border: 1px solid var(--hairline); border-radius: var(--radius-sm); overflow: hidden; background: rgba(255, 255, 255, .55); }
:root[data-theme="dark"] .inv-card { background: rgba(255, 255, 255, .04); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .inv-card { background: rgba(255, 255, 255, .04); } }
.inv-media { position: relative; min-height: 150px; background: linear-gradient(160deg, color-mix(in srgb, var(--sw) 78%, #fff) 0%, var(--sw) 100%); color: rgba(255, 255, 255, .78); display: grid; place-items: center; }
.inv-glyph { width: 56px; height: 56px; }
.inv-flag, .inv-ads { white-space: nowrap; position: absolute; left: 6px; padding: 3px 7px; border-radius: 999px; font: 600 10px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; }
.inv-flag { top: 6px; }
.inv-ads { bottom: 6px; background: rgba(0, 0, 0, .55); color: #fff; }
.inv-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.inv-title { font: 600 14px/1.25 var(--display); }
.inv-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: -4px; }
.inv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.inv-stats div { display: flex; flex-direction: column; }
.inv-stats b { font: 600 15px/1.2 var(--display); }
.inv-stats span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.inv-grid { border-collapse: separate; border-spacing: 3px; width: calc(100% + 6px); table-layout: fixed; margin: 0 -3px; background: none; font-size: 12px; }
.inv-grid th, .inv-grid td { position: static; border: 0; padding: 0; background: none; }
.inv-grid th { font: 500 10px/1 var(--font); color: var(--text-muted); padding: 2px 0; text-align: center; overflow: hidden; white-space: nowrap; text-transform: none; letter-spacing: 0; cursor: default; }
.inv-grid th.len { width: 14px; text-align: left; }
.inv-grid td.inv-cell { position: relative; height: 24px; text-align: center; border-radius: 4px; font: 600 12px/24px var(--font); font-variant-numeric: tabular-nums; cursor: default; overflow: hidden; }
.inv-grid td.inv-cell.s-out { background: var(--inv-out); }
.inv-grid td.inv-cell.s-critical { background: var(--inv-critical); }
.inv-grid td.inv-cell.s-low { background: var(--inv-low); }
.inv-grid td.inv-cell.s-ok { background: var(--inv-ok); }
.inv-grid td.inv-cell.s-slow, .inv-grid td.inv-cell.s-none { background: var(--inv-slow); }
.inv-grid td.inv-cell.na { background: none; border: 1px dashed var(--hairline); }
.inv-grid tbody tr:hover td { background: inherit; }
.inv-foot { margin-top: auto; font-size: 12px; color: var(--text-secondary); }
.inv-pill { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
@media (max-width: 560px) { .inv-cards { grid-template-columns: 1fr; } .inv-card { grid-template-columns: 76px 1fr; } .subfilters input[type="search"] { min-width: 0; width: 100%; } }

@media print {
  .inv-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .inv-cell, .inv-pill, .inv-flag, .inv-legend i, .inv-media { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .subfilters { display: none; }
  .demo-bar, .filters .status, .top-actions, .tabs, .ask-form, .ask-chips, .card-tools, .table-toggle { display: none !important; }
  .head-shell { position: static; }
  html { background: #fff; }
  .card, .head-shell { backdrop-filter: none; box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .table-scroll { max-height: none; overflow: visible; }
}

/* Budget pacing */
.pace-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pace-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); }
.pace-tile span { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.pace-tile b { font: 600 22px/1.2 var(--display); }
.pace-tile small { font-size: 12px; color: var(--text-muted); }
.pace-tile.over small { color: var(--bad); font-weight: 600; }
.pace-tile.under small { color: #8a5a00; font-weight: 600; }
.pace-tile.ok small { color: var(--good); font-weight: 600; }
:root[data-theme="dark"] .pace-tile.under small { color: #fab219; }
.pace-table { margin-top: 14px; max-height: 360px; }

/* Tab-specific filters sit in the header's filter row and wrap with it. */
.tab-filters { display: contents; }
.filters .chip { min-height: 34px; padding: 5px 11px; }
