/* linkgap app styles. Tokens live in tokens.css. Calm chrome, loud data. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-base)/var(--lh-base) var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
h3 { font-size: var(--fs-base); line-height: var(--lh-base); font-weight: 600; }
code, .mono { font-family: var(--font-mono); font-size: 13px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sm { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.xs { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.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; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s-6); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-3); }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 20px; height: 20px; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: var(--s-3) var(--s-3) var(--s-4);
}
.sb-brand { display: flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-2); margin-bottom: var(--s-3); color: var(--text); font-weight: 650; font-size: var(--fs-md); letter-spacing: -0.02em; }
.sb-brand:hover { text-decoration: none; color: var(--text); }
.logo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: var(--r-control); background: var(--accent); color: var(--on-accent); flex: none; }
.logo .logo-mark { width: 16px; height: 16px; }
.sb-switch { position: relative; margin-bottom: var(--s-4); }
.sb-switch > summary {
  list-style: none; display: flex; align-items: center; gap: var(--s-2); height: var(--control-h-lg); padding: 0 var(--s-2);
  border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface); cursor: pointer; font-weight: 500;
}
.sb-switch > summary::-webkit-details-marker { display: none; }
.sb-switch > summary:hover { background: var(--surface-2); }
.avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-badge); background: var(--surface-3); color: var(--text-2); font-size: 10px; font-weight: 600; flex: none; text-transform: uppercase; }
.avatar-lg { width: 32px; height: 32px; font-size: 12px; border-radius: var(--r-control); }
.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: var(--s-3); height: 32px; padding: 0 var(--s-2); border-radius: var(--r-control);
  color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-item .icon { color: var(--text-3); }
.nav-item.active .icon { color: var(--text); }
.nav-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.nav-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-item.active .nav-count { background: var(--surface); }
.sb-sep { height: 1px; background: var(--border); margin: var(--s-3) var(--s-2); }
.sb-section { padding: 0 var(--s-2); margin: var(--s-2) 0 var(--s-1); color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.sb-foot { margin-top: auto; padding: var(--s-3) var(--s-2) 0; display: flex; flex-direction: column; gap: var(--s-1); font-size: var(--fs-xs); color: var(--text-2); }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 500; color: var(--text); align-self: flex-start; }
.mode-pill .dot { background: var(--text-3); }
.mode-pill.is-live .dot { background: var(--good); }
.mode-pill.is-sample { background: var(--sample-bg); color: var(--sample-fg); border-color: transparent; }
.mode-pill.is-sample .dot { background: var(--sample-fg); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-8); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-3); font-size: var(--fs-sm); }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { color: var(--border-strong); }
.crumbs .current { color: var(--text); font-weight: 500; }
.crumbs > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--text-2); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.kbd { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 6px; border: 1px solid var(--border); border-radius: var(--r-badge); background: var(--surface); color: var(--text-2); font: 500 11px/1 var(--font-sans); cursor: pointer; }
.kbd:hover { color: var(--text); border-color: var(--border-strong); }
.menu-btn { display: none; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: inline; }
}

.sample-banner {
  display: flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 36px; padding: 6px var(--s-4);
  background: var(--sample-bg); color: var(--sample-fg); font-size: var(--fs-sm); font-weight: 500; text-align: center;
}
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-8); display: flex; flex-direction: column; gap: var(--s-6); }

/* Drawer / responsive shell */
.scrim { display: none; }
@media (max-width: 960px) {
  .app { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
  .sidebar { padding: var(--s-3) var(--s-2); align-items: center; }
  .sb-brand .brand-word, .nav-label, .sb-section, .sb-foot .foot-text, .sb-switch .sw-text, .sb-switch .sw-chev { display: none; }
  .sb-brand { padding: 0; justify-content: center; }
  .sb-switch > summary { width: 40px; justify-content: center; padding: 0; }
  .nav-item { width: 40px; justify-content: center; padding: 0; position: relative; }
  .nav-item .nav-count { position: absolute; top: 0; right: -2px; min-width: 16px; height: 14px; line-height: 14px; padding: 0 3px; font-size: 9px; }
  .sb-foot { align-items: center; padding: var(--s-2) 0 0; }
  .mode-pill { padding: 0 6px; }
  .mode-pill .pill-text { display: none; }
  .sb-sep { width: 32px; margin: var(--s-3) auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .app { display: block; }
  .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: 280px; height: auto; align-items: stretch; padding: var(--s-3);
    transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg);
  }
  .sb-brand .brand-word, .nav-label, .sb-section, .sb-foot .foot-text, .sb-switch .sw-text, .sb-switch .sw-chev, .mode-pill .pill-text { display: revert; }
  .sb-brand { padding: 0 var(--s-2); justify-content: flex-start; }
  .sb-switch > summary { width: auto; justify-content: flex-start; padding: 0 var(--s-2); }
  .nav-item { width: auto; justify-content: flex-start; padding: 0 var(--s-2); }
  .nav-item .nav-count { position: static; min-width: 20px; height: 18px; line-height: 18px; font-size: 11px; padding: 0 6px; }
  .sb-foot { align-items: flex-start; padding: var(--s-3) var(--s-2) 0; }
  .sb-sep { width: auto; margin: var(--s-3) var(--s-2); }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .35); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 var(--s-2) 0 var(--s-2); gap: var(--s-2); }
  .topbar-meta .meta-text, .topbar-meta .kbd { display: none; }
  .crumbs .crumb-hide-sm { display: none; }
  .content { padding: var(--s-4); gap: var(--s-5); }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Page heading ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.page-head .lede { color: var(--text-2); margin-top: var(--s-1); max-width: 720px; }
