/* TD CAPI Gateway — admin console. Promoted from the approved console design, wired to /admin/*. */
:root {
  --bg: #f2f1f6;
  --panel: #ffffff;
  --panel-2: #f7f6fa;
  --ink: #000000;
  --muted: #55525f;
  --faint: #8a8794;
  --line: #ddd9e6;
  --accent: #6b5fa6;
  --accent-ink: #ffffff;
  --accent-soft: #6b5fa61f;
  --ok: #2f8f4e;
  --warn: #b07d12;
  --bad: #c2464d;
  --radius: 12px;
  --shadow: 0 1px 2px #0000000a, 0 6px 20px #00000012;
  color-scheme: light;
}
:root[data-theme="light"] {
  --bg: #f2f1f6; --panel: #ffffff; --panel-2: #f7f6fa; --ink: #000000; --muted: #55525f;
  --faint: #8a8794; --line: #ddd9e6; --accent: #6b5fa6; --accent-ink: #ffffff; --accent-soft: #6b5fa61f;
  --ok: #2f8f4e; --warn: #b07d12; --bad: #c2464d; --shadow: 0 1px 2px #0000000a, 0 6px 20px #00000012;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --panel: #0e0e13; --panel-2: #08080c; --ink: #ffffff; --muted: #a29fb0;
    --faint: #6f6c7d; --line: #26242f; --accent: #d8d2e6; --accent-ink: #000000; --accent-soft: #d8d2e622;
    --ok: #4fb86f; --warn: #e0a53a; --bad: #d16c6c; --shadow: 0 1px 2px #000a, 0 8px 26px #000c;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.ico { width: 1.05em; height: 1.05em; display: inline-block; vertical-align: -0.16em; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.wordmark { display: flex; align-items: center; gap: 0.6rem; }
.wordmark .glyph { color: var(--accent); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); }
.wordmark b { font-size: 15px; letter-spacing: 0.2px; }
.wordmark .eyebrow { display: block; line-height: 1; margin-bottom: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }
/* margin-right:auto pushes everything else to the far side, so the most-used control and the
   destructive one cannot be mis-clicked for each other. */
.topbar-nav { margin-right: auto; margin-left: 1.2rem; }

/* Client card metrics — health at a glance, so the fleet view answers "who is broken" without
   opening each client. */
.ccard-metrics { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; margin-top: 0.15rem; }
.ccard-metrics .mq { flex: 1 1 auto; min-width: 96px; }
.ccard-metrics .mq .bar { flex: 1 1 auto; width: auto; }
.status-chip { font-size: 11px; font-weight: 700; padding: 0.16rem 0.45rem; border-radius: 6px; white-space: nowrap; }
.status-chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.status-chip.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.status-chip.idle { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); }
/* Failures below the attention rate: reported, not alarming. Red is reserved for "go look at this". */
.status-chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
/* Purchases carry the accent because they are the one number on this card an agency looks for. */
/* Fleet card history line: last purchase · total events · days of data. Full width under the chips. */
.ccard-history { flex: 1 1 100%; display: flex; flex-direction: column; gap: 0.1rem; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ccard-history b { color: var(--ink); font-weight: 700; }
.ccard-history .none { color: var(--warn); font-weight: 600; }
.buy-chip { font-size: 11px; font-weight: 700; padding: 0.16rem 0.45rem; border-radius: 6px; white-space: nowrap; background: var(--accent-soft); color: var(--accent); }
.conn-form { display: flex; align-items: center; gap: 0.5rem; }
.conn-form input { font: inherit; font-size: 12.5px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.6rem; }
.conn-form input#adminToken { width: 190px; }
.conn-form input#baseUrl { width: 210px; }
.conn-pill { font-size: 11px; font-weight: 700; padding: 0.28rem 0.6rem; border-radius: 999px; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); letter-spacing: 0.02em; }
.conn-pill.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: var(--ink); border-color: var(--accent); }

