/*
 * A Polaris-like design system in plain CSS.
 *
 * Why imitate Polaris rather than use it: the real package needs React and a
 * build step, and this app is deliberately build-free. Merchants spend their day
 * in Shopify admin, so an app that looks native is one they trust and already
 * know how to drive — same spacing, same radii, same button weights, same badge
 * tones. Every colour is a token on :root so dark mode is one redefinition.
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #f3f3f3;
  --surface-hover: #f7f7f7;
  --surface-selected: #f1f1f1;
  --surface-inverse: #303030;
  --border: #e3e3e3;
  --border-strong: #c9c9c9;
  --border-input: #8a8a8a;
  --text: #303030;
  --text-2: #616161;
  --text-3: #8a8a8a;
  --text-inverse: #ffffff;
  --link: #005bd3;
  --focus: #005bd3;

  --btn-primary: #303030;
  --btn-primary-hover: #1a1a1a;
  --btn-primary-text: #ffffff;
  --btn-secondary: #ffffff;
  --btn-secondary-hover: #f7f7f7;
  --btn-critical: #c70a24;
  --btn-critical-hover: #a3081d;

  --success-bg: #cdfee1; --success-text: #0c5132; --success-strong: #29845a;
  --info-bg: #e0f0ff;    --info-text: #00527c;    --info-strong: #0094d5;
  --attention-bg: #fff1a8; --attention-text: #4f4700; --attention-strong: #c4a000;
  --warning-bg: #ffd6a4; --warning-text: #5e4200; --warning-strong: #e8a600;
  --critical-bg: #fedad9; --critical-text: #8e1f0b; --critical-strong: #e22c38;
  --neutral-bg: #e3e3e3; --neutral-text: #303030;

  --banner-info: #eaf4ff;
  --banner-success: #ebfff1;
  --banner-warning: #fff5ea;
  --banner-critical: #fff0ef;

  --diff-del-bg: #ffd9d6; --diff-del-text: #8e1f0b;
  --diff-ins-bg: #c9f4d8; --diff-ins-text: #0c5132;

  --serp-title: #1a0dab; --serp-url: #202124; --serp-text: #4d5156; --serp-bg: #ffffff;

  --code-bg: #1e1e1e; --code-text: #e6e6e6;
  --skeleton: #e3e3e3; --skeleton-shine: #f3f3f3;
  --backdrop: rgba(0, 0, 0, 0.5);

  --shadow-card: 0 1px 0 0 rgba(26, 26, 26, 0.07), 0 0 0 1px rgba(26, 26, 26, 0.05);
  --shadow-btn: 0 -1px 0 0 #b5b5b5 inset, 0 0 0 1px rgba(0, 0, 0, 0.1) inset, 0 0.5px 0 1.5px #fff inset;
  --shadow-primary: 0 -1px 0 1px rgba(0, 0, 0, 0.8) inset, 0 0 0 1px #303030 inset, 0 0.5px 0 1.5px rgba(255, 255, 255, 0.25) inset;
  --shadow-pop: 0 8px 16px -4px rgba(26, 26, 26, 0.22), 0 0 0 1px rgba(26, 26, 26, 0.08);
  --shadow-modal: 0 26px 48px -12px rgba(26, 26, 26, 0.4), 0 0 0 1px rgba(26, 26, 26, 0.08);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --serp-font: arial, sans-serif;

  --topbar-h: 56px;
  --nav-w: 240px;
}

/* Dark mode, twice: once for "follow the system" (unless the user forced light),
   once for an explicit dark choice. CSS cannot share a block between the two. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1a1a1a; --surface: #262626; --surface-2: #2e2e2e; --surface-3: #333333;
    --surface-hover: #2f2f2f; --surface-selected: #383838; --surface-inverse: #e3e3e3;
    --border: #3a3a3a; --border-strong: #4d4d4d; --border-input: #6b6b6b;
    --text: #e3e3e3; --text-2: #b5b5b5; --text-3: #8a8a8a; --text-inverse: #1a1a1a;
    --link: #6cb4ff; --focus: #6cb4ff;
    --btn-primary: #e3e3e3; --btn-primary-hover: #ffffff; --btn-primary-text: #1a1a1a;
    --btn-secondary: #333333; --btn-secondary-hover: #3d3d3d;
    --btn-critical: #e22c38; --btn-critical-hover: #ff4a55;
    --success-bg: #0c3a24; --success-text: #8ef0b5; --success-strong: #3fbf7f;
    --info-bg: #08324d; --info-text: #9ed8ff; --info-strong: #3aaeef;
    --attention-bg: #3d3600; --attention-text: #f5e27a; --attention-strong: #d9bd2a;
    --warning-bg: #4a2e00; --warning-text: #ffcf8a; --warning-strong: #f0a52a;
    --critical-bg: #4d1410; --critical-text: #ffb3ac; --critical-strong: #ff5c5c;
    --neutral-bg: #3a3a3a; --neutral-text: #e3e3e3;
    --banner-info: #10283a; --banner-success: #0f2a1d; --banner-warning: #33240d; --banner-critical: #3a1714;
    --diff-del-bg: #5a1d17; --diff-del-text: #ffc4bd; --diff-ins-bg: #134a2c; --diff-ins-text: #b8f5cf;
    --serp-title: #99c3ff; --serp-url: #dadce0; --serp-text: #bdc1c6; --serp-bg: #202124;
    --code-bg: #141414; --code-text: #e6e6e6;
    --skeleton: #333333; --skeleton-shine: #3d3d3d;
    --backdrop: rgba(0, 0, 0, 0.65);
    --shadow-card: 0 0 0 1px #3a3a3a;
    --shadow-btn: 0 0 0 1px #4d4d4d inset;
    --shadow-primary: 0 0 0 1px #e3e3e3 inset;
    --shadow-pop: 0 8px 20px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px #3a3a3a;
    --shadow-modal: 0 26px 48px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px #3a3a3a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1a1a; --surface: #262626; --surface-2: #2e2e2e; --surface-3: #333333;
  --surface-hover: #2f2f2f; --surface-selected: #383838; --surface-inverse: #e3e3e3;
  --border: #3a3a3a; --border-strong: #4d4d4d; --border-input: #6b6b6b;
  --text: #e3e3e3; --text-2: #b5b5b5; --text-3: #8a8a8a; --text-inverse: #1a1a1a;
  --link: #6cb4ff; --focus: #6cb4ff;
  --btn-primary: #e3e3e3; --btn-primary-hover: #ffffff; --btn-primary-text: #1a1a1a;
  --btn-secondary: #333333; --btn-secondary-hover: #3d3d3d;
  --btn-critical: #e22c38; --btn-critical-hover: #ff4a55;
  --success-bg: #0c3a24; --success-text: #8ef0b5; --success-strong: #3fbf7f;
  --info-bg: #08324d; --info-text: #9ed8ff; --info-strong: #3aaeef;
  --attention-bg: #3d3600; --attention-text: #f5e27a; --attention-strong: #d9bd2a;
  --warning-bg: #4a2e00; --warning-text: #ffcf8a; --warning-strong: #f0a52a;
  --critical-bg: #4d1410; --critical-text: #ffb3ac; --critical-strong: #ff5c5c;
  --neutral-bg: #3a3a3a; --neutral-text: #e3e3e3;
  --banner-info: #10283a; --banner-success: #0f2a1d; --banner-warning: #33240d; --banner-critical: #3a1714;
  --diff-del-bg: #5a1d17; --diff-del-text: #ffc4bd; --diff-ins-bg: #134a2c; --diff-ins-text: #b8f5cf;
  --serp-title: #99c3ff; --serp-url: #dadce0; --serp-text: #bdc1c6; --serp-bg: #202124;
  --code-bg: #141414; --code-text: #e6e6e6;
  --skeleton: #333333; --skeleton-shine: #3d3d3d;
  --backdrop: rgba(0, 0, 0, 0.65);
  --shadow-card: 0 0 0 1px #3a3a3a;
  --shadow-btn: 0 0 0 1px #4d4d4d inset;
  --shadow-primary: 0 0 0 1px #e3e3e3 inset;
  --shadow-pop: 0 8px 20px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px #3a3a3a;
  --shadow-modal: 0 26px 48px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px #3a3a3a;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 13px; line-height: 20px; font-weight: 450;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: var(--radius-sm); }
[hidden] { display: 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 { position: absolute; left: -9999px; top: 8px; z-index: 100; }
.skip-link:focus { left: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius); box-shadow: var(--shadow-pop); }

/* Text */
.text-heading-lg { font-size: 20px; line-height: 24px; font-weight: 700; letter-spacing: -0.2px; }
.text-heading-md { font-size: 14px; line-height: 20px; font-weight: 650; }
.text-heading-sm { font-size: 13px; line-height: 20px; font-weight: 650; }
.text-subdued, .muted { color: var(--text-2); }
.text-faint { color: var(--text-3); }
.text-sm { font-size: 12px; line-height: 16px; }
.text-strong { font-weight: 650; }
.text-success { color: var(--success-strong); }
.text-critical { color: var(--critical-strong); }
.text-warning { color: var(--warning-text); }
.text-mono { font-family: var(--mono); font-size: 12px; }
.text-break { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Layout helpers */
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.stack-xs { display: flex; flex-direction: column; gap: var(--s1); }
.inline { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.inline-tight { display: inline-flex; align-items: center; gap: var(--s1); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.layout-main-aside { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .layout-main-aside { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ── App frame ──────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4);
  background: #1a1a1a; color: #e3e3e3;
}
.topbar .brand { display: flex; align-items: center; gap: var(--s2); font-weight: 650; font-size: 14px; color: #fff; white-space: nowrap; }
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--radius); display: grid; place-items: center;
  background: linear-gradient(135deg, #36fba1, #0094d5); color: #0b1d14;
}
.topbar .spacer { flex: 1; }
.topbar-select {
  appearance: none; background: #303030 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23b5b5b5' d='M10 13.5 6 9.5h8z'/%3E%3C/svg%3E") no-repeat right 6px center;
  color: #e3e3e3; border: 1px solid #4a4a4a; border-radius: var(--radius); height: 32px;
  padding: 0 28px 0 10px; font: inherit; max-width: 240px; min-width: 0;
}
.topbar-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 32px;
  border: 0; border-radius: var(--radius); background: transparent; color: #e3e3e3; cursor: pointer;
}
.topbar-btn:hover { background: #303030; }
.count-dot {
  position: absolute; top: 1px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-full); background: #e22c38; color: #fff; font-size: 11px; line-height: 18px;
  font-weight: 650; text-align: center;
}
.menu-btn { display: none; }

.embedded-bar {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.embedded-bar .spacer { flex: 1; }
.embedded-bar .topbar-select { background-color: var(--surface); color: var(--text); border-color: var(--border-strong);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23616161' d='M10 13.5 6 9.5h8z'/%3E%3C/svg%3E"); }
.embedded-bar .topbar-btn { color: var(--text); }
.embedded-bar .topbar-btn:hover { background: var(--surface-hover); }

.frame { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.frame.no-nav { grid-template-columns: minmax(0, 1fr); }
.nav {
  position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: var(--s3) var(--s2); background: var(--surface-3); border-right: 1px solid var(--border);
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s2); border-radius: var(--radius);
  color: var(--text); font-weight: 550; text-decoration: none;
}
.nav-link:hover { background: var(--surface-hover); text-decoration: none; }
.nav-link.is-active { background: var(--surface); box-shadow: var(--shadow-card); font-weight: 650; }
.nav-link .icon { color: var(--text-2); }
.nav-link.is-active .icon { color: var(--text); }
.nav-link .nav-count {
  margin-left: auto; background: var(--neutral-bg); color: var(--neutral-text);
  border-radius: var(--radius); padding: 0 6px; font-size: 12px; font-weight: 550;
}
.nav-foot { margin-top: var(--s4); padding: var(--s2); }

.main { min-width: 0; }
.page { max-width: 1000px; margin: 0 auto; padding: var(--s6) var(--s6) var(--s10); }
.page.page-wide { max-width: 1240px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-header .page-title-group { display: flex; gap: var(--s2); align-items: flex-start; min-width: 0; }
.page-header .subtitle { color: var(--text-2); margin-top: 2px; max-width: 640px; }
.page-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.back-btn { margin-top: -2px; }

@media (max-width: 768px) {
  .frame { grid-template-columns: minmax(0, 1fr); }
  .nav {
    display: none; position: fixed; top: var(--topbar-h); left: 0; right: 0; height: auto; max-height: calc(100vh - var(--topbar-h));
    z-index: 25; border-right: 0; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-pop);
  }
  .nav.is-open { display: block; }
  .menu-btn { display: inline-grid; }
  .topbar .brand-name { display: none; }
  .topbar-select { max-width: 150px; }
  .page { padding: var(--s4) var(--s4) var(--s10); }
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); min-width: 0; }
.card-section { padding: var(--s4); }
.card-section + .card-section { border-top: 1px solid var(--border); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s4) var(--s4) 0; flex-wrap: wrap; }
.card-header + .card-section { padding-top: var(--s3); }
.card-subdued { background: var(--surface-2); }
.card-footer { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; }
.card.is-clickable { cursor: pointer; transition: box-shadow 0.12s; }
.card.is-clickable:hover { box-shadow: var(--shadow-pop); }
@media (max-width: 640px) { .card { border-radius: var(--radius); } }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: var(--radius);
  font-size: 12px; line-height: 16px; font-weight: 550; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-text);
}
.badge .icon { width: 14px; height: 14px; margin-left: -3px; }
.badge.tone-success { background: var(--success-bg); color: var(--success-text); }
.badge.tone-info { background: var(--info-bg); color: var(--info-text); }
.badge.tone-attention { background: var(--attention-bg); color: var(--attention-text); }
.badge.tone-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge.tone-critical { background: var(--critical-bg); color: var(--critical-text); }
.badge.tone-new { background: transparent; box-shadow: 0 0 0 1px var(--border-strong) inset; color: var(--text-2); }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 2px; background: currentColor; opacity: 0.8; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 28px; padding: 4px 12px; border: 0; border-radius: var(--radius); cursor: pointer;
  font-weight: 550; font-size: 13px; line-height: 20px; white-space: nowrap; text-decoration: none;
  background: var(--btn-secondary); color: var(--text); box-shadow: var(--shadow-btn);
  transition: background 0.1s;
}
.btn:hover { background: var(--btn-secondary-hover); text-decoration: none; }
.btn:active { box-shadow: 0 2px 1px 0 rgba(26, 26, 26, 0.2) inset; }
.btn.btn-primary { background: var(--btn-primary); color: var(--btn-primary-text); box-shadow: var(--shadow-primary); }
.btn.btn-primary:hover { background: var(--btn-primary-hover); }
.btn.btn-critical { background: var(--btn-critical); color: #fff; box-shadow: 0 -1px 0 1px rgba(0,0,0,.2) inset; }
.btn.btn-critical:hover { background: var(--btn-critical-hover); }
.btn.btn-plain, .btn.btn-tertiary { background: transparent; box-shadow: none; color: var(--link); padding: 4px 6px; }
.btn.btn-tertiary { color: var(--text); }
.btn.btn-plain:hover, .btn.btn-tertiary:hover { background: var(--surface-hover); }
.btn.btn-plain.tone-critical { color: var(--critical-strong); }
.btn.btn-sm { min-height: 24px; padding: 2px 8px; font-size: 12px; }
.btn.btn-lg { min-height: 36px; padding: 6px 16px; font-size: 14px; }
.btn.btn-icon { padding: 4px; min-width: 28px; }
.btn.btn-full { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-2) transparent var(--text-2) transparent;
  animation: spin 0.7s linear infinite;
}
.btn.btn-primary.is-loading::after { border-color: var(--btn-primary-text) transparent var(--btn-primary-text) transparent; }
.btn-group { display: inline-flex; gap: var(--s2); flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; }
.link-btn:hover { text-decoration: underline; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--text); animation: spin 0.7s linear infinite;
}
.spinner.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* ── Icons ──────────────────────────────────────────────────────────────── */
.icon {
  width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-tile {
  width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: -0.2px; flex: 0 0 auto;
  background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border) inset;
}

