/* SMS Dashboard design system.
   One file, no build step, no inline styles (strict CSP).
   Colour roles: series slots 1–5 = Google / Microsoft / Meta / LinkedIn / TikTok (dataviz
   palette validated for CVD and contrast in light and dark). Status colours
   are reserved for pacing and sync state and always ship with a text label.
   Themes: light and dark tokens; html[data-theme] forces one, otherwise the
   OS preference applies. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #f1f3f6;
  --ink: #0e1422;
  --ink-2: #414a5c;
  --muted: #697184;
  --faint: #656d7d; /* ≥4.5:1 on white: used for small text */
  --line: #e4e7ed;
  --line-2: #eef0f4;
  --axis: #c9ced8;
  --accent: #2552d0;
  --accent-2: #3464e0;
  --accent-ink: #1c43ad;
  --accent-wash: #eef3ff;
  --accent-line: #c9d7fb;
  --btn-primary: #2552d0; --btn-primary-hover: #3464e0;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #7c5cd6; --s5: #c2417a;
  --good: #0ca30c; --good-ink: #046c1b; --good-wash: #e9f7ec;
  --warn: #fab219; --warn-ink: #7a4f00; --warn-wash: #fdf4de;
  --crit: #d03b3b; --crit-ink: #a52525; --crit-wash: #fcecec;
  --side-bg: #0c111d; --side-ink: #c3c9d5; --side-muted: #7a8294; --side-hover: #151c2a; --side-active: #1c2537; --side-line: #1a2130;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 16px 40px -12px rgba(16, 24, 40, 0.22), 0 4px 10px -4px rgba(16, 24, 40, 0.08);
  --backdrop: rgba(10, 14, 22, 0.42);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 248px;
  --side-w-min: 72px;
  --topbar-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d14; --surface: #11161f; --surface-2: #151b26; --surface-3: #1a212e;
    --ink: #e9edf5; --ink-2: #b9c1d0; --muted: #8b94a6; --faint: #7d8699;
    --line: #232b3a; --line-2: #1b2230; --axis: #343d50;
    --accent: #4f7ff5; --accent-2: #6d95fa; --accent-ink: #9db8ff; --accent-wash: #16213a; --accent-line: #2a3d6b; --btn-primary: #2f5fe0; --btn-primary-hover: #3d6cf0;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #9479e8; --s5: #e0619a;
    --good-ink: #4cd07a; --good-wash: #10251a;
    --warn-ink: #f6c451; --warn-wash: #2b2312;
    --crit: #e66767; --crit-ink: #f19191; --crit-wash: #2f1719;
    --side-bg: #080b12; --side-hover: #121826; --side-active: #182033; --side-line: #151b27;
    --shadow-sm: none; --shadow: none;
    --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, 0.6);
    --backdrop: rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d14; --surface: #11161f; --surface-2: #151b26; --surface-3: #1a212e;
  --ink: #e9edf5; --ink-2: #b9c1d0; --muted: #8b94a6; --faint: #7d8699;
  --line: #232b3a; --line-2: #1b2230; --axis: #343d50;
  --accent: #4f7ff5; --accent-2: #6d95fa; --accent-ink: #9db8ff; --accent-wash: #16213a; --accent-line: #2a3d6b; --btn-primary: #2f5fe0; --btn-primary-hover: #3d6cf0;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #9479e8; --s5: #e0619a;
  --good-ink: #4cd07a; --good-wash: #10251a;
  --warn-ink: #f6c451; --warn-wash: #2b2312;
  --crit: #e66767; --crit-ink: #f19191; --crit-wash: #2f1719;
  --side-bg: #080b12; --side-hover: #121826; --side-active: #182033; --side-line: #151b27;
  --shadow-sm: none; --shadow: none;
  --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, 0.6);
  --backdrop: rgba(0, 0, 0, 0.6);
}