/* Shell */
.shell { max-width: 1160px; margin: 0 auto; padding: 1.1rem 1.25rem 3rem; }
.gate { max-width: 460px; margin: 12vh auto; text-align: center; padding: 0 1.2rem; }
.gate .glyph { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 1.1rem; }
.gate h1 { font-size: 1.3rem; margin: 0 0 0.4rem; }
.gate p { color: var(--muted); margin: 0 0 1.4rem; }
.gate .form { display: flex; flex-direction: column; gap: 0.6rem; text-align: left; }

/* Summary strip */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-bottom: 1.1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 1rem; box-shadow: var(--shadow); }
.tile .eyebrow { margin-bottom: 0.5rem; }
.tile .value { font-size: 1.7rem; font-weight: 680; letter-spacing: -0.02em; line-height: 1; }
.tile .value small { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 0.4rem; display: flex; align-items: center; gap: 0.35rem; }
.meter { height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; margin-top: 0.55rem; }
/* A tile can now show the bar AND its caption; tighten the gap so they read as one unit. */
.tile .meter + .sub { margin-top: 0.35rem; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.5s ease; }

/* Layout */
/* Single column — the clients sidebar was removed; the cards view owns navigation. */
.layout { display: block; }
@media (max-width: 780px) { .summary { grid-template-columns: repeat(2, 1fr); } .conn-form input#baseUrl { display: none; } }

.rail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--line); }
.rail-head .eyebrow { font-size: 11px; }
.add-btn { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 12px; font-weight: 600; color: var(--accent); background: transparent; border: 0; cursor: pointer; padding: 0.25rem 0.35rem; border-radius: 6px; }
.add-btn:hover { background: var(--accent-soft); }
.clients { list-style: none; margin: 0; padding: 0.4rem; display: flex; flex-direction: column; gap: 2px; }
.client { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem; padding: 0.55rem 0.6rem; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.client:hover { background: var(--panel-2); }
.client.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.dot { width: 9px; height: 9px; border-radius: 99px; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.dot.live { color: var(--ok); background: var(--ok); }
.dot.dry { color: var(--warn); background: var(--warn); }
.dot.dns, .dot.nodataset { color: var(--faint); background: var(--faint); }
.client .name { min-width: 0; }
.client .name b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client .name .plat { font-size: 11px; color: var(--muted); }
/* nowrap + flex:none — "AWAITING DNS" broke onto two lines beside a long hostname, which made the
   card taller than its neighbours and read as a layout fault rather than a status. */
.chip { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.15rem 0.4rem; border-radius: 5px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--muted); white-space: nowrap; flex: none; }
.rail-empty { padding: 1.2rem 0.85rem; color: var(--muted); font-size: 12.5px; text-align: center; }

/* Detail column */
.detail { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line); }
.card > header h2 { margin: 0; font-size: 13px; font-weight: 680; letter-spacing: 0.01em; display: flex; align-items: center; gap: 0.5rem; }
.card > header h2 .ico { color: var(--accent); }
.card .body { padding: 1.1rem; }

label.field { display: flex; flex-direction: column; gap: 0.35rem; }
label.field .eyebrow { color: var(--muted); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.grid .full { grid-column: 1 / -1; }
/* EVERY text-like input type. The list used to name three, so an <input type="email"> (the users
   editor) rendered with the browser's own grey box and square corners in dark mode — twice. A type
   missing here is a test failure now (test/console-inputs.mjs), not a screenshot. */
input[type="text"], input[type="url"], input[type="password"], input[type="email"], input[type="number"], input[type="search"], input[type="tel"], select {
  font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.55rem 0.7rem; width: 100%;
}
input.mono { font-size: 13px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
input::placeholder { color: var(--faint); }

fieldset.dests { border: 1px solid var(--line); border-radius: 9px; margin: 0; padding: 0.7rem 0.85rem; display: flex; gap: 1.3rem; flex-wrap: wrap; }
fieldset.dests legend { padding: 0 0.4rem; }
fieldset.shield { border: 1px solid var(--line); border-radius: 9px; padding: 0.75rem 0.9rem; display: grid; gap: 0.7rem; }
fieldset.shield legend { padding: 0 0.4rem; }
fieldset.shield .field-inline { display: flex; align-items: center; gap: 0.6rem; }
fieldset.shield .field-inline span { font-size: 13px; color: var(--muted); min-width: 84px; }
fieldset.shield select, fieldset.shield input { max-width: 340px; }
fieldset.params { border: 1px solid var(--line); border-radius: 9px; padding: 0.75rem 0.9rem; }
fieldset.params legend { padding: 0 0.4rem; }
.param-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.4rem 0.9rem; }
.param-grid label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 13px; }
/* Credential panels reveal when their destination is ticked. They read as belonging to that
   checkbox — accent rail, tinted ground — rather than as one more neutral box in the stack. */