.page-head .title-row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; position: relative; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--s-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.card-head .sub { color: var(--text-2); font-size: var(--fs-sm); }
.card-body { padding: var(--s-5); }
.card-foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 960px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-h); padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--r-control); font: 500 var(--fs-base)/1 var(--font-sans); white-space: nowrap;
  cursor: pointer; text-decoration: none; transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn-lg { height: var(--control-h-lg); padding: 0 14px; }
.btn-sm { height: 26px; padding: 0 8px; font-size: var(--fs-sm); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--danger-text); border-color: var(--spam); }
.btn-danger:hover { background: color-mix(in srgb, var(--spam) 8%, var(--surface)); color: var(--danger-text); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn .busy-spinner { display: none; }
.btn.is-busy .busy-spinner { display: inline; }
.btn.is-busy .btn-icon { display: none; }
.btn-wrap { display: inline-flex; position: relative; }
form.inline { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.field > .label, .label { font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); }
.field-error { font-size: var(--fs-sm); color: var(--danger-text); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.input, .select, input[type="text"].input, input[type="number"].input {
  height: var(--control-h); padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-control);
  background: var(--surface); color: var(--text); font: 400 var(--fs-base)/1 var(--font-sans); min-width: 0; width: 100%;
}
.input-lg { height: var(--control-h-lg); }
.input:focus, .select:focus { outline: 2px solid var(--focus-ring); outline-offset: -1px; border-color: transparent; }
.input.is-invalid { border-color: var(--spam); }
.input-mono { font-family: var(--font-mono); font-size: 13px; }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: right 13px center, right 9px center; background-size: 4px 4px; background-repeat: no-repeat; }
input[type="file"].input { padding: 5px 8px; height: auto; font-size: var(--fs-sm); }
.check-label { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; font-size: var(--fs-base); min-height: 24px; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.search { position: relative; display: flex; align-items: center; min-width: 200px; }
.search .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); align-items: end; }
.radio-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.radio-card { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-control); cursor: pointer; background: var(--surface); }
.radio-card:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-subtle); }
.radio-card.is-disabled { cursor: not-allowed; opacity: .6; }
.radio-card input { margin-top: 3px; }
.radio-card .rc-title { font-weight: 500; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.radio-card .rc-hint { font-size: var(--fs-xs); color: var(--text-2); }
@media (max-width: 640px) { .radio-cards { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Badges, status, chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--r-badge);
  background: var(--surface-2); color: var(--text); font-size: var(--fs-xs); line-height: 1; font-weight: 500; white-space: nowrap;
  border: 0; vertical-align: middle; font-variant-numeric: tabular-nums; font-family: var(--font-sans);
}
a.badge:hover { text-decoration: none; color: var(--text); background: var(--surface-3); }
.badge .icon { width: 12px; height: 12px; vertical-align: 0; }
.badge-neutral { box-shadow: inset 0 0 0 1px var(--border); background: var(--surface); color: var(--text-2); }
.badge-sample { background: var(--sample-bg); color: var(--sample-fg); }
.badge-warning { background: var(--warning-subtle); color: var(--warning); }
.badge-accent { background: var(--accent-subtle); color: var(--accent); }
.badge-good, .badge-weak, .badge-spam { background: linear-gradient(var(--k), var(--k)) left / 3px 100% no-repeat, var(--surface-2); padding-left: 9px; }
.badge-good { --k: var(--good); } .badge-weak { --k: var(--weak); } .badge-spam { --k: var(--spam); }
.badge-outline-spam { background: transparent; box-shadow: inset 0 0 0 1px var(--spam); color: var(--text); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--k, var(--text-3)); flex: none; }
.k-good { --k: var(--good); } .k-weak { --k: var(--weak); } .k-spam { --k: var(--spam); }
.status { display: inline-flex; flex-direction: column; line-height: var(--lh-sm); }
.status-main { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.status-sub { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-2); padding-left: 14px; }
.status .edited { color: var(--text-3); cursor: help; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--r-badge);
  font-size: var(--fs-xs); line-height: 1; white-space: nowrap; background: var(--surface-2); color: var(--text); border: 0; cursor: default; font-family: var(--font-sans);
}
.chip-risk { background: linear-gradient(var(--spam), var(--spam)) left / 3px 100% no-repeat, var(--surface-2); padding-left: 9px; }
.chip-risk .pts { color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip-info { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.chip-network { background: transparent; box-shadow: inset 0 0 0 1px var(--spam); color: var(--text); cursor: pointer; }
a.chip-network:hover { text-decoration: none; color: var(--text); background: color-mix(in srgb, var(--spam) 8%, transparent); }
.chip .icon { width: 12px; height: 12px; vertical-align: 0; }
.chip-more { background: transparent; color: var(--text-3); }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
/* Responsive columns must come after the base rule, otherwise the base rule wins */
@media (max-width: 960px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpi-grid { grid-template-columns: minmax(0, 1fr); } }
.kpi { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-5); color: var(--text); min-width: 0; transition: border-color var(--dur-fast) var(--ease); }
a.kpi:hover { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.kpi-label { font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.kpi-label .icon { color: var(--text-3); opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
a.kpi:hover .kpi-label .icon { opacity: 1; }
.kpi-value { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-value.is-text { font-size: var(--fs-md); line-height: var(--lh-xl); letter-spacing: -0.01em; }
.kpi-context { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); }
.kpi .qbar { margin-top: var(--s-2); }

/* ---------- Hero ---------- */
.hero { display: flex; flex-direction: column; gap: var(--s-1); }
.hero-value { font-size: 56px; line-height: 60px; font-weight: 650; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.hero-label { font-size: var(--fs-md); line-height: var(--lh-md); color: var(--text); font-weight: 500; }
.hero-note { color: var(--text-2); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.hero-note s { color: var(--text-3); text-decoration-thickness: 1px; }
@media (max-width: 640px) { .hero-value { font-size: var(--fs-2xl); line-height: var(--lh-2xl); } }

/* ---------- Quality bar ---------- */
.qbar-track { display: flex; gap: 2px; width: 100%; border-radius: var(--r-pill); overflow: hidden; }
.qbar-track > span { display: block; height: 100%; background: var(--k); min-width: 3px; }
.qbar-track.is-empty { background: var(--surface-2); }
.qbar-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }
.qbar-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.qbar-legend strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.qbar-empty-label { font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--s-1); }

/* ---------- Comparison chart ---------- */
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-control); background: var(--surface-2); border: 1px solid var(--border); }
.seg a { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 4px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.chart { --label-w: 190px; --value-w: 104px; position: relative; }
.chart-row { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr) var(--value-w); column-gap: var(--s-3); align-items: center; height: 34px; }
.chart-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 13px; color: var(--text-2); }
.chart-label a { color: var(--text-2); }
.chart-label a:hover { color: var(--text); }
.chart-row.is-you .chart-label { color: var(--text); font-weight: 600; }
.chart-track { position: relative; height: 100%; }
.chart-bar { position: absolute; left: 0; top: calc(50% - 9px); height: 18px; border-radius: 0 3px 3px 0; background: var(--text-3); min-width: 2px; }
.chart-row.is-you .chart-bar { background: var(--text); outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
.chart-value { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.chart-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.chart-overlay { position: absolute; top: 0; bottom: 0; left: calc(var(--label-w) + var(--s-3)); right: calc(var(--value-w) + var(--s-3)); pointer-events: none; }
.chart-baseline { position: absolute; top: 0; bottom: 22px; border-left: 1px dashed var(--text); }
.chart-baseline-label { position: absolute; top: -2px; transform: translateX(6px); font-size: var(--fs-xs); color: var(--text); font-weight: 500; white-space: nowrap; background: var(--surface); padding: 0 4px; border-radius: 3px; }
.chart-baseline-label.flip { transform: translateX(calc(-100% - 6px)); }
.chart-gap { position: absolute; top: calc(50% - 9px); height: 18px; display: flex; align-items: center; }
.chart-gap::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--text-2); }
.chart-gap::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; bottom: 4px; border-left: 1px solid var(--text-2); border-right: 1px solid var(--text-2); }
.chart-gap-label { position: relative; margin: 0 auto; padding: 0 6px; background: var(--surface); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-axis { height: 22px; position: relative; }
.chart-axis span { position: absolute; top: 4px; font-size: var(--fs-xs); color: var(--text-3); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.chart-axis span:first-child { transform: none; }
.chart-axis span:last-child { transform: translateX(-100%); }
.chart-caption { font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--s-2); }
@media (max-width: 640px) { .chart { --label-w: 108px; --value-w: 64px; } .chart-value .badge { display: none; } }
details.table-toggle > summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); list-style: none; display: inline-flex; gap: 4px; align-items: center; }
details.table-toggle > summary::-webkit-details-marker { display: none; }
details.table-toggle[open] > summary .icon { transform: rotate(180deg); }