/* ── Banners ────────────────────────────────────────────────────────────── */
.banner {
  display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius-lg);
  background: var(--banner-info); box-shadow: 0 0 0 1px var(--border) inset; align-items: flex-start;
}
.banner .banner-icon { color: var(--info-strong); margin-top: 0; }
.banner.tone-success { background: var(--banner-success); } .banner.tone-success .banner-icon { color: var(--success-strong); }
.banner.tone-warning { background: var(--banner-warning); } .banner.tone-warning .banner-icon { color: var(--warning-strong); }
.banner.tone-critical { background: var(--banner-critical); } .banner.tone-critical .banner-icon { color: var(--critical-strong); }
.banner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s1); }
.banner-title { font-weight: 650; }
.banner-actions { display: flex; gap: var(--s2); margin-top: var(--s2); flex-wrap: wrap; }
.banner ul { margin: 0; padding-left: 18px; }
.banner-dismiss { margin: -4px -8px -4px 0; }

.demo-strip {
  display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s4); font-size: 12px;
  background: var(--attention-bg); color: var(--attention-text); flex-wrap: wrap;
}
.demo-strip .spacer { flex: 1; }
.demo-strip .link-btn { color: inherit; text-decoration: underline; font-weight: 600; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.field-label { font-weight: 550; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.field-label .optional { color: var(--text-2); font-weight: 450; }
.help { color: var(--text-2); font-size: 12px; line-height: 16px; }
.field-error { color: var(--critical-text); font-size: 12px; line-height: 16px; display: flex; gap: 4px; align-items: flex-start; }
.field-error .icon { width: 16px; height: 16px; color: var(--critical-strong); }
.input, .select, .textarea {
  width: 100%; min-height: 32px; padding: 5px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius);
  border-top-color: #898f94;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-2); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-3); color: var(--text-2); border-color: var(--border); cursor: not-allowed; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--critical-strong); background: var(--banner-critical); }
.textarea { resize: vertical; min-height: 72px; line-height: 20px; }
.textarea.textarea-code { font-family: var(--mono); font-size: 12px; min-height: 140px; }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%238a8a8a' d='M10 4.5 13 8H7zm0 11L7 12h6z'/%3E%3C/svg%3E") no-repeat right 8px center;
}
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; }
.search-field { position: relative; }
.search-field .icon { position: absolute; left: 8px; top: 6px; color: var(--text-3); pointer-events: none; }
.search-field .input { padding-left: 32px; }
.checkbox { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; }
.checkbox input, input[type="checkbox"].cb, input[type="radio"].cb {
  width: 16px; height: 16px; margin: 0; accent-color: var(--btn-primary); cursor: pointer; flex: 0 0 auto;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.secret-saved {
  display: flex; align-items: center; gap: var(--s2); padding: 5px 12px; min-height: 32px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
}
.secret-saved .dots { letter-spacing: 2px; color: var(--text-2); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.switch-track {
  width: 36px; height: 20px; border-radius: var(--radius-full); background: var(--border-input);
  position: relative; transition: background 0.15s; flex: 0 0 auto;
}
.switch-track::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--success-strong); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.5; cursor: not-allowed; }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--radius); background: var(--surface-3);
  box-shadow: 0 0 0 1px var(--border) inset; max-width: 100%; overflow-x: auto;
}
.segmented button {
  border: 0; background: transparent; padding: 3px 10px; border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 550; color: var(--text-2); white-space: nowrap; min-height: 24px;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.segmented button[disabled] { opacity: 0.45; cursor: not-allowed; }
.segmented.tone-mode button[data-value="on"][aria-checked="true"] { background: var(--success-bg); color: var(--success-text); }
.segmented.tone-mode button[data-value="monitor"][aria-checked="true"] { background: var(--info-bg); color: var(--info-text); }

/* Multiselect chips */
.chip-group { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-full);
  box-shadow: 0 0 0 1px var(--border-strong) inset; background: var(--surface); cursor: pointer; font-weight: 550;
}
.chip input { margin: 0; accent-color: var(--btn-primary); }
.chip.is-on { background: var(--surface-selected); box-shadow: 0 0 0 1.5px var(--text) inset; }
.chip.is-disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px; padding: var(--s2); overflow-x: auto; scrollbar-width: thin;
  border-bottom: 1px solid var(--border);
}
.tab {
  border: 0; background: transparent; padding: 6px 12px; border-radius: var(--radius); cursor: pointer;
  font-weight: 550; color: var(--text-2); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.tab:hover { background: var(--surface-hover); color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-selected); color: var(--text); }