/* ── Base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
kbd { display: inline-block; min-width: 18px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--muted); font: 600 10.5px/1.5 var(--font); text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.ic.xs { width: 13px; height: 13px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-wash); color: var(--ink); }

/* ── Shell ──────────────────────────────────────────────────────────── */
body.side-collapsed { --side-w: var(--side-w-min); }
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side-bg) var(--side-w), transparent var(--side-w)); transition: grid-template-columns .18s ease; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  background: var(--side-bg); color: var(--side-ink); padding: 16px 12px; border-right: 1px solid var(--side-line); overflow: hidden;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 6px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .label { overflow: hidden; white-space: nowrap; }
.brand strong { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--side-muted); font-size: 11px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 9px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.brand-mark img { display: block; width: 24px; height: 24px; object-fit: contain; }
.side-toggle, .icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 8px; background: transparent; color: var(--side-muted); cursor: pointer; }
.side-toggle:hover { background: var(--side-hover); color: #fff; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-section { margin: 16px 10px 6px; color: var(--side-muted); font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.sidebar nav a { position: relative; display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; white-space: nowrap; }
.sidebar nav a .ic { color: var(--side-muted); }
.sidebar nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.sidebar nav a:hover .ic { color: #fff; }
.sidebar nav a.active { background: var(--side-active); color: #fff; }
.sidebar nav a.active .ic { color: #8fb0ff; }
.sidebar nav a.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #6d95fa; }
.sidebar nav a .label { overflow: hidden; }
.nav-badge { margin-left: auto; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; }
.side-foot { display: flex; flex-direction: column; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--side-line); }
.side-note { display: flex; align-items: center; gap: 7px; color: var(--side-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; }
.env-pill { display: inline-block; align-self: flex-start; padding: 2px 8px; border-radius: 999px; background: #3a2e10; color: #f6c451; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.env-pill .short { display: none; }
.demo-card .env-pill { background: var(--warn-wash); color: var(--warn-ink); vertical-align: 1px; }

body.side-collapsed .sidebar { padding: 16px 10px; }
body.side-collapsed .side-top { flex-direction: column; }
body.side-collapsed .brand .label,
body.side-collapsed .sidebar nav a .label,
body.side-collapsed .side-note { display: none; }
body.side-collapsed .nav-section { height: 1px; margin: 12px 8px; background: var(--side-line); }
body.side-collapsed .nav-section .label { display: none; }
body.side-collapsed .sidebar nav a { justify-content: center; padding: 0; }
body.side-collapsed .sidebar nav a.active::before { left: -10px; }
body.side-collapsed .nav-badge { position: absolute; top: 4px; right: 6px; min-width: 14px; height: 14px; font-size: 9px; padding: 0 3px; }
body.side-collapsed .side-toggle svg { transform: scaleX(-1); }
body.side-collapsed .side-foot { align-items: center; padding: 12px 0 4px; }
body.side-collapsed .env-pill { align-self: center; padding: 2px 6px; }
body.side-collapsed .env-pill .label { display: none; }
body.side-collapsed .env-pill .short { display: inline; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 16px; height: var(--topbar-h); padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.crumbs .ic { color: var(--faint); }
.tb-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.search-trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; min-width: 220px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.search-trigger:hover { border-color: var(--axis); color: var(--ink-2); }
.search-trigger kbd { margin-left: auto; }

/* Popovers built on <details> (account menu, data freshness). */
details.pop { position: relative; }
details.pop > summary { list-style: none; cursor: pointer; }
details.pop > summary::-webkit-details-marker { display: none; }
.freshness summary { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12.5px; white-space: nowrap; box-shadow: var(--shadow-sm); }
.freshness summary:hover { border-color: var(--axis); }
.freshness summary strong { color: var(--ink); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.ok { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: pop .14s ease-out;
}
.menu-head { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.menu-label { padding: 4px 10px 6px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line-2); }
.menu form { margin: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; background: none; color: var(--ink); font: inherit; border-radius: 8px; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-3); text-decoration: none; }
.menu-item .ic { color: var(--muted); }
.theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 6px 4px; padding: 3px; border-radius: 9px; background: var(--surface-3); }
.theme-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.theme-seg button:hover { color: var(--ink); }
.theme-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.asof { min-width: 320px; }
.asof-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; color: var(--ink-2); font-size: 13px; }
.asof-item strong { font-weight: 600; color: var(--ink); }
.asof-item.bad, .asof-item.bad strong { color: var(--crit-ink); }
.user-menu summary { display: flex; align-items: center; gap: 10px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.user-menu summary:hover { border-color: var(--axis); }
.user-menu .who { display: flex; flex-direction: column; line-height: 1.15; }
.user-menu .who strong { font-size: 13px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .who small { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }

.content { padding: 24px 32px 12px; display: flex; flex-direction: column; gap: 20px; max-width: none; width: 100%; box-sizing: border-box; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 2px; }
.page-head h1 { font-size: 24px; font-weight: 650; line-height: 1.25; letter-spacing: -0.02em; }
.page-head p { margin-top: 3px; font-size: 13.5px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 18px 32px 28px; color: var(--faint); font-size: 12px; }
.foot span { display: inline-flex; align-items: center; gap: 6px; }
.menu-btn, .scrim { display: none; }

/* ── Building blocks ────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.pad { padding: 4px 0; margin: 0; }
.lede { color: var(--ink-2); max-width: 920px; margin-top: -8px; }
.footnote { max-width: 1040px; color: var(--muted); }
.notice { display: block; margin: 0; padding: 11px 14px; border-radius: 10px; background: var(--accent-wash); border: 1px solid var(--accent-line); color: var(--ink-2); }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chips .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); background: var(--surface); font-size: 13px; font-weight: 500; }
.chip:hover { text-decoration: none; border-color: var(--axis); color: var(--ink); }
.chip.on { border-color: var(--accent-line); color: var(--accent-ink); background: var(--accent-wash); font-weight: 600; }
.chip.flag.on { border-color: color-mix(in srgb, var(--crit) 35%, transparent); color: var(--crit-ink); background: var(--crit-wash); }
.chip .count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 650; }
.chip.on .count { background: var(--surface); color: inherit; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); }
.seg a { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 550; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.search { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; height: 36px; min-width: 300px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-sm); }
.search input, .search input:focus { border: 0; outline: 0; padding: 0; background: none; box-shadow: none; color: var(--ink); font: inherit; width: 100%; height: auto; }
.search:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-wash); }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; color: var(--muted); }
.back:hover { color: var(--ink); text-decoration: none; }
.meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.meta-row > * { display: inline-flex; align-items: center; gap: 6px; }
.meta-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--axis); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease;
}
.btn:hover { text-decoration: none; border-color: var(--axis); background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }
.btn .ic { color: var(--muted); }
.btn.primary { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff; box-shadow: 0 1px 2px rgba(37, 82, 208, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary .ic { color: #fff; }
.btn.primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-ink); box-shadow: none; }
.btn.ghost .ic { color: currentColor; }
.btn.ghost:hover { background: var(--accent-wash); border-color: transparent; }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.danger:hover { background: var(--crit-ink); border-color: var(--crit-ink); }
.btn.danger-outline { color: var(--crit-ink); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.btn.danger-outline .ic { color: currentColor; }
.btn.danger-outline:hover { background: var(--crit-wash); border-color: var(--crit); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.is-busy { opacity: .7; pointer-events: none; }
.btn.google { width: 100%; height: 44px; font-size: 14.5px; }
.btn.wide { width: 100%; height: 44px; font-size: 14.5px; }
.g-logo { width: 18px; height: 18px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent-2); cursor: pointer; font: inherit; }
button.link.danger { color: var(--crit-ink); }
button.link:disabled { color: var(--muted); cursor: not-allowed; }
button.x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; }
button.x:hover { color: var(--crit); }

/* Forms */
select, input, textarea { font: inherit; color: var(--ink); height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
input[type="checkbox"], input[type="radio"] { height: auto; box-shadow: none; accent-color: var(--accent); }
input::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-wash); }
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
form.stack { display: flex; flex-direction: column; gap: 14px; margin: 0; }
form.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 550; }
form.stack select, form.stack input:not([type="checkbox"]):not([type="radio"]) { width: 100%; }
form.stack label.check { flex-direction: row; align-items: center; gap: 12px; }
.form-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin: 16px 0 0; }
.form-row label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-prefix, .input-suffix { display: flex; align-items: stretch; }
.input-prefix span, .input-suffix span { display: grid; place-items: center; padding: 0 11px; border: 1px solid var(--line); background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 650; }
.input-prefix span { border-radius: 8px 0 0 8px; border-right: 0; }
.input-prefix input { border-radius: 0 8px 8px 0; }
.input-suffix span { border-radius: 0 8px 8px 0; border-left: 0; white-space: nowrap; }
.input-suffix input { border-radius: 8px 0 0 8px; width: 96px !important; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; }
.field-help { margin: -8px 0 2px; }
.section-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; margin: 10px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.check-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.check { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; font-weight: 400 !important; }
.check:last-child { border-bottom: 0; }
.check:hover { background: var(--surface-2); }
.check input { width: 16px !important; height: 16px; flex: none; }
.check span { display: flex; flex-direction: column; }
.check strong { color: var(--ink); font-weight: 600; }

.flash { display: flex; align-items: center; gap: 10px; margin: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid transparent; }
.flash.ok { background: var(--good-wash); color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.flash.warn { background: var(--warn-wash); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.flash.info { background: var(--accent-wash); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-2) 25%, transparent); }

/* ── KPI tiles ──────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: 1.35fr repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.small-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.tile-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--muted); flex: none; }
.tile-ic .ic { width: 16px; height: 16px; }
.tile-ic.accent { background: var(--accent-wash); color: var(--accent-ink); }
.tile-ic.good { background: var(--good-wash); color: var(--good-ink); }
.tile-ic.warn { background: var(--warn-wash); color: var(--warn-ink); }
.tile-ic.crit { background: var(--crit-wash); color: var(--crit-ink); }
.tile-value { font-size: clamp(21px, 1.6vw, 27px); font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-value .of { color: var(--muted); font-size: 16px; font-weight: 500; }
.tile.hero { background: linear-gradient(160deg, var(--surface) 0%, var(--surface) 55%, var(--accent-wash) 140%); }
.tile.hero .tile-value { font-size: clamp(28px, 2.4vw, 38px); }
.tile-sub { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tile .meter { width: 100%; height: 10px; margin-top: 4px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.delta strong { font-weight: 650; font-variant-numeric: tabular-nums; }
.delta.good strong, .delta.good .ic { color: var(--good-ink); }
.delta.bad strong, .delta.bad .ic { color: var(--crit-ink); }
.delta span { color: var(--muted); }

/* ── Layout grids ───────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-pacing { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.pacing-card { display: flex; flex-direction: column; gap: 14px; }
.pacing-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.pacing-figures div { display: flex; flex-direction: column; gap: 3px; }
.pacing-figures strong { font-size: 18px; font-weight: 650; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.meter-lg .meter { width: 100%; height: 14px; }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
.grid th, .grid td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; border-bottom-color: var(--line); }
.card:not(.flush) .grid th { background: transparent; }
.grid tbody tr { transition: background-color .1s ease; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid.compact th, .grid.compact td { padding: 9px 14px; }
.grid.plain th { background: transparent; }
.chart-card .grid.compact th, .chart-card .grid.compact td { padding-left: 8px; padding-right: 8px; }
.grid tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--accent-2); }
.grid tr.row-over td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.grid tr.row-under td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.grid tr.inactive td { color: var(--muted); }
.grid tr.inactive .person strong { color: var(--muted); }
.grid tr.flagged td { background: color-mix(in srgb, var(--crit-wash) 70%, transparent); }
.grid td .mono.muted { font-size: 11.5px; margin-top: 1px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.grid td.num .meter { display: block; width: 100%; max-width: 120px; height: 7px; margin: 6px 0 0 auto; }
.acct { color: var(--ink); font-weight: 600; }
.acct:hover { color: var(--accent-2); text-decoration: none; }
.acct-cell { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.acct-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.acct-meta .pf { font-size: 12px; color: var(--muted); }
.clip { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.err { color: var(--crit-ink); font-size: 12.5px; max-width: 440px; }
.actions { text-align: right; white-space: nowrap; }
.actions .btn { margin-left: auto; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[aria-sort="ascending"]::after { content: " ↑"; }
th[aria-sort="descending"]::after { content: " ↓"; }
tr.hidden-row { display: none; }
.person { display: inline-flex; align-items: center; gap: 11px; }
.person strong { font-weight: 600; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12.5px; }

.card:not(.flush) .grid th:first-child, .card:not(.flush) .grid td:first-child { padding-left: 0; }
.card:not(.flush) .grid th:last-child, .card:not(.flush) .grid td:last-child { padding-right: 0; }
/* Tables with a coloured row marker keep room for it, so it never touches the text. */
.card:not(.flush) .grid:has(tr.mine, tr.row-over, tr.row-under) :is(th, td):first-child { padding-left: 14px; }
.grid td.num, .grid th.num { white-space: nowrap; }
.grid td:first-child { white-space: nowrap; }
/* Long names wrap instead of widening the whole table (ids stay on one line). */
.grid td:first-child .acct-cell { white-space: normal; max-width: 340px; }
.grid td:first-child .acct-meta, .grid td:first-child .mono { white-space: nowrap; }
.grid td:first-child .person { white-space: normal; max-width: 360px; }
.person > span { min-width: 0; }
.person .muted, .person .small { overflow-wrap: anywhere; }

/* Wide tables: the first column stays put while the rest scrolls, with a
   shadow once scrolled and a fade on the side that has more (app.js sets
   data-scroll-left / data-scroll-more on .table-wrap). */
.table-wrap { position: relative; }
.table-wrap[data-scroll-more] { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.table-wrap > .grid :is(th, td):first-child { position: sticky; left: 0; z-index: 1; }
.table-wrap > .grid th:first-child { z-index: 2; }
.table-wrap > .grid td:first-child { background: var(--surface); }
.card:not(.flush) .table-wrap > .grid td:first-child { background: var(--surface); }
.table-wrap > .grid tbody tr:hover td:first-child { background: var(--surface-2); }
.table-wrap > .grid tr.flagged td:first-child { background: color-mix(in srgb, var(--crit-wash) 70%, var(--surface)); }
.table-wrap > .grid :is(th, td):first-child::after { content: ""; position: absolute; top: 0; bottom: -1px; right: -10px; width: 10px; pointer-events: none; opacity: 0; transition: opacity .15s ease;
  background: linear-gradient(to right, rgba(10, 14, 22, .10), transparent); }
.table-wrap[data-scroll-left] > .grid :is(th, td):first-child::after { opacity: 1; }
.card:not(.flush) .grid.plain th:first-child { background: var(--surface); }
.money { font-weight: 600; }
.of-budget { color: var(--muted); font-size: 12px; margin-top: 1px; }

/* Platform tag: swatch mirrors the series mark; text stays in ink. */
.pf { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* Status: always a text label; the dot is the icon. */
.pace { display: inline-flex; align-items: center; gap: 6px; height: 24px; font-size: 12px; font-weight: 650; padding: 0 9px 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pace::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.pace-over { background: var(--crit-wash); color: var(--crit-ink); }
.pace-over::before { background: var(--crit); }
.pace-under { background: var(--warn-wash); color: var(--warn-ink); }
.pace-under::before { background: var(--warn); }
.pace-on_track { background: var(--good-wash); color: var(--good-ink); }
.pace-on_track::before { background: var(--good); }
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: capitalize; background: var(--surface-3); color: var(--muted); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-success { color: var(--good-ink); background: var(--good-wash); }
.s-failed { color: var(--crit-ink); background: var(--crit-wash); }
.s-partial { color: var(--warn-ink); background: var(--warn-wash); }
.s-running { color: var(--accent-ink); background: var(--accent-wash); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.st-ok { background: var(--good-wash); color: var(--good-ink); }
.st-off { background: var(--surface-3); color: var(--muted); }
.st-warn { background: var(--warn-wash); color: var(--warn-ink); }
.tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--accent-wash); color: var(--accent-ink); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; vertical-align: 1px; }
.tag.demo { background: var(--warn-wash); color: var(--warn-ink); }
.role-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; background: var(--surface-3); color: var(--ink-2); }
.role-admin { background: var(--accent-wash); color: var(--accent-ink); }
.chips-ro { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-ro { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 4px; border-radius: 999px; background: var(--surface-3); font-size: 12px; font-weight: 500; }
.chip-ro .avatar { width: 18px; height: 18px; font-size: 9px; }
.chip-ro.muted { opacity: .6; }

/* ── Accounts report: views, range, columns ─────────────────────────── */
.views-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); margin-top: -4px; }
.views-bar .view-actions { flex: none; }
.view-tabs { display: flex; flex: 1 1 auto; gap: 2px; min-width: 0; margin-bottom: -1px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tabs[data-scroll-more] { mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
.view-tabs[data-scroll-left][data-scroll-more] { mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 48px), transparent); }
.view-tabs[data-scroll-left]:not([data-scroll-more]) { mask-image: linear-gradient(to right, transparent, #000 32px); }
.view-tab .vt-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.view-tab { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 550; white-space: nowrap; }
.view-tab:hover { color: var(--ink); text-decoration: none; }
.view-tab.on { color: var(--ink); border-bottom-color: var(--accent-2); font-weight: 650; }
.view-tab .star { color: var(--warn); font-size: 12px; }
.view-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; }
.view-menu .menu, .range-custom .menu { min-width: 280px; }
.view-menu summary.btn { padding: 0 8px; }
.menu-item.danger { color: var(--crit-ink); }
.menu-item.danger .ic { color: var(--crit-ink); }
.range-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-custom summary.btn.on { border-color: var(--accent-line); color: var(--accent-ink); background: var(--accent-wash); }
.range-custom .menu { left: 0; right: auto; padding: 14px; }
.range-custom .menu label { font-size: 12.5px; }
.th-tip { border-bottom: 1px dotted var(--axis); cursor: help; }
.grid.report tfoot td { position: sticky; bottom: 0; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.na { color: var(--faint); cursor: help; }
.col-filter { min-width: 0; width: 100%; }
.drawer-body > * { flex-shrink: 0; }
form.stack label.search { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
form.stack label.search input { height: 34px; }
.check.dual { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; cursor: default; }
.check.dual label { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.check.hidden-row { display: none; }
.check-list.scroll { max-height: 420px; overflow-y: auto; }
.section-title .sw { margin-right: 2px; }

/* ── Trends and comparisons ─────────────────────────────────────────── */
.spark { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent-2); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--accent-wash); stroke: none; }
.spark-dot { fill: var(--accent-2); }
.cmp { margin-top: 2px; font-size: 11px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp.good { color: var(--good-ink, var(--good)); }
.cmp.bad { color: var(--crit-ink, var(--crit)); }
.cmp.neutral { color: var(--muted); font-weight: 500; }
.btn.on { background: var(--accent-wash); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-2) 35%, transparent); }

/* ── History lists (budgets) and notes ──────────────────────────────── */
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.history li:first-child { border-top: 0; }
.budget-history .history { padding-top: 4px; }
.notes .note-body { flex: 1 1 100%; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-form { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.note-form textarea { min-height: 44px; font-family: inherit; font-size: 13.5px; }
.alert-banner-actions { margin-left: auto; }
.snoozed { display: flex; align-items: flex-start; gap: 8px; padding: 8px 14px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 12.5px; }
.snoozed strong { color: var(--ink-2); }
button.link.danger { color: var(--crit-ink); }

/* ── Notifications ──────────────────────────────────────────────────── */
.notif-menu summary { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-sm); cursor: pointer; }
.notif-menu summary:hover { color: var(--ink); background: var(--surface-2); }
.notif-badge { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.notif-badge[hidden] { display: none; }
.notif-panel { width: 380px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.notif-items { max-height: 420px; overflow-y: auto; }
.notif-empty { padding: 16px 14px; margin: 0; }
.notif-foot { display: block; padding: 10px 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; text-align: center; }
.notif { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line-2); }
a.notif:hover, .notif-list .notif > a:hover { background: var(--surface-2); text-decoration: none; }
.notif-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.t-crit .notif-ic { background: var(--crit-wash); color: var(--crit-ink); }
.t-warn .notif-ic { background: var(--warn-wash); color: var(--warn-ink); }
.t-info .notif-ic { background: var(--accent-wash); color: var(--accent-ink); }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-body strong { font-size: 13px; font-weight: 600; }
.notif-body span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.notif:not(.unread) .notif-body strong { font-weight: 500; color: var(--ink-2); }
.notif.unread .notif-body strong::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent-2); vertical-align: 1px; }
.notif-at { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list .notif { grid-template-columns: minmax(0, 1fr) auto; padding: 0; align-items: center; }
.notif-list .notif > a { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 16px; color: var(--ink); }
.notif-list .notif form { padding-right: 12px; }
.notif-list .notif:last-child { border-bottom: 0; }

/* ── Spend alerts ───────────────────────────────────────────────────── */
.alert-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.alert-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--warn-wash); color: var(--warn-ink); cursor: help; }
.alert-chip.a-no_spend, .alert-chip.a-no_conv, .alert-chip.a-suspended, .alert-chip.a-disapproved { background: var(--crit-wash); color: var(--crit-ink); }
.alert-chip.a-stale { background: var(--surface-3); color: var(--muted); }
.alert-list { display: flex; flex-direction: column; }
.alert-row { display: grid; grid-template-columns: minmax(200px, 1.2fr) auto 1fr; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); color: var(--ink); }
.alert-row:first-child { border-top: 0; }
.alert-row:hover { text-decoration: none; background: var(--surface-2); }
.alert-banner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius, 10px); background: var(--surface); }