/* ---------- Meters (plan) ---------- */
.meter-card { padding: var(--s-4) var(--s-5); }
.meter-title { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); }
.meter-value { font-size: var(--fs-md); font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0 var(--s-3); }
.meter-value .muted { font-weight: 400; }
.meter { position: relative; height: 10px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
/* Budget and link meters are progress, not a link-quality mark, so the accent belongs here */
.meter > span { position: absolute; left: 0; top: 0; bottom: 0; min-width: 4px; background: var(--accent); border-radius: var(--r-pill); }
.minibar { display: inline-flex; gap: 2px; vertical-align: middle; }
.minibar > i { display: block; width: 6px; height: 10px; border-radius: 1px; background: var(--surface-3); }
.minibar > i.on { background: var(--text-2); }

/* ---------- Data table ---------- */
.dt-scroll { position: relative; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.dt th {
  position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 12px; text-align: left; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; border-bottom: 1px solid var(--border);
}
.dt th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.dt th a:hover { color: var(--text); text-decoration: none; }
.dt th .sort-icon { opacity: 0; width: 12px; height: 12px; }
.dt th a:hover .sort-icon, .dt th[aria-sort] .sort-icon { opacity: 1; }
.dt th[aria-sort] { color: var(--text); }
.dt td { height: var(--row-h); padding: 6px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; background: var(--surface); }
.dt tbody tr:hover td { background: var(--surface-2); }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.dt .num, .dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt th.num a { flex-direction: row-reverse; }
.dt .col-check { width: 40px; padding-right: 0; }
.dt .col-actions { width: 1%; text-align: right; white-space: nowrap; }
.dt .domain { font-family: var(--font-mono); font-size: 13px; color: var(--text); white-space: nowrap; }
.dt .na { color: var(--text-3); }
.dt tr.is-selected td { background: var(--accent-subtle); }
.dt tr.is-you td { background: color-mix(in srgb, var(--accent-subtle) 60%, var(--surface)); font-weight: 500; }
.dt tr.is-verified td:first-child { box-shadow: inset 2px 0 0 var(--text); }
.table-card { overflow: hidden; }
.table-card .dt th:first-child, .table-card .dt td:first-child { padding-left: var(--s-5); }
.table-card .dt th:last-child, .table-card .dt td:last-child { padding-right: var(--s-5); }
.table-card .dt .col-check:first-child { padding-right: 0; }
@media (max-width: 640px) {
  .dt .sticky-col { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border); }
  .dt th.sticky-col { z-index: 2; }
  .table-card .dt th:first-child, .table-card .dt td:first-child { padding-left: 12px; }
}
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.pagination { display: flex; align-items: center; gap: var(--s-2); }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.filter-bar .actions { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 6px 0 10px; border-radius: var(--r-pill); background: var(--accent-subtle); color: var(--text); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.filter-chip:hover { text-decoration: none; color: var(--text); }
.filter-chip .x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--text-2); }
.filter-chip:hover .x { background: var(--surface); color: var(--text); }
.filter-add > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: var(--r-pill); border: 1px dashed var(--border-strong); color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.filter-add > summary::-webkit-details-marker { display: none; }
.filter-add > summary:hover { color: var(--text); border-color: var(--text-3); }
.tabs { display: inline-flex; gap: 2px; border-bottom: 1px solid var(--border); width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .count { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tab.active .count { color: var(--text-2); }

/* ---------- Menus (details-based) ---------- */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; min-width: 200px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-lg);
  text-align: left; font-size: var(--fs-sm); font-weight: 400;
}
.menu-panel.left { right: auto; left: 0; }
.menu-panel .menu-label { padding: 6px 8px 2px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; white-space: nowrap; }
.menu-item { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 30px; padding: 4px 8px; border: 0; border-radius: var(--r-badge); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); text-decoration: none; outline: none; }
.menu-item.active { font-weight: 600; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.sb-switch .menu-panel { left: 0; right: 0; min-width: 0; }

/* ---------- Bulk bar ---------- */
.bulk-bar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-2) var(--s-5); background: var(--accent-subtle); border-bottom: 1px solid var(--border); min-height: 48px; }
.bulk-bar .count { font-weight: 600; margin-right: var(--s-2); font-variant-numeric: tabular-nums; }
.bulk-bar[data-empty] .bulk-actions { display: none; }
.bulk-bar[data-empty] { background: var(--surface); }