.tab .tab-count { font-size: 12px; color: var(--text-2); font-weight: 450; }

/* ── Index table ────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.itable { width: 100%; border-collapse: collapse; }
.itable th {
  text-align: left; font-weight: 550; font-size: 12px; color: var(--text-2); padding: 6px var(--s3);
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.itable td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.itable tbody tr:last-child td { border-bottom: 0; }
.itable tbody tr:hover { background: var(--surface-hover); }
.itable tbody tr.is-selected { background: var(--surface-selected); }
.itable tbody tr.is-clickable { cursor: pointer; }
.itable .col-check { width: 36px; padding-right: 0; }
.itable .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.itable .col-actions { text-align: right; white-space: nowrap; }
.itable .cell-title { font-weight: 550; }
.itable .cell-sub { color: var(--text-2); font-size: 12px; line-height: 16px; }
.bulk-bar {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3);
  background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.pager { display: flex; align-items: center; justify-content: center; gap: var(--s2); padding: var(--s3); border-top: 1px solid var(--border); }

/* Phones: rows become stacked cards so nothing scrolls sideways. */
@media (max-width: 640px) {
  .itable thead { display: none; }
  .itable, .itable tbody, .itable tr, .itable td { display: block; width: 100%; }
  .itable tr { padding: var(--s3); border-bottom: 1px solid var(--border); position: relative; }
  .itable tbody tr:last-child { border-bottom: 0; }
  .itable td { border: 0; padding: 2px 0; display: flex; gap: var(--s3); justify-content: space-between; align-items: center; text-align: right; }
  .itable td::before { content: attr(data-label); color: var(--text-2); font-size: 12px; text-align: left; flex: 0 0 auto; }
  .itable td[data-label=""]::before, .itable td:not([data-label])::before { content: none; }
  .itable td.col-primary { display: block; text-align: left; padding-right: 28px; margin-bottom: var(--s1); }
  .itable td.col-primary::before { content: none; }
  .itable td.col-check { position: absolute; right: var(--s3); top: var(--s3); width: auto; padding: 0; }
  .itable td.col-actions { justify-content: flex-end; margin-top: var(--s2); }
  .itable td.col-actions::before { content: none; }
  .itable .col-num { text-align: right; }
}