/* ── Bulk tools ─────────────────────────────────────────────────────── */
textarea { width: 100%; height: auto; min-height: 120px; padding: 10px 11px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; }
.lede.flush { margin-top: 0; }
.bulk-edit input { height: 34px; }
.bulk-edit .input-prefix { display: inline-flex; flex: none; }
.bulk-edit .input-prefix input { flex: none; width: 136px; min-width: 136px; text-align: right; }
.bulk-edit td input.pct { width: 84px; min-width: 84px; max-width: 84px; text-align: right; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; justify-content: flex-end; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ── Audit view ─────────────────────────────────────────────────────── */
.audit-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.audit-tabs a { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 9px; color: var(--muted); font-weight: 550; font-size: 13px; }
.audit-tabs a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.audit-tabs a.on { background: var(--accent-wash); color: var(--accent-ink); font-weight: 650; }
.audit-tabs .count { min-width: 22px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; }
.audit-tabs a.on .count { background: var(--surface); color: inherit; }
.audit-tabs .count.bad { background: var(--warn-wash); color: var(--warn-ink); }
.audit-table .card-head.pad-x { padding: 16px 18px 0; margin-bottom: 10px; }
.audit-table .pad { padding: 4px 18px 18px; }
details.collapsible > summary { list-style: none; cursor: pointer; padding-bottom: 16px; margin-bottom: 0; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible[open] > summary { padding-bottom: 0; margin-bottom: 10px; }
details.collapsible > summary:hover .muted { color: var(--accent-2); }
.enum { font-size: 12.5px; color: var(--ink-2); }
.enum.bad { color: var(--crit-ink); font-weight: 600; }
.kpis.two-col { grid-template-columns: 1fr; align-content: start; }
.heatmap { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; }
.hm-row { display: grid; grid-template-columns: 40px repeat(24, minmax(18px, 1fr)); gap: 3px; align-items: center; }
.hm-head span { font-size: 10.5px; color: var(--muted); text-align: left; }
.hm-day { font-size: 12px; color: var(--muted); font-weight: 550; }
.hm-cell { height: 22px; border-radius: 4px; background: var(--surface-3); outline-offset: 1px; }
.hm-cell.l1 { background: color-mix(in srgb, var(--s1) 20%, var(--surface-3)); }
.hm-cell.l2 { background: color-mix(in srgb, var(--s1) 40%, var(--surface-3)); }
.hm-cell.l3 { background: color-mix(in srgb, var(--s1) 60%, var(--surface-3)); }
.hm-cell.l4 { background: color-mix(in srgb, var(--s1) 80%, var(--surface-3)); }
.hm-cell.l5 { background: var(--s1); }

/* ── Charts ─────────────────────────────────────────────────────────── */
.chart-card { display: flex; flex-direction: column; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
.s-1 { fill: var(--s1); background: var(--s1); }
.s-2 { fill: var(--s2); background: var(--s2); }
.s-3 { fill: var(--s3); background: var(--s3); }
.s-4 { fill: var(--s4); background: var(--s4); }
.s-5 { fill: var(--s5); background: var(--s5); }
.chart .grid line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .grid line.baseline { stroke: var(--axis); }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.chart .val { fill: var(--ink); font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart .track, .meter .track { fill: var(--line-2); }
.hbars { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 8px; }
.hbar { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; border-radius: 6px; outline: none; }
.hbar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hbar-lbl { color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.hbar-val { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.hbar-bar { display: block; }
.hbar-track { fill: var(--line-2); }
.hbar:hover .hbar-bar rect:not(.hbar-track), .hbar:focus-visible .hbar-bar rect:not(.hbar-track) { opacity: .8; }
.hbar:focus-visible { box-shadow: 0 0 0 3px var(--accent-wash); }
.chart .hit { fill: transparent; }
.chart .mark { outline: none; cursor: default; }
.chart .mark:hover path, .chart .mark:hover rect:not(.hit):not(.track), .chart .mark:focus-visible path, .chart .mark:focus-visible rect:not(.hit):not(.track) { opacity: .8; }
.chart .mark:hover .hit, .chart .mark:focus-visible .hit { fill: color-mix(in srgb, var(--accent-wash) 70%, transparent); }
.meter .fill { fill: var(--accent-2); }
.meter .fill-on_track { fill: var(--good); }
.meter .fill-under { fill: var(--warn); }
.meter .fill-over { fill: var(--crit); }
.meter .expected { stroke: var(--ink); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 10px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.table-view { margin-top: 12px; }
.table-view summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 550; width: fit-content; }
.table-view summary:hover { color: var(--ink); }
.table-view[open] summary { margin-bottom: 10px; }
.table-view .grid { font-size: 13px; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; min-width: 180px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 12.5px; }
.tooltip .tt-title { color: var(--muted); margin-bottom: 6px; font-weight: 550; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; padding: 1px 0; }
.tooltip .tt-row strong { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; color: var(--ink); }
.tooltip .tt-key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tooltip .tt-key.s-1 { background: var(--s1); } .tooltip .tt-key.s-2 { background: var(--s2); } .tooltip .tt-key.s-3 { background: var(--s3); } .tooltip .tt-key.s-4 { background: var(--s4); } .tooltip .tt-key.s-5 { background: var(--s5); }
.tooltip .tt-total { border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 6px; }

/* ── Empty state, demo ──────────────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 56px 24px; }
.empty h2 { font-size: 17px; font-weight: 650; }
.empty p { margin: 0 0 10px; max-width: 520px; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-wash); color: var(--accent-ink); margin-bottom: 6px; }
.empty-icon .ic { width: 26px; height: 26px; }
.demo-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-style: dashed; background: var(--surface-2); }
.demo-card p { margin: 4px 0 0; max-width: 680px; }
.demo-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Sign-in ────────────────────────────────────────────────────────── */
body.auth { min-height: 100vh; display: flex; flex-direction: column; background:
  radial-gradient(900px 500px at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
  radial-gradient(700px 500px at 100% 100%, color-mix(in srgb, var(--s3) 10%, transparent), transparent 60%), var(--bg); }
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 20px; }
.auth-card { display: grid; grid-template-columns: 1.1fr 1fr; width: min(960px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg); }
.auth-brand { position: relative; background: radial-gradient(600px 300px at 0% 0%, #1d3a8a 0%, transparent 70%), linear-gradient(160deg, #0c111d, #111a2e); color: var(--side-ink); padding: 44px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -60px; bottom: -60px; width: 240px; height: 240px; border-radius: 50%; border: 40px solid rgba(255, 255, 255, .03); }
.auth-logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 16px; }
.auth-brand h1 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.025em; margin-top: 28px; }
.auth-brand p { color: #b5bdcc; font-size: 14.5px; }
.auth-points { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: #d7dce6; }
.auth-company { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; flex-direction: column; gap: 4px; font-style: normal; font-size: 12.5px; color: #aab3c5; }
.auth-company strong { color: #fff; font-size: 13px; font-weight: 600; }
.auth-company span { display: inline-flex; align-items: center; gap: 6px; }
.auth-company a { color: #c7d2fe; }
.auth-points .ic { width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: rgba(111, 211, 168, .12); color: #6fd3a8; }
.auth-platforms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 24px; }
.auth-platforms span { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: #d7dce6; font-size: 12px; }
.auth-form { padding: 44px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.auth-form h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.auth-foot { text-align: center; padding: 16px; color: var(--faint); font-size: 12px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.card.narrow { max-width: 480px; }

/* ── Drawers (right side), dialogs, toasts, palette ─────────────────── */
dialog.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(520px, 100vw); height: 100vh; max-height: 100vh; max-width: none; padding: 0;
  border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: -24px 0 60px -12px rgba(10, 14, 22, .25);
  display: none; flex-direction: column;
}
dialog.drawer[open] { display: flex; animation: drawer-in .22s cubic-bezier(.2, .8, .2, 1); }
dialog.drawer::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
@keyframes drawer-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; font-weight: 650; }
.drawer-head p { margin-top: 3px; }
.drawer-head .icon-btn { color: var(--muted); }
.drawer-head .icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.drawer-body { padding: 22px 24px; overflow-y: auto; }
.drawer-foot { position: sticky; bottom: -22px; display: flex; justify-content: flex-end; gap: 8px; margin: 6px -24px -22px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.drawer-extra { padding: 6px 24px 24px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); overflow-y: auto; background: var(--surface-2); }
.drawer-extra form { margin: 0; }
.drawer-extra .btn { align-self: flex-start; }

dialog.modal { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal[open] { animation: pop .16s ease-out; }
dialog.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
@keyframes pop { from { transform: scale(.97) translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal form { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.modal-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--crit-wash); color: var(--crit-ink); margin-bottom: 6px; }
.modal h2 { font-size: 17px; font-weight: 650; }
.modal p { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column-reverse; gap: 10px; }
.toast { display: flex; align-items: flex-start; gap: 12px; width: min(400px, calc(100vw - 32px)); padding: 14px 12px 14px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: toast-in .24s cubic-bezier(.2, .8, .2, 1); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all .22s ease; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast strong { display: block; font-size: 14px; font-weight: 650; }
.toast p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.toast > div { flex: 1; }
.toast-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; }
.toast.ok .toast-ic { background: var(--good-wash); color: var(--good-ink); }
.toast.warn .toast-ic { background: var(--warn-wash); color: var(--warn-ink); }
.toast.run .toast-ic { background: var(--surface-3); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 7px; }
.toast-x:hover { background: var(--surface-3); color: var(--ink); }

dialog.palette { width: min(620px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.palette[open] { animation: pop .14s ease-out; display: flex; flex-direction: column; }
dialog.palette::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input input { flex: 1; height: 56px; border: 0; padding: 0; background: none; box-shadow: none; font-size: 16px; }
.pal-input input:focus { box-shadow: none; }
.pal-list { max-height: min(420px, 55vh); overflow-y: auto; padding: 6px; }
.pal-group { padding: 10px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; color: var(--ink); }
.pal-item:hover { text-decoration: none; }
.pal-item.on { background: var(--accent-wash); }
.pal-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--muted); font-size: 13px; flex: none; }
.pal-txt { display: flex; flex-direction: column; min-width: 0; }
.pal-txt strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 28px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.pal-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ── Connections ────────────────────────────────────────────────────── */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 20px; align-items: stretch; }
.conn-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; min-width: 0; }
.conn-head { display: flex; align-items: center; gap: 12px; }
.conn-logo { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font: 700 19px/1 var(--sans, inherit); letter-spacing: -.02em; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.conn-title { flex: 1; min-width: 0; }
.conn-title h2 { margin: 0; font-size: 16px; line-height: 1.25; }
.conn-title h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-title p { margin: 4px 0 0; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; white-space: nowrap; min-width: 0; }
.conn-title p > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.conn-title .status-pill { height: 20px; font-size: 11px; padding: 0 8px; }
.conn-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.conn-stats > div { padding: 10px 12px; min-width: 0; }
.conn-stats > div + div { border-left: 1px solid var(--line-2); }
.conn-stats dt { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.conn-stats dd { margin: 4px 0 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 15px; }
.conn-stats dd .sub { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.conn-stats dd strong { font-weight: 650; }
.conn-stats dd .sub.st-success { color: var(--good-ink); }
.conn-stats dd .sub.st-failed { color: var(--crit-ink); }
.conn-stats dd .sub.st-partial { color: var(--warn-ink); }
.conn-creds { list-style: none; margin: 0; padding: 0; }
.conn-creds li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13.5px; border-bottom: 1px solid var(--line-2); }
.conn-creds li:last-child { border-bottom: 0; }
.conn-creds .lbl { flex: 1; min-width: 0; }
.conn-creds .dot.off { background: var(--line); }
.conn-creds .status-pill { height: 22px; font-size: 11.5px; }
.conn-oauth { border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); }
.conn-oauth summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 600; }
.conn-oauth summary::-webkit-details-marker { display: none; }
.conn-oauth summary > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.conn-oauth summary > span:first-child::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(45deg) translateY(-2px); margin-left: 4px; transition: transform .15s; }
.conn-oauth[open] summary > span:first-child::after { transform: rotate(-135deg) translateY(-1px); }
.conn-oauth-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.conn-oauth-body p { margin: 0; }
.conn-oauth .redirect { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.copy-row { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; padding: 3px 3px 3px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.copy-row code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-row .btn { flex: none; height: 26px; }
.conn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-2); }
.conn-actions .btn { white-space: nowrap; }
.conn-actions .push { margin-left: auto; }
.conn-error { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-wash); color: var(--warn-ink); }
.conn-error .ic { flex: none; margin-top: 2px; }
code.copy { display: inline-block; margin-top: 4px; padding: 4px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; user-select: all; word-break: break-all; }
.test-result { padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.test-result strong { display: flex; align-items: center; gap: 6px; }
.test-result.ok { background: var(--good-wash); color: var(--good-ink); }
.test-result.bad { background: var(--crit-wash); color: var(--crit-ink); }
.test-result ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink); }
.test-result p { margin: 6px 0 0; }
.test-result .grid { margin-top: 8px; color: var(--ink); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-pacing { grid-template-columns: minmax(0, 1fr); }
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 264px; height: 100vh; transform: translateX(-100%); transition: transform .2s ease; }
  body.side-open .sidebar { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--backdrop); }
  body.side-collapsed { --side-w: 248px; }
  body.side-collapsed .sidebar nav a .label, body.side-collapsed .brand .label { display: inline; }
  .side-toggle { display: none; }
  .menu-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer; }
  .topbar { padding: 0 16px; gap: 10px; }
  .crumbs > span:first-child, .crumbs > .ic:first-of-type { display: none; }
  .user-menu .who, .fr-text { display: none; }
  .freshness summary { padding: 0 12px; }
  .content { padding: 18px 16px 8px; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px; }
  .auth-brand h1 { margin-top: 8px; font-size: 24px; }
  .auth-form { padding: 28px; }
  .kpis, .kpis.three, .kpis.four, .pacing-figures { grid-template-columns: 1fr 1fr; }
  .search { min-width: 0; width: 100%; }
  .grid-2.even { grid-template-columns: minmax(0, 1fr); }
  .foot { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Skip link: first thing a keyboard user reaches; visible only on focus. */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--accent-2); color: #fff; font-weight: 600; transition: top .15s ease; }
.skip-link:focus { top: 12px; text-decoration: none; }
th[data-sort]:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.content:focus { outline: none; }
.tile .delta { flex-wrap: wrap; white-space: normal; row-gap: 0; }
.tile .delta span { white-space: nowrap; }

/* Display currency picker and conversion labels */
.cur-pick { display: inline-flex; align-items: center; }
.toolbar > .cur-pick { margin-left: auto; }
.cur-pick label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; }
.cur-pick select { height: 32px; padding: 0 8px; font-size: 13px; min-width: 150px; }
.fx-note { display: flex; gap: 8px; align-items: flex-start; }
.fx-note .ic { flex: none; margin-top: 2px; }
.fx-tag { font-size: 11px; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); white-space: nowrap; }

/* API usage (Sync log) */
.usage-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 16px; }
.usage-google, .usage-other { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.usage-google p { margin: 0; }
.usage-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.usage-top strong, .usage-other strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.usage-bar { width: 100%; height: 8px; display: block; }
.usage-bar .track { fill: var(--line); }
.usage-bar.good .fill { fill: var(--good); } .usage-bar.warn .fill { fill: var(--warn); } .usage-bar.crit .fill { fill: var(--crit); }
@media (max-width: 900px) { .usage-grid { grid-template-columns: minmax(0, 1fr); } }

/* Activity log */
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.activity-list li:last-child { border-bottom: 0; }
.activity-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.activity-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.activity-target { font-weight: 600; }
.activity-time { flex: none; white-space: nowrap; }

/* Setup checklist (Overview, admins) */
.setup-card { display: flex; flex-direction: column; gap: 12px; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.setup-steps li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.setup-steps li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.setup-mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; }
.setup-steps li.done .setup-mark { background: var(--good); border-color: var(--good); }
.setup-steps li.done strong { color: var(--muted); }

/* Print (account page summary for meetings; works on any page) */
.print-head { display: none; }
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #f7f8fa; }
  html, body { background: #fff !important; color: #111; font-size: 11px; }
  .sidebar, .topbar, .scrim, .foot, .skip-link, dialog, .toast, [data-toast], .btn, .chips .back, .note-form, .alert-banner-actions,
  .range-bar, .seg, .toolbar form, .notif, details.table-view, .conn-actions, .cur-pick, .page-actions { display: none !important; }
  .no-print { display: none !important; }
  .shell, .main { display: block !important; margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .print-head { display: flex !important; justify-content: space-between; align-items: baseline; padding-bottom: 6px; margin-bottom: 10px; border-bottom: 2px solid #111; font-size: 11px; }
  .page-head h1 { font-size: 20px; }
  .card, .tile { box-shadow: none !important; border: 1px solid #d9dce3 !important; break-inside: avoid; }
  .kpis { gap: 8px !important; }
  a { color: inherit; text-decoration: none; }
  svg { max-width: 100%; }
}

/* Reconciliation */
.st-bad { background: var(--crit-wash); color: var(--crit-ink); }
.reconcile-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.reconcile-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.reconcile .grp { text-align: center; border-left: 1px solid var(--line-2); }
.reconcile td.rc-ok { color: var(--good-ink); font-weight: 600; }
.reconcile td.rc-bad { color: var(--crit-ink); font-weight: 700; }

/* Date range picker (ad-platform style) */
.range-picker { position: relative; }
.range-btn { gap: 8px; height: 36px; }
.range-btn .rp-label { font-weight: 650; }
.range-btn .rp-dates { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.range-btn .rp-chev { transform: rotate(90deg); color: var(--faint); }
.range-picker[open] .range-btn { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-wash); }
.rp-menu { left: 0; right: auto; display: grid; grid-template-columns: minmax(270px, 1fr) 220px; gap: 0; padding: 0; min-width: 500px; overflow: hidden; }
.rp-presets { max-height: min(600px, 75vh); overflow-y: auto; padding: 6px; border-right: 1px solid var(--line-2); }
.rp-group + .rp-group { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 4px; }
.rp-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 6px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 13px; }
.rp-item:hover, .rp-item:focus-visible { background: var(--surface-2); }
.rp-item.on { background: var(--accent-wash); color: var(--accent-ink); font-weight: 650; }
.rp-span { color: var(--faint); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-item.on .rp-span { color: var(--accent-ink); }
.rp-custom { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface-2); }
.rp-custom label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
.rp-custom p { margin: 0; }
@media (max-width: 640px) {
  .rp-menu { grid-template-columns: minmax(0, 1fr); min-width: 0; width: calc(100vw - 32px); }
  .rp-presets { border-right: 0; border-bottom: 1px solid var(--line-2); max-height: 300px; }
  .range-btn .rp-dates { display: none; }
}

/* Nav count badge (Budget pacing) and next-sync time */
.nav-count { margin-left: auto; display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: color-mix(in srgb, var(--crit) 22%, transparent); color: #ffb4b4; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
body.side-collapsed .nav-count { position: absolute; top: 3px; right: 4px; min-width: 16px; height: 15px; font-size: 9px; padding: 0 3px; background: var(--crit); color: #fff; }
.fr-next { color: var(--muted); font-weight: 500; }
@media (max-width: 1100px) { .fr-next { display: none; } }

/* Budget pacing page */
.pace-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.pace-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; text-decoration: none; }
.pace-chip strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.pace-chip.over { color: var(--crit-ink); } .pace-chip.under { color: var(--warn-ink); } .pace-chip.ok { color: var(--good-ink); }
.pace-chip.on { border-color: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 18%, transparent); }
.pace-chip.over.on { background: var(--crit-wash); } .pace-chip.under.on { background: var(--warn-wash); } .pace-chip.ok.on { background: var(--good-wash); } .pace-chip.all.on, .pace-chip.none.on { background: var(--surface-2); }
.pacing-table td.runway { min-width: 170px; width: 18%; }
.pacing-table td.runway .meter { display: block; width: 100%; height: 9px; }
.pacing-table td.pace-pct { font-weight: 700; background: none; padding-left: 0; }
.pacing-table td.pace-pct::before { display: none; }
.pacing-table td.pace-over { color: var(--crit-ink); } .pacing-table td.pace-under { color: var(--warn-ink); } .pacing-table td.pace-on_track { color: var(--good-ink); }
.pacing-table th, .pacing-table td { white-space: nowrap; }

/* Overview: flagged account cards */
.flag-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.flag-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 12px; border: 1px solid var(--line-2); border-left: 4px solid var(--warn); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.flag-card.fc-over { border-left-color: var(--crit); }
.flag-card:hover, .flag-card:focus-visible { box-shadow: var(--shadow-sm); border-color: var(--line); }
.fc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fc-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-pct { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.fc-over .fc-pct { color: var(--crit-ink); } .fc-under .fc-pct { color: var(--warn-ink); }
.flag-card .meter { width: 100%; height: 9px; display: block; }
.fc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--ink-2); }
.fc-meta .pf { font-size: 12px; }

/* Metric dictionary and How it's built */
.dict td { vertical-align: top; min-width: 160px; }
.dict td:first-child { min-width: 280px; max-width: 420px; white-space: normal; }
.dict code { font-family: var(--mono); font-size: 12px; }
.dict .unit { margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.dict-notes { margin: 6px 0 0; padding-left: 16px; font-size: 12px; color: var(--ink-2); }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.plain-list.numbered { list-style: decimal; }
.arch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.arch-col { display: flex; flex-direction: column; gap: 10px; }
.arch-h { font-size: 12px; color: var(--faint); font-weight: 600; }
.arch-box { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; }
.arch-box span { color: var(--muted); font-size: 12.5px; }
.arch-box.hl { border-color: var(--accent-line); background: var(--accent-wash); }
@media (max-width: 1000px) { .arch { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 600px) { .arch { grid-template-columns: minmax(0, 1fr); } }

/* Phase Two preview */
.preview-tag { margin-left: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: #f6c94a; color: #3a2a00; }
body.side-collapsed .preview-tag { display: none; }
.changes-pill { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 12.5px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.changes-pill:hover { border-color: var(--accent-line); }
@media (max-width: 1200px) { .changes-pill { display: none; } }
.preview-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; background: #fff7dc; color: #5a4300; border: 1px solid #f1dc9b; font-size: 13px; }
:root[data-theme="dark"] .preview-note { background: #2b2410; color: #f1dc9b; border-color: #4a3d14; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .preview-note { background: #2b2410; color: #f1dc9b; border-color: #4a3d14; } }
.finding-list { list-style: none; margin: 0; padding: 0; }
.finding-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.finding-list li:last-child { border-bottom: 0; }
.finding-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.finding-dot.bad { background: var(--crit); } .finding-dot.warn { background: var(--warn); } .finding-dot.good { background: var(--good); }
.finding-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.finding-body strong { font-size: 14px; }
.proposal-list { list-style: none; margin: 0; padding: 0; }
.proposal-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.proposal-list li:last-child { border-bottom: 0; }
.proposal-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.proposal-main .acct-meta { flex-wrap: wrap; }
.proposal-actions { display: flex; gap: 8px; }
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }
.ask-form { display: flex; gap: 8px; align-items: flex-end; }
.ask-form textarea, .ask-form input { flex: 1; font-family: inherit; }
.ask-form textarea { min-height: 46px; height: 46px; padding: 11px 12px; resize: vertical; }
.ask-examples { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) { .proposal-list li { grid-template-columns: minmax(0, 1fr); } .msg { max-width: 95%; } }

/* ── Phase Two preview, part two ─────────────────────────────────────── */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.hub-card { display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.hub-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-lg); }
.hub-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hub-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hub-go { margin-top: auto; color: var(--accent-ink); font-weight: 600; }
.api-request { margin-top: 6px; }
.api-request summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }
.api-request p { margin: 6px 0 0; overflow-wrap: anywhere; }
pre.code { margin: 8px 0 0; max-height: 280px; overflow: auto; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); font-family: var(--mono); font-size: 11.5px; line-height: 1.5; white-space: pre; }
.share-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.share-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
.share-form input[type="text"] { min-width: 260px; }
.share-created { border-color: var(--accent-line); background: var(--accent-wash); display: flex; flex-direction: column; gap: 10px; }
.share-created p { margin: 0; }
.card-head.pad { padding: 16px 20px 0; }

/* Client report (share link, no sign-in) */
body.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.pub-top { display: flex; align-items: center; padding: 14px 32px; background: var(--side-bg); }
.pub-top .brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.pub-top .brand small { display: block; color: var(--side-muted); font-size: 11.5px; }
.pub-main { flex: 1; display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 32px; }
.pub-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pub-head h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.pub-head p { margin-top: 4px; }
.pub-foot { padding: 18px 32px; color: var(--muted); font-size: 12px; text-align: center; border-top: 1px solid var(--line); }

/* Phones and small tablets */
@media (max-width: 640px) {
  .content, .pub-main { padding: 14px 12px 8px; gap: 14px; }
  .pub-top, .pub-foot { padding-left: 16px; padding-right: 16px; }
  .page-head h1, .pub-head h1 { font-size: 20px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .card { padding: 16px 14px; border-radius: 10px; }
  .card.flush { padding: 0; }
  .kpis, .kpis.three, .kpis.four, .kpis.small-kpis, .pacing-figures { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpis .tile.hero { grid-column: 1 / -1; }
  .tile-value { font-size: 20px; }
  .toolbar { align-items: stretch; }
  .toolbar > * { max-width: 100%; }
  .grid th, .grid td { padding: 10px 12px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .hub-grid { grid-template-columns: minmax(0, 1fr); }
  .share-form, .share-form label, .share-form input[type="text"] { width: 100%; min-width: 0; }
  .flag-cards { grid-template-columns: minmax(0, 1fr); }
  .topbar .changes-pill, .search-trigger { display: none; }
  .foot { flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; }
}
.s-none { fill: var(--muted); background: var(--muted); }
.hub-card:hover, .hub-card:hover * { text-decoration: none; }
.share-created h2 { display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .alert-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* Show/hide password and view saved credential */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 40px; }
.pw-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: inline-grid; place-items: center; width: 32px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-3); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.conn-creds li { flex-wrap: wrap; }
.reveal-btn { height: 24px; padding: 0 8px; font-size: 11.5px; }
.secret-val { flex: 1 1 100%; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.secret-val[hidden] { display: none; }
.secret-val code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; user-select: all; }
.ask-form .pw-wrap { flex: 1; }

/* Account tracking page: search / filter row */
.toolbar-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; padding: 14px 18px; margin-bottom: 14px; }
.toolbar-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted, inherit); }
.toolbar-form .btn { align-self: end; }

/* Long API errors (URLs, JSON) must wrap inside the connection card. */
.conn-error, .test-result { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.conn-error > span, .test-result p, .test-result li { min-width: 0; overflow-wrap: anywhere; }

/* Track checkbox column (assignments list) */
.track-col { width: 56px; text-align: center; }
.track-col input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
tr.track-failed { outline: 2px solid var(--crit-ink, #b42318); outline-offset: -2px; }

/* Automatic table search bar */
.autosearch-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }

/* Connection cards: same size, fixed result area, nothing jumps. */
.conn-grid { align-items: stretch; }
.conn-card { height: 100%; }
.conn-card .conn-actions { margin-top: auto; }
.conn-result { box-sizing: border-box; height: 188px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); font-size: 13px; overflow-wrap: anywhere; word-break: break-word; }
.conn-result strong { display: flex; align-items: center; gap: 6px; }
.conn-result ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink); }
.conn-result p { margin: 6px 0 0; }
.conn-result.ok { background: var(--good-wash); border-color: transparent; color: var(--good-ink); }
.conn-result.bad { background: var(--crit-wash); border-color: transparent; color: var(--crit-ink); }
.conn-result.warn { background: var(--warn-wash); border-color: transparent; color: var(--warn-ink); }
.conn-result-empty { display: flex; gap: 8px; align-items: flex-start; margin: 0; color: var(--muted); }
.conn-result-empty .ic { flex: none; margin-top: 2px; }

/* Notices with an icon keep the icon beside the text; plain notices flow as normal text. */
.notice.fx-note { display: flex; align-items: flex-start; gap: 10px; }

.sync-days { height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; padding: 0 8px; }
.range-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-form input[type=date] { height: 32px; border: 1px solid var(--line); border-radius: 9px; padding: 0 8px; font: inherit; background: var(--surface); color: var(--ink); }

.doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 4px 0; }
.doc-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.doc-item:hover { background: var(--surface-3); }
.doc-item strong { display: block; font-size: 14px; }
.doc-item small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: start; }
.doc-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.doc-toc a { color: var(--ink-2); font-size: 13px; text-decoration: none; }
.doc-toc a:hover { color: var(--ink); }
.doc-body { max-width: 860px; line-height: 1.6; font-size: 14.5px; overflow-wrap: anywhere; }
.doc-body h1 { font-size: 24px; margin: 0 0 12px; } .doc-body h2 { font-size: 19px; margin: 28px 0 8px; } .doc-body h3 { font-size: 16px; margin: 20px 0 6px; } .doc-body h4 { font-size: 14.5px; margin: 16px 0 4px; }
.doc-body p, .doc-body ul, .doc-body ol { margin: 8px 0; } .doc-body li.sub { margin-left: 18px; }
.doc-body code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.doc-body pre.doc-code { background: var(--surface-3); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.doc-body pre.doc-code code { background: none; padding: 0; }
.doc-body blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--line); color: var(--ink-2); }
@media (max-width: 900px) { .doc-layout { grid-template-columns: 1fr; } .doc-toc { display: none; } }

/* Connection cards: the pull period and Sync now sit on their own row, so nothing is cut off. */
.conn-actions form[data-conn-form="sync"] { order: -1; flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.conn-actions form[data-conn-form="sync"] .sync-days { flex: 1 1 140px; min-width: 0; }
.conn-actions form[data-conn-form="sync"] .btn { flex: none; }
.conn-actions form[data-conn-form="sync"] .sync-from { flex: 1 1 100%; height: 32px; border: 1px solid var(--line); border-radius: 9px; padding: 0 8px; font: inherit; background: var(--surface); color: var(--ink); }
.conn-actions form[data-conn-form="sync"] .sync-from[hidden] { display: none; }

/* Layout audit fixes: nothing sticks out of its card or the page, at any width. */
details.table-view { max-width: 100%; overflow-x: auto; }
.doc-layout > * { min-width: 0; }
.doc-body { min-width: 0; max-width: 100%; }
.doc-body table { display: block; max-width: 100%; overflow-x: auto; }
.doc-body .toolbar, .doc-body .autosearch-bar { max-width: 100%; }
.doc-body .search, .doc-body .search input { max-width: 100%; min-width: 0; box-sizing: border-box; }
.chips form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
.chips form.inline .sync-days { flex: 1 1 130px; min-width: 0; max-width: 100%; }
.chips form.inline .sync-from { flex: 1 1 100%; height: 32px; border: 1px solid var(--line); border-radius: 9px; padding: 0 8px; font: inherit; background: var(--surface); color: var(--ink); }
.chips form.inline .sync-from[hidden] { display: none; }
.tile { overflow-wrap: break-word; }
.tile .delta span { white-space: normal; }
@media (max-width: 900px) { .card > table.grid, .card > details > table.grid, .card > div > table.grid:not(.x) { max-width: 100%; } .card > table.grid { display: block; overflow-x: auto; } }

/* Campaign detail */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 24px; margin: 0; padding: 4px 0 2px; }
.facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: flex; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.timeline li:first-child { border-top: 0; }
.tl-date { flex: 0 0 110px; color: var(--muted); font-size: 13px; }
.tl-body { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.kpis:not(.custom):has(.tile:nth-child(7)) { grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); }

.policy-ok { display: flex; align-items: center; gap: 6px; margin: 6px 2px 10px; }

/* Overview: customizable cards */
.kpis.custom { grid-template-columns: repeat(auto-fill, minmax(192px, 1fr)); }
.kpis.custom .tile-value { font-size: clamp(22px, 2.1vw, 30px); white-space: nowrap; }
.kpis.custom .tile.hero .tile-value { font-size: clamp(24px, 2.4vw, 34px); }
.kpis.custom .tile.hero { grid-column: auto; }
.tile.wide { grid-column: span 2; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.plat-split { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.plat-split li { display: grid; grid-template-columns: minmax(0, 1.3fr) auto minmax(60px, 1fr) 34px; gap: 10px; align-items: center; }
.plat-split .ps-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.plat-split .ps-bar { display: block; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.plat-split .ps-bar i { display: block; height: 100%; border-radius: 99px; }
.cards-edit { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
.card-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.card-order li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.card-order .check { flex: 1; min-width: 0; border: 0; padding: 0; }
.card-order .check span span { display: block; }
.card-move { display: flex; gap: 2px; flex: none; }
@media (max-width: 700px) { .kpis.custom { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile.wide { grid-column: 1 / -1; } .plat-split li { grid-template-columns: 1fr auto; } .plat-split .ps-bar, .plat-split .muted { display: none; } }