/* ---------- Alerts, empty ---------- */
.alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-card); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); }
.alert .icon { margin-top: 2px; }
.alert-warning { background: var(--warning-subtle); border-color: transparent; color: var(--text); }
.alert-warning > .icon { color: var(--warning); }
.alert-error { box-shadow: inset 3px 0 0 var(--spam); }
.alert-error > .icon { color: var(--spam); }
.alert-success { box-shadow: inset 3px 0 0 var(--good); }
.alert-success > .icon { color: var(--good); }
.alert-sample { background: var(--sample-bg); color: var(--sample-fg); border-color: transparent; font-weight: 500; }
.empty { text-align: center; }
.empty-page { max-width: 440px; margin: var(--s-8) auto; padding: var(--s-8) var(--s-6); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.empty-section { border: 1px dashed var(--border-strong); border-radius: var(--r-card); padding: var(--s-8) var(--s-6); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); background: transparent; }
.empty-filtered { display: flex; align-items: center; justify-content: center; gap: var(--s-3); padding: var(--s-6); color: var(--text-2); flex-wrap: wrap; }
.empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.empty-text { color: var(--text-2); }
.empty-actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); flex-wrap: wrap; justify-content: center; }
.empty-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-card); background: var(--surface-2); color: var(--text-2); margin-bottom: var(--s-2); }