/* ── Modal & sheet ──────────────────────────────────────────────────────── */
.backdrop {
  position: fixed; inset: 0; z-index: 60; background: var(--backdrop); display: flex;
  align-items: center; justify-content: center; padding: var(--s4); animation: fade 0.12s ease-out;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal);
  width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  animation: rise 0.16s ease-out;
}
.modal.modal-sm { width: min(440px, 100%); }
.modal.modal-lg { width: min(860px, 100%); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal-body { padding: var(--s4); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s4); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); flex-wrap: wrap; }
.backdrop.is-sheet { justify-content: flex-end; align-items: stretch; padding: 0; }
.backdrop.is-sheet .modal { width: min(560px, 100%); max-height: none; height: 100%; border-radius: 0; animation: slide 0.18s ease-out; }
.backdrop.is-sheet .modal-header { border-radius: 0; }
@media (max-width: 640px) {
  .backdrop { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toast-region {
  position: fixed; bottom: var(--s6); left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; flex-direction: column; gap: var(--s2); align-items: center; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: var(--s3); padding: 10px 12px 10px 16px; border-radius: var(--radius);
  background: #1a1a1a; color: #fff; box-shadow: var(--shadow-pop); font-weight: 550; animation: rise 0.16s ease-out;
  max-width: 100%;
}
.toast.tone-critical { background: #8e1f0b; }
.toast .toast-action { color: #fff; text-decoration: underline; background: none; border: 0; cursor: pointer; font-weight: 650; padding: 0; white-space: nowrap; }
.toast .toast-close { background: none; border: 0; color: #fff; opacity: 0.8; cursor: pointer; padding: 0; display: grid; }

/* ── Popover ────────────────────────────────────────────────────────────── */
.popover {
  position: absolute; z-index: 50; background: var(--surface); color: var(--text); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); width: min(380px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto;
}
.popover-section { padding: var(--s3) var(--s4); }
.popover-section + .popover-section { border-top: 1px solid var(--border); }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s10) var(--s4); }
.empty-state .empty-illustration {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
}
.empty-state .empty-illustration .icon { width: 32px; height: 32px; }
.empty-state p { max-width: 420px; color: var(--text-2); }

/* ── Skeleton ───────────────────────────────────────────────────────────── */
.skeleton {
  display: block; border-radius: var(--radius-sm); height: 12px;
  background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-shine) 50%, var(--skeleton) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton.sk-title { height: 20px; width: 40%; }
.skeleton.sk-block { height: 120px; border-radius: var(--radius-lg); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .spinner, .btn.is-loading::after { animation-duration: 3s; } }

/* ── Progress ───────────────────────────────────────────────────────────── */
.progress { height: 8px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; box-shadow: 0 0 0 1px var(--border) inset; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--text); transition: width 0.3s; }
.progress.tone-success .progress-fill { background: var(--success-strong); }
.progress.tone-warning .progress-fill { background: var(--warning-strong); }
.progress.tone-critical .progress-fill { background: var(--critical-strong); }
.progress.tone-info .progress-fill { background: var(--info-strong); }
.progress.progress-sm { height: 6px; }
.score-cell { display: flex; align-items: center; gap: var(--s2); min-width: 90px; }
.score-cell .progress { flex: 1; min-width: 40px; }

/* ── Home ───────────────────────────────────────────────────────────────── */
.health { display: flex; gap: var(--s6); align-items: center; flex-wrap: wrap; }
.ring { position: relative; width: 132px; height: 132px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-track { stroke: var(--surface-3); }
.ring .ring-value { transition: stroke-dashoffset 0.6s ease-out; stroke-linecap: round; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label .ring-score { font-size: 32px; line-height: 36px; font-weight: 700; letter-spacing: -0.5px; }
.breakdown { flex: 1 1 260px; display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.breakdown-row { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 2px var(--s3); align-items: center; }
.breakdown-row .progress { grid-column: 1 / -1; }
.attention-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 900px) { .attention-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.attention-item {
  display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); text-decoration: none; box-shadow: 0 0 0 1px var(--border) inset;
}
.attention-item:hover { background: var(--surface-hover); text-decoration: none; box-shadow: 0 0 0 1px var(--border-strong) inset; }
.attention-item .big { font-size: 24px; line-height: 32px; font-weight: 700; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist-item { display: flex; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); align-items: flex-start; }
.checklist-item:first-child { border-top: 0; }
.check-circle {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed var(--border-input); flex: 0 0 auto;
  display: grid; place-items: center; margin-top: 1px;
}
.check-circle.is-done { background: var(--text); border: 0; color: var(--surface); }
.check-circle .icon { width: 16px; height: 16px; }
.checklist-item.is-done .checklist-label { color: var(--text-2); text-decoration: line-through; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .stat-value { font-size: 20px; line-height: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.compare-bars { display: flex; flex-direction: column; gap: var(--s2); }
.compare-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 56px; align-items: center; gap: var(--s2); }
.compare-track { height: 14px; background: var(--surface-3); border-radius: var(--radius-sm); overflow: hidden; }
.compare-fill { height: 100%; border-radius: var(--radius-sm); }
.compare-fill.is-treated { background: var(--success-strong); }
.compare-fill.is-holdout { background: var(--border-input); }

/* ── Review ─────────────────────────────────────────────────────────────── */
.review-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.review-list { position: sticky; top: calc(var(--topbar-h) + var(--s4)); max-height: calc(100vh - var(--topbar-h) - 32px); display: flex; flex-direction: column; overflow: hidden; }
.review-list .list-scroll { overflow-y: auto; flex: 1; }
.queue-item {
  display: flex; gap: var(--s2); padding: var(--s3); border-bottom: 1px solid var(--border); cursor: pointer;
  align-items: flex-start; position: relative;
}
.queue-item:hover { background: var(--surface-hover); }
.queue-item.is-active { background: var(--surface-selected); }
.queue-item.is-active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--text); }
.queue-item .q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.queue-item .q-preview { color: var(--text-2); font-size: 12px; line-height: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.diff-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--s3); align-items: stretch; }
.diff-pane { padding: var(--s3); border-radius: var(--radius); background: var(--surface-2); box-shadow: 0 0 0 1px var(--border) inset; overflow-wrap: anywhere; min-width: 0; }
.diff-pane .diff-label { font-size: 12px; color: var(--text-2); font-weight: 550; margin-bottom: 4px; display: block; }
.diff-arrow { display: grid; place-items: center; color: var(--text-3); }
.diff-del { background: var(--diff-del-bg); color: var(--diff-del-text); text-decoration: line-through; border-radius: 3px; padding: 0 1px; }
.diff-ins { background: var(--diff-ins-bg); color: var(--diff-ins-text); border-radius: 3px; padding: 0 1px; }
.diff-empty { color: var(--text-3); font-style: italic; }
@media (max-width: 640px) {
  .diff-grid { grid-template-columns: minmax(0, 1fr); }
  .diff-arrow { transform: rotate(90deg); }
}
.counter { font-size: 12px; font-variant-numeric: tabular-nums; display: inline-flex; gap: 6px; align-items: center; }
.counter.is-ok { color: var(--success-strong); }
.counter.is-short { color: var(--warning-text); }
.counter.is-long { color: var(--critical-text); font-weight: 650; }
.counter-bar { position: relative; height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.counter-bar .zone { position: absolute; top: 0; bottom: 0; background: var(--success-bg); }
.counter-bar .mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); }
.variant-option {
  display: flex; gap: var(--s3); padding: var(--s3); border-radius: var(--radius); cursor: pointer;
  box-shadow: 0 0 0 1px var(--border) inset; align-items: flex-start;
}
.variant-option:hover { background: var(--surface-hover); }
.variant-option.is-selected { box-shadow: 0 0 0 2px var(--text) inset; background: var(--surface-2); }
.variant-option input { margin-top: 3px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.check-row { display: flex; gap: var(--s2); align-items: flex-start; }
.check-row .icon { width: 18px; height: 18px; margin-top: 1px; }
.check-row.is-pass .icon { color: var(--success-strong); }
.check-row.is-warn .icon { color: var(--warning-strong); }
.check-row.is-fail .icon { color: var(--critical-strong); }
.kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 4px; font-size: 11px; line-height: 18px; text-align: center;
  background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong) inset, 0 -1px 0 var(--border-strong) inset; color: var(--text-2); font-family: var(--mono);
}
.shortcut-hint { display: flex; gap: var(--s3); flex-wrap: wrap; color: var(--text-2); font-size: 12px; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: var(--s3) var(--s4); display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center;
}
@media (max-width: 960px) {
  .review-layout { grid-template-columns: minmax(0, 1fr); }
  .review-list { position: static; max-height: none; }
  .review-layout.has-selection .review-list { display: none; }
  .review-layout:not(.has-selection) .review-detail { display: none; }
}
@media (min-width: 961px) { .mobile-only { display: none !important; } }