fieldset.creds {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 9px;
  background: var(--panel-2); padding: 0.85rem 1rem 0.9rem; margin: 0;
  display: grid; gap: 0.6rem 0.9rem; grid-template-columns: minmax(96px, 132px) minmax(0, 1fr);
}
fieldset.creds legend {
  grid-column: 1 / -1; padding: 0 0.4rem; color: var(--accent);
  font-weight: 600; letter-spacing: 0.06em;
}
/* A two-child LABEL (span + control) becomes two grid cells, so every field lines up on one axis.
   `display: contents` only works when the child count matches the column count — a row with a
   label, a status and a button emits THREE cells, spilling into the next row and shifting every
   field after it out of alignment. Those rows are DIVs and lay themselves out with flex instead. */
fieldset.creds label.field-inline { display: contents; }
fieldset.creds label.field-inline > span {
  font-size: 13px; color: var(--muted); align-self: center;
  line-height: 1.3; min-width: 0;
}
fieldset.creds label.field-inline input, fieldset.creds label.field-inline select { max-width: 360px; width: 100%; }
fieldset.creds label.field-inline .combo { max-width: 360px; width: 100%; }
/* Searchable-select widget (GA4 property / Ads account): click the field → panel with a search box on
   top and a live-filtered list below. The picked value lives on the root's dataset.value (see app.js). */
.combo { position: relative; }
.combo-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font: inherit; font-size: 13px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.42rem 0.6rem; cursor: pointer; text-align: left; }
.combo-trigger:hover:not(:disabled), .combo.open .combo-trigger { border-color: var(--accent); }
.combo-trigger:disabled { cursor: default; opacity: 0.65; }
.combo-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-label.placeholder { color: var(--faint); }
.combo-caret { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.combo-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 0.4rem; display: flex; flex-direction: column; gap: 0.35rem; }
.combo-search { font: inherit; font-size: 13px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 0.4rem 0.55rem; width: 100%; }
.combo-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; }
.combo-opt { padding: 20px 3px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-opt:hover, .combo-opt.active { background: var(--accent-soft); }
.combo-empty { padding: 0.5rem 0.55rem; font-size: 12.5px; color: var(--muted); }

fieldset.creds div.field-inline {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
}
fieldset.creds div.field-inline > span:first-child {
  flex: 0 0 auto; width: 96px; font-size: 13px; color: var(--muted);
}
fieldset.creds div.field-inline .conn-state { flex: 1 1 auto; min-width: 0; }
fieldset.creds div.field-inline .btn { flex: 0 0 auto; }

fieldset.creds > .check, fieldset.creds > .hint, fieldset.creds > p { grid-column: 1 / -1; }
fieldset.creds .hint {
  font-size: 12px; color: var(--muted); margin: 0.15rem 0 0;
  padding-top: 0.6rem; border-top: 1px dashed var(--line); line-height: 1.5;
}
fieldset.creds .hint b { color: var(--ink); font-weight: 600; }
fieldset.creds .hint code { font-size: 11.5px; }
/* The panel is injected by a `hidden` toggle, so this runs exactly when it becomes visible. */
fieldset.creds:not([hidden]) { animation: credsIn 160ms ease-out; }
@keyframes credsIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { fieldset.creds:not([hidden]) { animation: none; } }
/* Narrow: stop forcing a label column that squeezes the input. */
@media (max-width: 560px) {
  fieldset.creds { grid-template-columns: 1fr; gap: 0.3rem; }
  fieldset.creds .field-inline span { margin-top: 0.4rem; }
}
.check { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 13px; cursor: pointer; }
.check.dis { color: var(--faint); cursor: not-allowed; }
.check.dis em { font-style: normal; font-size: 11px; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.row-actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 1.05rem; }
.conn-state { font-size: 13px; color: var(--muted); }
.conn-state.on { color: var(--ok); }

/* white-space: nowrap — a button label must never wrap. Without it a flex row that runs short on
   space breaks "Send test event" across three lines instead of the row wrapping, which reads as a
   broken control rather than a tight fit. */
.btn { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 0.55rem 0.95rem; display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); margin-left: auto; }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: var(--bad); }