/* ---------- Setup checklist ---------- */
.setup { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-6); padding: var(--s-4) var(--s-5); }
.setup-steps { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); flex: 1 1 auto; }
.setup-step { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--text); font-weight: 500; }
.setup-step.done { color: var(--text-2); font-weight: 400; }
.setup-step .tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.setup-step.done .tick { border-color: var(--good); background: var(--good); color: #fff; }
.setup-step.done .tick .icon { width: 12px; height: 12px; stroke-width: 3; }
.setup-progress { font-size: var(--fs-xs); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Check cards (home) ---------- */
.check-card { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5); color: var(--text); transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.check-card:hover { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.check-card .cc-head { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.check-card .cc-domain { font-weight: 600; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-card .cc-meta { font-size: var(--fs-sm); color: var(--text-2); }
.check-card .cc-stats { display: flex; gap: var(--s-6); flex-wrap: wrap; }
.cc-stat { display: flex; flex-direction: column; }
.cc-stat .v { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.cc-stat .l { font-size: var(--fs-xs); color: var(--text-2); }
.cc-foot { display: flex; gap: var(--s-2); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); align-items: center; }

/* ---------- Networks ---------- */
.net-card.is-dismissed { opacity: .6; }
.net-card .net-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.net-card.is-dismissed .net-head { border-bottom: 0; }
.net-lead { font-size: var(--fs-md); font-weight: 600; }
.net-sites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-2); }
.net-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s-6); padding: var(--s-5); }
@media (max-width: 960px) { .net-body { grid-template-columns: minmax(0, 1fr); } }
.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.why-list li { display: grid; grid-template-columns: 20px 170px minmax(0, 1fr); gap: var(--s-2); padding: 8px 0; border-bottom: 1px solid var(--border); align-items: baseline; font-size: var(--fs-sm); }
.why-list li:last-child { border-bottom: 0; }
.why-list .ok { color: var(--good); } .why-list .no { color: var(--text-3); }
.why-list .why-label { font-weight: 500; }
.why-list .why-detail { color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .why-list li { grid-template-columns: 20px minmax(0, 1fr); } .why-list .why-detail { grid-column: 2; } }
.section-label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); margin-bottom: var(--s-2); text-transform: none; }
.effect-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.effect-table td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.effect-table tr:last-child td { border-bottom: 0; font-weight: 600; }
.effect-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.effect-table s { color: var(--text-3); }
.examples { display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.examples .faint { font-family: var(--font-sans); }
.rules-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-2) var(--s-6); font-size: var(--fs-sm); color: var(--text-2); }
.rules-list code { color: var(--text); }