/* SERP preview */
.serp { background: var(--serp-bg); border-radius: var(--radius); padding: var(--s4); box-shadow: 0 0 0 1px var(--border) inset; font-family: var(--serp-font); }
.serp-inner { max-width: 600px; }
.serp.is-mobile .serp-inner { max-width: 360px; }
.serp-site { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.serp-favicon { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--serp-url); box-shadow: 0 0 0 1px var(--border) inset; flex: 0 0 auto; }
.serp-sitename { font-size: 14px; line-height: 20px; color: var(--serp-url); }
.serp-url { font-size: 12px; line-height: 18px; color: var(--serp-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-title { font-size: 20px; line-height: 26px; color: var(--serp-title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 3px; font-weight: 400; }
.serp.is-mobile .serp-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 18px; line-height: 24px; }
.serp-desc { font-size: 14px; line-height: 22px; color: var(--serp-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.serp.is-mobile .serp-desc { -webkit-line-clamp: 3; }
.serp-desc.is-placeholder { font-style: italic; opacity: 0.75; }

/* ── Technical / code ───────────────────────────────────────────────────── */
.toggle-row { display: flex; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--border); align-items: flex-start; flex-wrap: wrap; }
.toggle-row:first-child { border-top: 0; padding-top: 0; }
.toggle-row .toggle-info { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toggle-row .toggle-controls { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.code-block { position: relative; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); overflow: hidden; }
.code-block pre { margin: 0; padding: var(--s4); overflow-x: auto; font-size: 12px; line-height: 18px; max-height: 340px; white-space: pre; }
.code-block .code-copy { position: absolute; top: var(--s2); right: var(--s2); }
.code-block .code-copy .btn { background: #303030; color: #fff; box-shadow: 0 0 0 1px #555 inset; }
.code-block .code-copy .btn:hover { background: #3d3d3d; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: var(--s2); }
.steps li { counter-increment: step; display: flex; gap: var(--s3); align-items: flex-start; }
.steps li::before {
  content: counter(step); flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); box-shadow: 0 0 0 1px var(--border-strong) inset; font-size: 12px; font-weight: 650;
}
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--s4); }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 0; } .kv dd { margin-bottom: var(--s2); } }
details.disclosure > summary { cursor: pointer; color: var(--link); font-weight: 550; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸"; font-size: 11px; transition: transform 0.15s; }
details.disclosure[open] > summary::before { transform: rotate(90deg); }

/* ── Integrations ───────────────────────────────────────────────────────── */
.integration-card { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); height: 100%; text-align: left; border: 0; font: inherit; color: inherit; width: 100%; }
.integration-card.is-soon { opacity: 0.72; }
.integration-head { display: flex; gap: var(--s3); align-items: flex-start; }
.unlocks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); }
.unlocks li { display: flex; gap: 6px; align-items: flex-start; }
.unlocks .icon { width: 16px; height: 16px; color: var(--success-strong); margin-top: 2px; }
.test-result { display: flex; gap: var(--s2); padding: var(--s3); border-radius: var(--radius); align-items: flex-start; }
.test-result.is-ok { background: var(--banner-success); }
.test-result.is-fail { background: var(--banner-critical); }

/* ── Settings ───────────────────────────────────────────────────────────── */
.settings-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s2) var(--s6); padding: var(--s4) 0; border-top: 1px solid var(--border); align-items: start; }
.settings-field:first-child { border-top: 0; padding-top: 0; }
.settings-field:last-child { padding-bottom: 0; }
.settings-field .sf-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-field .sf-control { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.settings-field.is-inherited .sf-control > :not(.inherit-line) { opacity: 0.7; }
.settings-field.is-dirty { box-shadow: -3px 0 0 0 var(--attention-strong); padding-left: var(--s3); margin-left: calc(-1 * var(--s3)); }
.inherit-line { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
@media (max-width: 720px) { .settings-field { grid-template-columns: minmax(0, 1fr); } }
.save-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: var(--topbar-h); padding: 0 var(--s4);
  display: flex; align-items: center; gap: var(--s3); background: #1a1a1a; color: #fff; box-shadow: var(--shadow-pop);
  animation: fade 0.12s;
}
.save-bar .spacer { flex: 1; }
.save-bar .btn:not(.btn-primary) { background: #303030; color: #fff; box-shadow: 0 0 0 1px #555 inset; }
.save-bar .btn.btn-primary { background: #fff; color: #1a1a1a; box-shadow: none; }
.save-bar .btn.btn-primary.is-loading::after { border-color: #1a1a1a transparent #1a1a1a transparent; }
.section-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + var(--s4)); }
.section-nav a { padding: 4px var(--s2); border-radius: var(--radius-sm); color: var(--text-2); font-weight: 550; }
.section-nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.settings-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s5); align-items: start; }
@media (max-width: 900px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } .section-nav { display: none; } }