.status-line { display: flex; align-items: center; gap: 0.5rem; font-size: 12.5px; color: var(--muted); margin-bottom: 0.8rem; }
.snip { display: flex; gap: 0.5rem; margin: 0.5rem 0; }
.snip .code { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.75rem; font-size: 12.5px; overflow-x: auto; white-space: pre; }
.snip .code.wrap { white-space: pre-wrap; word-break: break-word; overflow-x: hidden; } /* instruction text wraps instead of scrolling */
.copy { flex: none; }
.tab-note { font-size: 12.5px; color: var(--muted); margin-top: 0.7rem; }
.tab-note a { color: var(--accent); font-weight: 600; }
.hint { font-size: 12.5px; color: var(--muted); }

.verify-out { position: relative; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 0.8rem; font-size: 12px; overflow-x: auto; margin-bottom: 0.9rem; white-space: pre-wrap; }
.verify-close { position: absolute; top: 0.35rem; right: 0.4rem; background: transparent; border: 0; color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 5px; border-radius: 6px; }
.verify-close:hover { color: var(--ink); background: var(--panel); }
.verify-msg { display: block; padding-right: 1.4rem; }
.pause-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0.9rem; margin-bottom: 1rem; border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--ok) 7%, var(--panel-2)); }
.pause-panel.is-paused { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 10%, var(--panel-2)); }
.pause-state { display: flex; align-items: center; gap: 0.6rem; }
.pause-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.pause-panel.is-paused .pause-dot { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 30%, transparent); }
.pause-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.pause-panel.is-paused .pause-title { color: var(--bad); }
.pause-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.pause-panel .btn { flex: none; margin-left: 0; }
.table-wrap { overflow-x: auto; }
table.events { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.events th, table.events td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.events th { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
table.events tr:last-child td { border-bottom: 0; }
.ev-name { font-weight: 600; }
.dest-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 11px; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 6px; }
.dest-badge.live { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.dest-badge.dry { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.dest-badge.fail { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.mq { display: flex; align-items: center; gap: 0.5rem; }
.mq .bar { width: 74px; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.mq .bar > span { display: block; height: 100%; border-radius: 99px; }
.mq .pct { font-size: 12px; font-weight: 600; width: 30px; }
.empty { text-align: center; color: var(--muted); padding: 1.4rem !important; }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(1.5rem); background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 600; padding: 0.6rem 1rem; border-radius: 9px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; display: flex; align-items: center; gap: 0.45rem; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.powered { display: flex; align-items: center; justify-content: center; gap: 0.65rem; padding: 0.85rem 1rem; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.powered .pb-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.powered .anna-mark { display: inline-flex; align-items: center; gap: 0.42rem; font-size: 13.5px; font-weight: 680; letter-spacing: -0.01em; color: var(--ink); }
.powered .anna-mark .logo { width: 19px; height: 19px; color: var(--accent); }
.powered .pb-dot { width: 3px; height: 3px; border-radius: 99px; background: var(--faint); opacity: 0.55; }

/* White-label (per-tenant): a client whose config sets `whiteLabel` hides the TD wordmark logo,
   the "Transparent eCom" eyebrow and the "Powered by" footer while its detail view is open — the
   neutral "CAPI Gateway" wordmark stays. Applied to <body> by applyBrand(); the fleet view clears it. */
body.white-label .wordmark .glyph,
body.white-label .wordmark .eyebrow,
body.white-label .powered { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Domain-shielding warning: mask misrepresents the event source to Meta, so the caution has to be
   visible at the moment the option is chosen, not buried in a doc nobody opens. */
.shield .warn-note {
  grid-column: 1 / -1;
  border-left: 3px solid var(--warn);
  padding: 0.5rem 0 0.5rem 0.7rem;
  margin: 0.2rem 0 0;
  line-height: 1.5;
}
.shield .warn-note b { color: var(--warn); }
.shield .warn-note code { font-size: 11.5px; }

/* Event feed: paged, and every refusal states its reason inline. */
.pager { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1.1rem 0.9rem; border-top: 1px solid var(--line); }
.pager .pager-at { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dest-why { font-size: 11.5px; color: var(--bad); margin-top: 0.25rem; line-height: 1.35; max-width: 34ch; }
.mq-missing { font-size: 11px; color: var(--warn); margin-top: 0.25rem; }
.mq-missing.ok { color: var(--faint); }
/* Event counts strip — totals for the selected window, above the raw feed. Wraps rather than
   scrolls: a tenant firing eight event names must not push the delivered/failed tiles off-screen. */
.ev-counts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem; }
.ev-counts:empty { display: none; }
/* flex-grow 0, deliberately: with grow:1 a lone tile on the last row stretches the full width and
   reads as a different kind of thing than the tiles above it. Content-sized and ragged is correct. */
.ev-count { flex: 0 1 auto; min-width: 92px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 0.5rem 0.7rem; }
.ev-count .n { font-size: 18px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ev-count .k { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin-top: 0.15rem; }
.ev-count.total { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.ev-count.total .n { color: var(--accent); }
.ev-count.ok .n { color: var(--ok); }
.ev-count.fail .n { color: var(--bad); }
.ev-count.bot .n { color: var(--warn); }
.ev-window { width: 100%; font-size: 11.5px; color: var(--muted); margin: 0.15rem 0 0; }
/* Per-destination counter rows (data-driven from day.dest): one line per destination that recorded an event. */
.dest-counts { flex: 1 1 100%; margin-top: 0.3rem; border-top: 1px solid var(--line); padding-top: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.dest-head { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.dest-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; font-size: 12.5px; }
.dest-name { font-weight: 700; color: var(--ink); min-width: 84px; }
.dest-nums { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.dest-nums b { color: var(--ok); font-weight: 700; }
.dest-bad { color: var(--bad); font-weight: 700; }
.btn.ghost.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.ghost.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }

/* Brand type — livetransparent.com pairs Anton (condensed display) with Helvetica Now.
   Neither is loaded from a CDN: an operator console should not depend on a third-party font
   request to render, so these are the closest universally-present stacks. */
.wordmark b, .tile .value, .gate h1, .card > header h2 {
  font-family: "Helvetica Now Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: -0.01em;
}
.wordmark b { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
body { font-family: "Helvetica Now Text", "Helvetica Neue", Helvetica, Arial, sans-serif; }

/* Clients landing — the fleet, not whichever client sorted first. */
.cards-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.cards-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.01em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 0.9rem; }
.ccard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0.95rem 1rem; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 0.55rem; font: inherit; color: inherit;
  transition: border-color .12s ease, transform .12s ease;
}
.ccard:hover { border-color: var(--accent); transform: translateY(-1px); }
.ccard-top { display: flex; align-items: center; gap: 0.5rem; }
.ccard-host { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.ccard-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.ccard-dests { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.ccard-empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 2.2rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }
/* Fleet filter row. The base rule gives every input/select width:100%, which would stack them, so each
   control is given its own basis here rather than being fought with a utility class. */
.cards-filter { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.cards-filter #fleetSearch { flex: 1 1 220px; max-width: 320px; width: auto; }
.cards-filter select { flex: 0 0 auto; width: auto; }
/* Custom date range beside a period select (fleet, Verify, Campaign learnings). */
.range { display: inline-flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.range input[type="date"] { width: auto; font: inherit; font-size: 12.5px; padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.range .rdash { color: var(--faint); }
.range .rapply { margin-top: 0; }
.fleet-count { margin-left: auto; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.backBtn { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Install collapses once a client is actually delivering — the steps matter during onboarding and
   become noise above a working feed. Never auto-collapsed while it is still failing. */
.card > header .hdr-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
/* `select` gets width:100% for FORM fields (app.css:121). In a card header that makes the select
   eat the whole row and squeeze the buttons beside it — which is what shrank "Send test event" to
   three lines. Header selects size to their content instead. */
.card > header select { width: auto; }
.card > header .btn, .card > header select { flex: none; }
#installCard.collapsed .body { display: none; }
#installCard.collapsed > header { border-bottom: 0; }
.install-live { font-size: 11.5px; color: var(--ok); font-weight: 600; }

/* ---- Star customer (Leafly) — per-dispensary breakdown ---- */
/* Pinned = operator key-account flag. Deliberately NOT the gold star treatment (that is the per-dispensary
   platform star): a small pin, no border change, so "important" and "multi-location" never look alike. */
.pin-badge { font-size: 12px; line-height: 1; margin-right: 0.15rem; }
.star-badge { color: #e0a500; font-size: 13px; line-height: 1; }
.ccard.star { border-color: color-mix(in srgb, #e0a500 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, #e0a500 22%, transparent) inset; }
/* Tracking-dropped tenant: red border so it stands out in the fleet at a glance (paired with the ⚠ chip). */
.ccard.alert { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--bad) 25%, transparent) inset; }
.alert-chip { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 11px; font-weight: 700; padding: 0.16rem 0.45rem; border-radius: 6px; white-space: nowrap; color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); }
/* Traffic sources: the journey-health strip and the per-source funnel table. */
.journey-health { display: flex; flex-wrap: wrap; gap: 0.45rem 1.2rem; margin-bottom: 0.9rem; font-size: 12.5px; color: var(--ink); }
.journey-health:empty { display: none; }
.jh-item b { font-variant-numeric: tabular-nums; }
.jh-item.ok b { color: var(--ok); }
.jh-item.warn b { color: var(--warn); }
.jh-item .muted, .muted { color: var(--muted); }
.jh-link { color: var(--accent); font-weight: 600; text-decoration: none; }
table.events td.num, table.events th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.funnel th:not(:first-child) { text-align: right; }
/* Conversions view: one chip per touch, oldest first, the closing touch emphasised. */
/* One line per journey: the wrap around the table scrolls sideways, so a long chain reads left to right
   instead of stacking chips with an orphaned arrow on a narrow screen. */
.journey { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.25rem; }
.tchip { font-size: 11px; padding: 0.15rem 0.45rem; border-radius: 6px; background: color-mix(in srgb, var(--ink) 6%, transparent); border: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.tchip.last { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); font-weight: 600; }
.tchip.direct { color: var(--muted); }
.tarrow { color: var(--faint); font-size: 11px; }
/* Reset / undo / rebuild row under Campaign learnings (operator-only). */
.attr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.6rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.attr-actions .btn { margin-top: 0; }
.attr-actions .btn.danger { margin-left: auto; }
.attr-reset-panel { flex: 1 1 100%; background: var(--panel-2); border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line)); border-radius: 9px; padding: 0.7rem 0.8rem; margin-top: 0.3rem; }
.attr-reset-panel .check { display: block; font-size: 12.5px; margin: 0.2rem 0; }
.btn.xs { font-size: 11px; padding: 0.22rem 0.5rem; }
.star-card { border: 1px solid color-mix(in srgb, #e0a500 30%, var(--line)); background: color-mix(in srgb, #e0a500 6%, var(--panel-2)); border-radius: 10px; padding: 0.7rem 0.8rem; margin-bottom: 0.9rem; }
.star-head { display: flex; align-items: center; gap: 0.45rem; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.star-head .star-sub { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }
.disp-rows { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.6rem; }
.disp-row { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; cursor: pointer; padding: 0.4rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.disp-row:hover { border-color: var(--accent); }
.disp-row.on { border-color: #e0a500; background: color-mix(in srgb, #e0a500 10%, var(--panel)); }
.disp-name { font-weight: 600; font-size: 12.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disp-metric { font-size: 11.5px; color: var(--muted); flex: none; }
.disp-metric b { color: var(--ink); }
.disp-metric.conv b { color: var(--accent); }
.btn.ghost.xs { font-size: 11px; padding: 0.22rem 0.5rem; margin-top: 0.55rem; }

/* ---- Console users (roster + editor) — grouped by role, icon actions, checkbox tenant picker ---- */
/* Two columns of user tiles (2026-09-15); a section header spans both. One column under 760px. */
.users-card { max-width: 1100px; }
.users-editor { margin-top: 0.9rem; }
.user-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.9rem; align-items: start; }
.user-section { grid-column: 1 / -1; padding: 0.5rem 0.2rem 0.1rem; font-size: 10.5px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--faint); border-top: 1px solid var(--line); margin-top: 0.25rem; }
.user-list > .user-section:first-child { border-top: 0; margin-top: 0; }
.user-section .n { color: var(--muted); font-weight: 600; letter-spacing: 0.06em; }
.user-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); transition: background 0.12s, border-color 0.12s; min-width: 0; }
.user-row:hover { background: color-mix(in srgb, var(--accent) 5%, var(--panel-2)); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.user-login { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.user-login b { color: var(--ink); font-weight: 650; }
.user-login .never { color: var(--faint); }
@media (max-width: 760px) { .user-list { grid-template-columns: 1fr; } }
.user-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.user-avatar.admin { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); color: var(--accent); }
.user-avatar.client { background: color-mix(in srgb, var(--ink) 9%, var(--panel)); color: var(--muted); }
.user-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.12rem; }
.user-name { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 0.45rem; }
.user-email { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-tag { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.08rem 0.34rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.user-access { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }
.uscope-all { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.uscope-globe { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; opacity: 0.8; }
.uscope-cli { font-size: 11.5px; font-weight: 600; padding: 0.22rem 0.55rem; border-radius: 7px; background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--ink); white-space: nowrap; }
.uscope-more { font-size: 11px; color: var(--muted); }
.uscope-none { font-size: 11.5px; color: var(--faint); }
.user-actions { flex: none; display: flex; gap: 0.25rem; margin-left: 0.5rem; }
.uic { width: 31px; height: 31px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: all 0.12s; }
.uic:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); border-color: color-mix(in srgb, var(--ink) 20%, transparent); }
.uic.del:hover:not(:disabled) { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.uic:disabled { opacity: 0.28; cursor: not-allowed; }
.uic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.user-empty { padding: 1.4rem 0.2rem; color: var(--muted); font-size: 13px; text-align: center; }
.user-form-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.7rem; }
.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.user-form-grid .full { grid-column: 1 / -1; }
/* Tenant (client-access) picker — tap-to-toggle chips instead of a ctrl-click multi-select. */
.tenant-pick { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.1rem 0 0; }
.tenant-opt { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 12.5px; padding: 0.32rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--panel-2); user-select: none; transition: border-color 0.12s, background 0.12s, color 0.12s; }
.tenant-opt:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.tenant-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tenant-opt input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; flex: none; }
.tenant-empty { font-size: 12.5px; color: var(--muted); }
@media (max-width: 560px) {
  .user-row { flex-wrap: wrap; }
  .user-access { width: 100%; justify-content: flex-start; margin-left: 55px; }
  .user-actions { margin-left: auto; }
  .user-form-grid { grid-template-columns: 1fr; }
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); background: transparent; }

/* ---- Backup Meta pixels (config) + per-pixel delivery (feed) ---- */
.xpix-list { display: flex; flex-direction: column; gap: 0.4rem; }
/* Match the parent form.grid (1fr 1fr, 0.9rem gap) so pixel↔pixel and token↔token line up with the
   primary Meta pixel / Access token above. The remove-✕ OVERLAYS the token's right end (hence the
   token's padding-right) instead of taking a column that would shrink both fields and break the line-up. */
.xpix-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; align-items: center; position: relative; }
.xpix-row input { min-width: 0; width: 100%; }
.xpix-row input[data-xpix="token"] { padding-right: 2.3rem; }
.xpix-del { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; padding: 0; border: 0; background: transparent; color: var(--faint); border-radius: 6px; display: grid; place-items: center; font-size: 17px; line-height: 1; cursor: pointer; }
.xpix-del:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.dest-pixels { font-size: 10.5px; color: var(--muted); margin-top: 0.2rem; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; gap: 0 0.5rem; }
.dest-pixels .ok { color: var(--ok); }
.dest-pixels .bad { color: var(--bad); }