/* ---------- Provider cards (settings) ---------- */
.provider-card { display: flex; flex-direction: column; }
.provider-card .pc-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.provider-card .pc-body { padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); flex: 1 1 auto; }
.provider-card.is-unbuilt { background: transparent; box-shadow: none; border-style: dashed; }
.provider-card.is-unbuilt .pc-head { border-bottom-style: dashed; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.pill .dot { width: 7px; height: 7px; }
.pill-good .dot { background: var(--good); } .pill-spam .dot { background: var(--spam); } .pill-off .dot { background: var(--text-3); }
.pill-warning { background: var(--warning-subtle); color: var(--warning); border-color: transparent; }
.pill-warning .dot { background: var(--warning); }
.caps { display: flex; flex-wrap: wrap; gap: 4px; }
.cap { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--r-badge); font-size: var(--fs-xs); background: var(--surface-2); color: var(--text); }
/* Not built yet: quieter, never struck through (strikethrough reads as "removed", not "coming later") */
.cap.off { background: var(--surface-2); color: var(--text-3); font-weight: 400; }
.cap .icon { width: 11px; height: 11px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px var(--s-4); font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.test-result { font-size: var(--fs-sm); display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-2) var(--s-3); border-radius: var(--r-control); background: var(--surface-2); }
.test-result.ok .icon { color: var(--good); } .test-result.bad .icon { color: var(--spam); } .test-result.none .icon { color: var(--text-3); }
.field-inline-hint { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }

/* ---------- Job card ---------- */
.job-card { padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.job-title { font-weight: 600; display: flex; align-items: center; gap: var(--s-2); }
.job-meta { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; display: flex; gap: var(--s-3); flex-wrap: wrap; }
.job-steps { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.job-step { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); }
.job-step.running { color: var(--text); font-weight: 500; }
.job-step.done { color: var(--text-2); }
.job-step.done .icon { color: var(--good); }
.job-step.error { color: var(--danger-text); }
.job-step.error .icon { color: var(--spam); }
.job-bar { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.job-bar > span { display: block; height: 100%; background: var(--text); border-radius: var(--r-pill); transform-origin: left; transition: width var(--dur) var(--ease); }
.job-current { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.skeleton { display: inline-block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Popover ---------- */
.popover {
  position: absolute; z-index: 35; top: calc(100% + 8px); right: 0; width: 320px; max-width: calc(100vw - 32px);
  padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-modal); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: var(--s-2); text-align: left;
}
.popover .pop-title { font-size: var(--fs-sm); color: var(--text-2); }
.popover .pop-value { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.popover .pop-basis { font-size: var(--fs-sm); color: var(--text-2); }
.popover .pop-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-2); }

/* ---------- Tooltip ---------- */
.tip {
  position: fixed; z-index: 100; pointer-events: none; display: flex; flex-direction: column; max-width: 300px;
  background: var(--text); color: var(--bg); border-radius: var(--r-control); padding: 6px 10px; font-size: var(--fs-xs); line-height: var(--lh-xs);
  box-shadow: var(--shadow-md);
}
.tip strong { font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
.tip span { opacity: .8; }
[data-tip] { cursor: default; }
a[data-tip], button[data-tip], summary[data-tip] { cursor: pointer; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 90; right: var(--s-4); bottom: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); width: 360px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: var(--s-3); padding: 10px 10px 10px 14px; border-radius: var(--r-card);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
  animation: toast-in var(--dur) var(--ease);
}
.toast .icon { flex: none; }
.toast.success .t-icon { color: var(--good); }
.toast.warning .t-icon { color: #F59E0B; }
.toast.error .t-icon { color: var(--spam); }
.toast .t-msg { flex: 1 1 auto; min-width: 0; }
.toast .t-btn { background: transparent; border: 0; color: inherit; font: 600 var(--fs-sm)/1 var(--font-sans); padding: 6px 8px; border-radius: var(--r-badge); cursor: pointer; text-decoration: none; }
.toast .t-btn:hover { background: color-mix(in srgb, var(--bg) 16%, transparent); color: inherit; text-decoration: none; }
.toast .t-close { opacity: .7; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Command palette ---------- */
dialog.palette { width: 560px; max-width: calc(100vw - 32px); padding: 0; border: 1px solid var(--border); border-radius: var(--r-modal); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); margin-top: 12vh; }
dialog.palette::backdrop { background: rgb(0 0 0 / .3); }
.palette-input { display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-4); border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--text-3); }
.palette-input input { flex: 1; height: 48px; border: 0; background: transparent; color: var(--text); font: 400 var(--fs-md)/1 var(--font-sans); outline: none; }
.palette-list { max-height: 360px; overflow-y: auto; padding: var(--s-2); margin: 0; list-style: none; }
.palette-group { padding: 8px 8px 4px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.palette-item { display: flex; align-items: center; gap: var(--s-3); height: 36px; padding: 0 var(--s-2); border-radius: var(--r-control); cursor: pointer; }
.palette-item[aria-selected="true"] { background: var(--surface-2); }
.palette-item .icon { color: var(--text-3); }
.palette-empty { padding: var(--s-6); text-align: center; color: var(--text-2); }

/* ---------- Error page ---------- */
/* Optically centred, like the empty-state cards, instead of pinned to the top of an empty viewport */
.error-page { text-align: center; margin: 0 auto; max-width: 480px; min-height: calc(100vh - var(--topbar-h) - 2 * var(--s-8));
  display: grid; align-content: center; justify-items: center; gap: var(--s-2); }
.error-code { font-size: 64px; line-height: 1; font-weight: 650; letter-spacing: -0.04em; color: var(--text-3); font-variant-numeric: tabular-nums; }
.error-detail { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: var(--r-control); padding: var(--s-2) var(--s-3); max-width: 100%; overflow-wrap: anywhere; }

/* ---------- Layout fixes that must win over the base rules above ---------- */

/* Provider card heads: a long name must never collide with its status pill */
.provider-card .pc-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 960px) {
  .provider-card .pc-head { flex-wrap: wrap; }
  .provider-card .pc-head > .grow { flex: 1 1 100%; }
}

/* Check switcher: while the sidebar is a 56px rail (641–960px) the panel must escape it,
   otherwise picking a check is impossible — it is the only switcher at that width. */
@media (max-width: 960px) {
  .sidebar { overflow: visible; }
  .sb-switch .menu-panel { left: calc(100% + 6px); right: auto; top: 0; min-width: 240px; width: max-content;
    max-width: calc(100vw - var(--sidebar-w-collapsed) - 24px); }
}
@media (max-width: 640px) {
  .sidebar { overflow-y: auto; }
  .sb-switch .menu-panel { left: 0; right: 0; top: calc(100% + 4px); min-width: 0; width: auto; max-width: none; }
}

/* Data tables: the sticky column stays opaque on hovered and selected rows, a fade shows that
   a table scrolls, and phone width drops low-value columns into a second line in the Domain cell. */
.dt .sticky-col { background: var(--surface); }
.dt th.sticky-col { background: var(--surface-2); }
.dt tbody tr:hover .sticky-col { background: var(--surface-2); }
.dt tr.is-selected .sticky-col { background: var(--accent-subtle); }
.dt tr.is-you .sticky-col { background: color-mix(in srgb, var(--accent-subtle) 60%, var(--surface)); }
.has-dt-fade { position: relative; }
.dt-fade { position: absolute; right: 0; width: 36px; pointer-events: none; opacity: 0; z-index: 2;
  background: linear-gradient(to right, transparent, var(--surface) 80%); transition: opacity var(--dur) var(--ease); }
.dt-fade.is-on { opacity: 1; }
.dt .col-state { width: 1%; white-space: nowrap; }
.why-cell { display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.why-cell .why-risk { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); min-height: var(--lh-xs); }
.cell-sub { display: none; }
@media (max-width: 640px) {
  .dt .col-sm-hide { display: none; }
  /* A long domain must not force the table wider than the screen, or the last column (the plan's
     Total, and its total row) is pushed out of reach behind a horizontal scroll. */
  .dt .domain { white-space: normal; overflow-wrap: anywhere; }
  .dt td, .dt th { padding-left: 8px; padding-right: 8px; }
  .table-card .dt th:last-child, .table-card .dt td:last-child { padding-right: 12px; }
  .cell-sub { display: block; margin-top: 2px; font-family: var(--font-sans); font-size: var(--fs-xs);
    line-height: var(--lh-xs); color: var(--text-2); white-space: normal; font-weight: 400; }
  .dt-scroll.is-scrollable .sticky-col { box-shadow: 6px 0 8px -6px rgb(0 0 0 / .28); }
}

/* Disclosure card head (New check): it must read as something that opens */
summary.disclosure { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  cursor: pointer; list-style: none; border-bottom: 0; }
summary.disclosure::-webkit-details-marker { display: none; }
summary.disclosure:hover { background: var(--surface-2); }
details:not([open]) > summary.disclosure { border-radius: var(--r-card); }
details[open] > summary.disclosure { border-radius: var(--r-card) var(--r-card) 0 0; }
.disclosure-chev { color: var(--text-3); transition: transform var(--dur-fast) var(--ease); }
details[open] > summary.disclosure .disclosure-chev { transform: rotate(180deg); }

/* Comparison chart at phone width: the value moves under the domain name so the track keeps its
   length, and the floating baseline and gap labels (which overflow a 400px card) become a caption. */
.chart-phone-note { display: none; }
@media (max-width: 640px) {
  .chart { --label-w: 104px; --value-w: 0px; }
  .chart-row { grid-template-columns: var(--label-w) minmax(0, 1fr); column-gap: var(--s-2); height: auto; min-height: 44px; }
  .chart-row > .chart-label { grid-column: 1; grid-row: 1; align-self: end; }
  .chart-row > .chart-value { grid-column: 1; grid-row: 2; align-self: start; font-size: var(--fs-xs); color: var(--text-2); }
  .chart-row > .chart-track { grid-column: 2; grid-row: 1 / span 2; }
  .chart-overlay { left: calc(var(--label-w) + var(--s-2)); right: 0; }
  .chart-meta, .chart-baseline-label, .chart-gap-label { display: none; }
  .chart-phone-note { display: block; }
}

/* Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}


.qbar-item { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; margin: -3px 0; border-radius: var(--r-control); }
.qbar-item.has-note { cursor: help; }
.qbar-item.has-note:hover, .qbar-item.has-note:focus-visible { background: var(--surface-2); }
.qbar-why { color: var(--text-3); }
.qbar-item:hover .qbar-why, .qbar-item:focus-visible .qbar-why { color: var(--text-2); }
.qbar-note { margin-top: var(--s-2); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); max-width: 78ch; }

/* Impact curve on the plan page: diminishing returns from the first link to closing the gap */
.impact-chart { position: relative; margin: 4px 0 0; }
.impact-chart svg { display: block; width: 100%; height: 160px; overflow: visible; }
.impact-axis { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.impact-axis-top { stroke-dasharray: 4 4; }
.impact-curve { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.impact-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.impact-marks { position: absolute; inset: 10px 0 10px 0; pointer-events: none; }
.impact-mark { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  pointer-events: auto; cursor: default; }
.impact-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

/* Sign-in and first-run setup: the only pages without the app shell */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-wrap { width: 100%; max-width: 380px; }
.auth-card { width: 100%; }
.auth-brand { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.auth-title { font-size: 20px; margin: 0 0 2px; }
.auth-body .lede { margin: 0; }
.sb-account { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.cred-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cred { margin: 2px 0 0; font-family: var(--font-mono); font-size: 15px; font-weight: 600; user-select: all;
  padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-control); }
.auth-alt { text-align: center; margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.waiting-row { padding-top: 10px; border-top: 1px solid var(--border); }
.waiting-row:first-of-type { padding-top: 0; border-top: 0; }
.sb-budget { width: 100%; margin-top: 6px; font-size: 11px; color: var(--text-2); cursor: default; }
.sb-budget .meter { margin-bottom: 4px; }
.meter-sm { height: 4px; }
.limit-form { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.input-sm { height: 28px; padding: 0 8px; font-size: 13px; }

/* Print: the plan and overview as a clean page a freelancer can send to a client */
.print-only { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #111 !important; }
  .sidebar, .topbar, .page-actions, .scrim, .toasts, .sample-banner, .no-print, #plan-form, form,
  .impact-marks, .table-toggle > summary, .chart-caption.chart-phone-note { display: none !important; }
  .app, .main { display: block !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .card { box-shadow: none !important; border-color: #ccc !important; break-inside: avoid; }
  .grid-2, .grid-3, .kpis { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
  .dt-scroll { overflow: visible !important; }
  .print-only { display: block !important; }
  .print-head { font-size: 12px; color: #444; margin-bottom: 10px; border-bottom: 1px solid #ccc; padding-bottom: 6px; }
  .print-foot { font-size: 10px; color: #555; margin-top: 14px; border-top: 1px solid #ccc; padding-top: 6px; }
  a { color: inherit !important; text-decoration: none !important; }
}