/* ── Activity ───────────────────────────────────────────────────────────── */
.notif { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); align-items: flex-start; }
.notif:first-child { border-top: 0; }
.notif.is-unread { background: var(--surface-2); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: transparent; }
.notif.is-unread .notif-dot { background: var(--info-strong); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.json-mini { font-family: var(--mono); font-size: 11px; color: var(--text-2); overflow-wrap: anywhere; }

/* ── Approval mode ──────────────────────────────────────────────────────── */
.mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 640px) { .mode-options { grid-template-columns: minmax(0, 1fr); } }
.mode-option {
  display: flex; flex-direction: column; gap: var(--s2); text-align: left; padding: var(--s4); cursor: pointer;
  border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font: inherit;
  box-shadow: 0 0 0 1px var(--border-strong) inset; transition: box-shadow 0.12s, background 0.12s;
}
.mode-option:hover { background: var(--surface-hover); }
.mode-option[aria-checked="true"] { box-shadow: 0 0 0 2px var(--text) inset; background: var(--surface-2); }
.mode-option .mode-head { display: flex; align-items: center; gap: var(--s2); }
.mode-radio { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--border-input) inset; flex: 0 0 auto; display: grid; place-items: center; }
.mode-option[aria-checked="true"] .mode-radio { box-shadow: 0 0 0 5px var(--text) inset; }
.mode-option ul { margin: 0; padding-left: 18px; color: var(--text-2); }
.mode-option.is-busy { opacity: 0.6; pointer-events: none; }
.mode-compact { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.safety-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.safety-list li { display: flex; gap: var(--s2); align-items: flex-start; }
.safety-list .icon { color: var(--success-strong); width: 18px; height: 18px; margin-top: 1px; }
.settings-field.is-dimmed .sf-control, .settings-field.is-dimmed .sf-info { opacity: 0.5; }
.mode-option[aria-disabled="true"] { opacity: 0.75; background: var(--surface-2); }
.mode-option[aria-disabled="true"] .mode-radio { opacity: 0.4; }

/* ── Section anatomy (shared by every screen) ───────────────────────────── */
.section-head { display: flex; gap: var(--s3); align-items: flex-start; flex-wrap: wrap; }
.section-head .grow { flex: 1 1 260px; }
.section-card .section-head:not(.bare) { margin-bottom: var(--s4); }
.section-icon {
  width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center; flex: 0 0 auto;
  background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border) inset;
}
.feature-row { display: flex; gap: var(--s6); align-items: center; flex-wrap: wrap; }
.embed-illustration { width: 220px; max-width: 100%; height: auto; flex: 0 1 220px; }
.embed-illustration .ill-frame { fill: var(--surface-2); stroke: var(--border-strong); }
.embed-illustration .ill-panel { fill: var(--surface); stroke: var(--border); }
.embed-illustration .ill-line { stroke: var(--border-strong); stroke-width: 4; stroke-linecap: round; fill: none; }
.embed-illustration .ill-block { fill: var(--surface-3); }
.embed-illustration .ill-highlight { fill: var(--info-bg); stroke: var(--info-strong); stroke-width: 1.5; }
.embed-illustration .ill-switch { fill: var(--success-strong); }
.embed-illustration .ill-knob { fill: #fff; }
.legend-row { display: flex; gap: var(--s4); flex-wrap: wrap; color: var(--text-2); padding: 0 var(--s1); }
.toggle-list { display: flex; flex-direction: column; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); align-items: flex-start; }
.feed li:first-child { border-top: 0; padding-top: var(--s1); }
.feed-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: 0 0 auto; }
pre.numbered { counter-reset: line; }
pre.numbered .code-line { counter-increment: line; }
pre.numbered .code-line::before { content: counter(line); display: inline-block; width: 2.4em; margin-right: 1em; text-align: right; color: #7a7a7a; user-select: none; }
.code-block pre { padding-top: 44px; }
.code-block .code-copy { z-index: 1; }

/* Integrations */
.integration-card { position: relative; cursor: pointer; }
.integration-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ribbon {
  display: inline-block; font-size: 11px; line-height: 16px; font-weight: 650; letter-spacing: .02em;
  padding: 2px 8px; border-radius: var(--radius-full); background: var(--info-bg); color: var(--info-text);
}
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.status-dot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-input); }
.status-dot.tone-success .dot { background: var(--success-strong); }
.status-dot.tone-critical .dot { background: var(--critical-strong); }
.status-dot.tone-critical { color: var(--critical-text); }
.link-like { color: var(--link); font-weight: 550; display: inline-flex; align-items: center; gap: 2px; }
.sheet-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
/* One hue per category so a tile is recognisable before it is read. */
.icon-tile.tile-c0 { background: #e8f0fe; color: #1a56db; }
.icon-tile.tile-c1 { background: #e6f7f1; color: #0b7a55; }
.icon-tile.tile-c2 { background: #f1ebff; color: #6b3fd4; }
.icon-tile.tile-c3 { background: #fff2e0; color: #a35a00; }
.icon-tile.tile-c4 { background: #e3f6fb; color: #0a6c87; }
.icon-tile.tile-c5 { background: #fde8f0; color: #b0245e; }
.icon-tile.tile-c6 { background: #eef1f4; color: #3d4b5c; }
:root[data-theme="dark"] .icon-tile[class*="tile-c"] { filter: saturate(.9) brightness(.85); box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-tile[class*="tile-c"] { filter: saturate(.9) brightness(.85); box-shadow: none; } }
.stepper li { padding-bottom: var(--s1); }

/* Settings */
.page-tabs { border-bottom: 0; padding: 0 0 var(--s4); gap: var(--s1); }
.page-tabs .tab { text-decoration: none; }
.layer-bar { margin-bottom: var(--s4); }
.section-nav { gap: 2px; }
.section-link {
  display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s2); border: 0; background: none; cursor: pointer;
  border-radius: var(--radius); color: var(--text-2); font: inherit; font-weight: 550; text-align: left; width: 100%;
}
.section-link:hover { background: var(--surface-hover); color: var(--text); }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--attention-strong); margin-left: auto; }
.chip-flat { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.input-num { max-width: 160px; }
.settings-section { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.settings-section.is-flash { box-shadow: 0 0 0 3px var(--focus), var(--shadow-card); transition: box-shadow .3s; }

/* Billing */
.price { display: flex; align-items: baseline; gap: 2px; }
.price-amount { font-size: 28px; line-height: 32px; font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.meters { margin-top: var(--s5); }
.meter { display: flex; flex-direction: column; gap: var(--s2); }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); align-items: stretch; }
@media (max-width: 1100px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }
.plan-card > .card-section { height: 100%; }
.plan-card.is-current { box-shadow: 0 0 0 2px var(--success-strong), var(--shadow-card); }
.plan-card.is-popular:not(.is-current) { box-shadow: 0 0 0 2px var(--info-strong), var(--shadow-card); }
.feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feature-list li { display: flex; gap: var(--s2); align-items: flex-start; }
.feature-list .icon { color: var(--success-strong); margin-top: 2px; }
.feature-list li.is-locked { color: var(--text-3); }
.feature-list li.is-locked .icon { color: var(--text-3); }

/* Activity */
.notif-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--text-2); }
.notif-icon.tone-critical { background: var(--critical-bg); color: var(--critical-text); }
.notif-icon.tone-warning { background: var(--warning-bg); color: var(--warning-text); }
.notif-icon.tone-info { background: var(--info-bg); color: var(--info-text); }
.notif-icon.tone-success { background: var(--success-bg); color: var(--success-text); }
.notif .notif-dot { margin-top: 0; }
#main:focus { outline: none; }
.breakdown-row { grid-template-columns: minmax(0, 1fr) auto; }

/* Home */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); }
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: var(--s4); border-radius: var(--radius-lg); text-decoration: none; color: var(--text);
  background: var(--surface); box-shadow: var(--shadow-card); transition: transform .2s, box-shadow .2s; min-width: 0;
}
.kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-pop); }
.kpi-icon { width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); margin-bottom: var(--s2); }
.kpi-value { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--text-2); }
.trend-chip { align-self: flex-start; margin-top: var(--s2); display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); font-size: 12px; font-weight: 550; background: var(--surface-3); color: var(--text-2); max-width: 100%; }
.trend-chip.tone-success { background: var(--success-bg); color: var(--success-text); }
.trend-chip.tone-critical { background: var(--critical-bg); color: var(--critical-text); }
.trend-chip.tone-warning { background: var(--warning-bg); color: var(--warning-text); }
.health-hero .ring { width: 168px; height: 168px; }
.health-hero .ring-label .ring-score { font-size: 44px; line-height: 48px; }
.attention-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
.attention-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s2); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.attention-row:hover { background: var(--surface-hover); text-decoration: none; }
.opp-cards { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4) var(--s4); }
.opp-card { display: flex; gap: var(--s3); align-items: flex-start; justify-content: space-between; padding: var(--s3); border-radius: var(--radius); background: var(--surface-2); box-shadow: inset 4px 0 0 var(--sev, var(--border-strong)), 0 0 0 1px var(--border) inset; flex-wrap: wrap; }
.opp-card.sev-critical { --sev: var(--critical-strong); }
.opp-card.sev-high { --sev: var(--warning-strong); }
.opp-card.sev-medium { --sev: var(--attention-strong); }
.opp-card.sev-low { --sev: var(--info-strong); }
.opp-card > .grow { padding-left: 4px; }
.stepper-list { counter-reset: none; }
.stepper-list .checklist-item { position: relative; border-top: 0; padding: var(--s2) 0 var(--s3); }
.stepper-list .checklist-item:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 30px; bottom: -4px; width: 2px; background: var(--border); border-radius: 2px; }
.stepper-list .checklist-item.is-done:not(:last-child)::after { background: var(--success-strong); opacity: .5; }
.stepper-list .check-circle.is-done { background: var(--success-strong); color: #fff; }
.mode-glyph { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text); }
.mode-option[aria-checked="true"] .mode-glyph { background: var(--info-bg); color: var(--info-text); }

/* Page cells, evidence chips, review list */
.page-cell { display: flex; gap: var(--s2); align-items: flex-start; min-width: 0; }
.res-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ev-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ev-chip.is-low { background: var(--critical-bg); color: var(--critical-text); }
.ev-vs { opacity: .75; margin-left: 2px; }
.type-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; color: var(--text-2); }
.status-pip { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--border-strong); }
.status-pip.pip-ready { background: var(--success-strong); }
.status-pip.pip-warning { background: var(--warning-strong); }
.status-pip.pip-critical { background: var(--critical-strong); }
.status-pip.pip-done { background: var(--info-strong); }
@media (max-width: 640px) { .itable td .chips { justify-content: flex-end; } .itable td .page-cell { text-align: left; } }

/* Change history timeline */
.timeline { padding: var(--s2) var(--s4) var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
.tl-day-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: var(--s2) 0; }
.tl-list { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-list::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--border); }
.tl-item { position: relative; display: flex; gap: var(--s3); padding: var(--s2) var(--s2) var(--s3) 0; border-radius: var(--radius); cursor: pointer; }
.tl-item:hover .tl-body { background: var(--surface-hover); }
.tl-node { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface); color: var(--text-2); box-shadow: 0 0 0 1px var(--border-strong), 0 0 0 4px var(--surface); }
.tl-item.is-applied .tl-node { color: var(--success-text); background: var(--success-bg); }
.tl-item.is-failed .tl-node { color: var(--critical-text); background: var(--critical-bg); }
.tl-body { flex: 1; min-width: 0; padding: var(--s2) var(--s3); border-radius: var(--radius); display: flex; flex-direction: column; gap: var(--s2); }
.tl-before { text-decoration: line-through; }
.tl-meta { gap: var(--s3); }
.actor-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.actor-chip.is-auto { padding: 1px 8px 1px 6px; border-radius: var(--radius-full); background: var(--info-bg); color: var(--info-text); font-weight: 550; }
.avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border) inset; }
.illustration { width: 132px; height: 99px; fill: none; stroke: var(--text-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.illustration .ill-soft { fill: var(--surface-3); stroke: none; }
[data-skin="glass"] .illustration { stroke: var(--accent); }
[data-skin="glass"] .illustration .ill-soft { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.appearance { margin-bottom: var(--s4); }
.appearance > summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
.appearance > summary::-webkit-details-marker { display: none; }
.appearance[open] .disclosure-chevron { transform: rotate(180deg); }
.disclosure-chevron { transition: transform .2s; color: var(--text-2); }
@media (max-width: 640px) {
  .itable td:has(.page-cell) { display: block; text-align: left; }
  .itable td:has(.page-cell)::before { display: block; margin-bottom: 4px; }
  .demo-strip > .icon { display: none; }
}

.feature-row > .grow { flex: 1 1 380px; }

/* What's new */
.release-list { padding-top: var(--s2); }
.tl-item.is-release { cursor: default; }
.tl-item.is-release .tl-body { gap: var(--s2); }
.tl-item.is-new .tl-node { background: var(--info-bg); color: var(--info-text); }
.new-pill { display: inline-flex; padding: 0 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; line-height: 18px; letter-spacing: .02em; background: var(--info-strong); color: #fff; }
.roadmap-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); align-items: start; }
.roadmap-col { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2); border-radius: var(--radius-lg); background: var(--surface-2); box-shadow: 0 0 0 1px var(--border) inset; min-width: 0; }
.roadmap-col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.roadmap-card { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.roadmap-status-chip { display: none; }
.roadmap-empty { padding: 4px; }
@media (max-width: 1000px) { .roadmap-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Phones: one list, each card carrying its own status chip. */
@media (max-width: 640px) {
  .roadmap-board { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .roadmap-col { display: contents; }
  .roadmap-col-head, .roadmap-empty { display: none; }
  .roadmap-status-chip { display: inline-flex; }
}
.vote-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 0; border-radius: var(--radius-full); cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border) inset;
  transition: transform .15s, background .15s;
}
.vote-btn:hover { background: var(--surface-hover); }
.vote-btn:active { transform: scale(.95); }
.vote-btn.is-voted { background: var(--info-bg); color: var(--info-text); box-shadow: 0 0 0 1px var(--info-strong) inset; }
.vote-label { font-weight: 550; }
.addon-card { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); cursor: pointer; }
.addon-card:hover { box-shadow: var(--shadow-pop); }
.addon-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.addon-card.is-soon { opacity: .85; }
.addon-card.is-active { box-shadow: 0 0 0 2px var(--success-strong), var(--shadow-card); }
.price-line { font-size: 13px; color: var(--text-2); }
.price-line strong { color: var(--text); font-size: 15px; }
.price-line.is-included { color: var(--success-text); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.stepper-input { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.stepper-value { min-width: 36px; text-align: center; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bill-lines { margin: var(--s2) 0; padding: var(--s3); border-radius: var(--radius); background: var(--surface-2); }
.bill-lines dd { text-align: right; font-variant-numeric: tabular-nums; }
.new-for-you .release-mini { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s2) 0; border-top: 1px solid var(--border); }
.new-for-you .release-mini:first-of-type { border-top: 0; }

/* Collection copy (body) review */
.rich-preview { line-height: 1.6; overflow-wrap: anywhere; }
.rich-preview h2 { font-size: 17px; margin: 8px 0 4px; }
.rich-preview h3 { font-size: 15px; margin: 8px 0 4px; }
.rich-preview p { margin: 0 0 8px; }
.rich-preview ul, .rich-preview ol { margin: 0 0 8px; padding-left: 20px; }
.diff-pane .rich-preview { max-height: 320px; overflow-y: auto; }
.code-html { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; }
[data-skin="glass"] .roadmap-col { border-radius: 20px; }
[data-skin="glass"] .roadmap-card { border-radius: 16px; background: var(--glass-fill-strong); }
[data-skin="glass"] .vote-btn.is-voted { background: color-mix(in srgb, var(--accent) 16%, var(--surface-selected)); color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
[data-skin="glass"] .new-pill { background: linear-gradient(90deg, #0a84ff, #5e5ce6); }

/* ── Channels ───────────────────────────────────────────────────────────────
   Channel identity colours: the validated categorical palette (dataviz
   reference, slots 1–6), assigned to channels by name so a filter never
   repaints a channel. Light steps sit below 3:1 on the surface for three
   slots, so every series is also named (legend, direct labels, table view). */
:root {
  --ch-amazon: #2a78d6; --ch-walmart: #eb6834; --ch-noon: #1baf7a; --ch-blinkit: #eda100; --ch-zepto: #e87ba4; --ch-instamart: #008300;
  --ch-other: #8a8a8a; --rank-hue: 22 140 110;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ch-amazon: #3987e5; --ch-walmart: #d95926; --ch-noon: #199e70; --ch-blinkit: #c98500; --ch-zepto: #d55181; --ch-instamart: #008300; --ch-other: #8e8e9a; --rank-hue: 60 190 150; }
}
:root[data-theme="dark"] { --ch-amazon: #3987e5; --ch-walmart: #d95926; --ch-noon: #199e70; --ch-blinkit: #c98500; --ch-zepto: #d55181; --ch-instamart: #008300; --ch-other: #8e8e9a; --rank-hue: 60 190 150; }

.ch-tile {
  width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; flex: 0 0 auto;
  font-size: 11px; font-weight: 750; letter-spacing: .02em; color: var(--text);
  background: color-mix(in srgb, var(--tile) 20%, var(--surface)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tile) 55%, transparent);
}
.ch-tile.ch-tile-xs { width: 20px; height: 20px; border-radius: 6px; font-size: 9px; }
.ch-chip-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.ch-chip-row .chip { gap: 6px; padding-left: 6px; }
.ch-group-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin-left: var(--s2); }
.ch-filter-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-start; }
.ch-filter-row > .field { flex: 0 1 200px; }
.ch-filter-row > .search-field { flex: 1 1 180px; }
.ch-location { flex: 0 1 220px !important; }
#ch-body { transition: opacity .2s; }
#ch-body.is-refreshing { opacity: .55; pointer-events: none; }
.ch-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3); }
.ch-kpi { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); box-shadow: inset 0 3px 0 var(--tile), var(--shadow-card); }
.ch-kpi-main { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s3); }
.sos { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.sos-wrap { position: relative; width: 56px; height: 56px; }
.sos-ring { width: 56px; height: 56px; transform: rotate(-90deg); }
.sos-track { fill: none; stroke: var(--surface-3); stroke-width: 6; }
.sos-value { fill: none; stroke: var(--tile); stroke-width: 6; stroke-linecap: round; }
.sos-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.stock-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; white-space: nowrap; }
.stock-chip.is-good { background: var(--success-bg); color: var(--success-text); }
.stock-chip.is-attention { background: var(--attention-bg); color: var(--attention-text); }
.stock-chip.is-critical { background: var(--critical-bg); color: var(--critical-text); }
.stock-chip.is-neutral { background: var(--surface-3); color: var(--text-2); }
.stock-legend, .rank-legend { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* Keyword matrix + heatmap: scroll sideways inside their own box; first column sticks. */
.matrix-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.matrix-wrap:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: max-content; }
.matrix th, .matrix td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
.matrix thead th { font-size: 12px; font-weight: 600; color: var(--text-2); }
.matrix .mx-sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 170px; box-shadow: 1px 0 0 var(--border); }
[data-skin="glass"] .matrix .mx-sticky { background: var(--glass-fill-strong); }
.mx-cell { min-width: 96px; }
.mx-sub { display: block; font-size: 11px; color: var(--text-2); margin-top: 2px; }
.rk { display: inline-flex; align-items: center; gap: 3px; min-width: 44px; padding: 2px 8px; border-radius: 8px; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.rank-legend .rk { font-size: 11px; min-width: 0; padding: 1px 7px; }
.rk-top { background: rgb(var(--rank-hue) / .34); }
.rk-good { background: rgb(var(--rank-hue) / .2); }
.rk-mid { background: rgb(var(--rank-hue) / .08); }
.rk-low { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.rk-none { background: transparent; color: var(--text-3); font-weight: 500; }
.mx-cell.is-gap .rk { box-shadow: inset 0 0 0 2px var(--info-strong); }
.mx-cell.is-gap .rk .icon { color: var(--info-strong); }
.mx-fix { display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; font-size: 12px; font-weight: 600; }
.heat-cell { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; border-radius: 10px; padding: 6px 10px; cursor: pointer; font: inherit; text-align: left; color: var(--text); }
.heat-cell:hover { filter: brightness(.97); }
.heat-cell[aria-expanded="true"] { box-shadow: inset 0 0 0 2px var(--text); }
.heat-cell.is-good { background: var(--success-bg); } .heat-cell.is-attention { background: var(--attention-bg); } .heat-cell.is-critical { background: var(--critical-bg); }
.heat-value { display: inline-flex; gap: 4px; align-items: center; font-size: 15px; font-weight: 700; }
.heat-cell.is-critical .heat-value .icon { color: var(--critical-strong); }
.heat-detail td { background: var(--surface-2); white-space: normal; }
.worst-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.worst-list li { display: flex; justify-content: space-between; gap: var(--s3); max-width: 420px; }

/* Trend chart: recessive grid, 2px lines, ringed end markers, text in text tokens. */
.chart-box { position: relative; }
.trend-chart { width: 100%; height: auto; display: block; overflow: visible; }
.trend-chart .grid line { stroke: var(--border); stroke-width: 1; }
.trend-chart text { fill: var(--text-2); font-size: 11px; font-family: var(--font); }
.trend-chart .axis-title { font-size: 11px; font-weight: 600; }
.trend-chart .direct { fill: var(--text); font-size: 11px; font-weight: 600; }
.trend-chart .series polyline { fill: none; stroke: var(--tile); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-chart .series .end { fill: var(--tile); stroke: var(--surface); stroke-width: 2; }
.trend-chart .crosshair { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.trend-chart .hit { fill: transparent; cursor: crosshair; }
.trend-chart .hit:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2; }
.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend-line { width: 14px; height: 2px; border-radius: 2px; background: var(--tile); display: inline-block; }
.chart-tip {
  position: absolute; z-index: 5; min-width: 160px; padding: 8px 10px; border-radius: 10px; pointer-events: none;
  background: var(--surface); box-shadow: var(--shadow-pop); font-size: 12px; display: flex; flex-direction: column; gap: 3px;
}
[data-skin="glass"] .chart-tip { background: var(--glass-fill-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.chart-tip .tip-head { color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .tip-row strong { min-width: 40px; color: var(--text); font-variant-numeric: tabular-nums; }

.share-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.share-bars li { display: grid; grid-template-columns: minmax(140px, 1.3fr) minmax(0, 1.2fr) 44px; gap: var(--s2); align-items: center; }
.share-track { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.share-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--border-input); }
.share-bars li.is-you .share-fill { background: var(--ch-amazon); }
.share-bars li.is-you .share-name { font-weight: 650; }
.share-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.share-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.map-list, .col-list, .line-errors { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.map-list li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.map-list li.is-matched .icon:first-child { color: var(--success-strong); }
.map-list li.is-ignored { color: var(--text-3); }
.col-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.line-errors { font-size: 12px; }
.preview-table td, .preview-table th { white-space: nowrap; font-size: 12px; }
@media (max-width: 640px) {
  .preview-table thead { display: table-header-group; }
  .preview-table, .preview-table tbody, .preview-table tr { display: revert; width: auto; }
  .preview-table td { display: table-cell; width: auto; text-align: left; }
  .preview-table td::before { content: none; }
  .ch-filter-row > .field, .ch-location { flex: 1 1 100% !important; }
  .share-bars li { grid-template-columns: minmax(70px, 1fr) minmax(0, 1fr) 40px; }
}
