/* ── Reset & theme ──────────────────────────────────────────────────── */
/*
 * Static-first CSS policy:
 *   KEEP  — nesting, logical props, :is(), :lang(), :not(), shorthands, media ranges, system-ui, clamp()
 *   DEFER — light-dark(), color-mix(), relative/LAB/P3 colors, CSS Modules
 * Tokens SSOT: theme.jsonc → theme-tokens.css (bun run portal:theme:sync · jsonc loader)
 * Optional lowering: bun run portal:css:build → /portal/dist/style.css (css loader)
 * Power UI: bun run portal:css:score:power
 * @see https://bun.com/docs/bundler/loaders#jsonc
 * @see https://bun.com/docs/bundler/loaders#css
 * @see https://bun.com/docs/bundler#content-types
 * @see https://bun.com/docs/bundler/css#nesting
 * @see https://bun.com/docs/bundler/css#logical-properties
 * @see https://bun.com/docs/bundler/css#lang-selector
 * @see https://bun.com/docs/bundler/css#math-functions
 */

@import "./theme-tokens.css";

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Multi-arg :lang() — static RTL / CJK without waiting for Bun :dir() → :lang() lowering */
:lang(ar, he, fa, ur) {
  letter-spacing: 0;
}

:lang(zh, ja, ko) {
  line-height: 1.8;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--gradient-subtle);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top bar ───────────────────────────────────────────────────────── */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: min(var(--layout-max), 100%);
  margin: 0 auto;
  display: flex;
  place-items: center;
  height: 56px;
  gap: clamp(12px, 2vw, 24px);
  padding-inline: var(--pad-inline);
}

.logo {
  font-family: var(--font-brand);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  place-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-icon {
  display: inline-block;
  inline-size: 20px;
  block-size: 20px;
  flex: 0 0 20px;
  border-radius: 5px;
  background: url("/icons/factory/mark-32.webp") center / contain no-repeat;
  color: transparent;
  font-size: 0;
}

/* Tenant shells historically placed a second mark outside the shared logo. */
.topbar > .brand-icon {
  display: none;
}

.brand-wordmark {
  font-family: var(--font-brand);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--brand-wordmark);
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: var(--tone-ok);
  color: var(--tone-on-strong);
  border-radius: 4px;
}

/* Logo page label — logical border so RTL flips without :dir() */
.logo-page {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  padding-inline-start: 8px;
  border-inline-start: 1px solid var(--border);
  margin-inline-start: 2px;
}

.topbar-nav {
  display: flex;
  place-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  white-space: nowrap;

  &:is(:hover, :focus-visible) {
    color: var(--text);
    background: var(--surface-hover);
  }

  &:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  &:is(.active, [aria-current='page']) {
    color: var(--accent);
    font-weight: 500;
    background: var(--accent-glow);
  }

  &.nav-md {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;

    &:hover { opacity: 1; }
  }
}

/* Nest overflow + dropdown — logical inset for RTL (no :dir() needed) */
.nav-overflow {
  position: relative;
  margin-inline-start: 4px;

  .nav-more {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding-block: 4px;
    padding-inline: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: color .15s, border-color .15s, background .15s;

    &:hover {
      color: var(--text);
      border-color: var(--accent);
      background: var(--accent-glow);
    }
  }

  &:is(.open, :hover, :focus-within) .nav-more {
    color: var(--text);
    border-color: var(--accent);
  }

  .nav-dropdown {
    display: none;
    position: absolute;
    inset-inline-end: 0;
    top: 100%;
    margin-block-start: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 20;

    .nav-link {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding-block: 8px;
      padding-inline: 12px;
    }
  }

  &:is(.open, :hover, :focus-within) .nav-dropdown {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
}

/* Live counts from baked registry JSON (nav-badges.js) */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.15rem;
  padding: 0 5px;
  margin-inline-start: 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: var(--border);
  color: var(--text-dim);
}
.nav-badge--ok {
  background: var(--tone-ok-bg);
  color: var(--tone-ok);
}
.nav-badge--bad {
  background: var(--tone-bad-bg);
  color: var(--tone-bad);
}
.nav-badge--warn {
  background: var(--tone-warn-bg);
  color: var(--tone-warn);
}
.nav-badge--neutral {
  background: var(--tone-info-bg);
  color: var(--tone-info);
}
.topbar-nav > .nav-link {
  display: inline-flex;
  align-items: center;
}

/* RTL langs: mirror overflow chevron when lang is set without dir= */
:lang(ar, he, fa, ur) .nav-overflow .nav-more {
  transform: scaleX(-1);
}

.topbar-status {
  display: flex;
  place-items: center;
  gap: 6px;
  font-size: 13px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.3s, box-shadow 0.3s;

  &.ok {
    background: var(--tone-ok);
    box-shadow: 0 0 6px var(--tone-ok);
    animation: pulse-glow 2s ease-in-out infinite;
  }

  &.degraded {
    background: var(--tone-warn);
    box-shadow: 0 0 6px var(--tone-warn);
  }

  &.fail {
    background: var(--tone-bad);
    box-shadow: 0 0 6px var(--tone-bad);
  }

  &.unknown { background: var(--text-dim); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(63, 185, 80, 0.35); }
  50% { box-shadow: 0 0 14px rgba(63, 185, 80, 0.7); }
}

.health-label { color: var(--text-dim); }

/* Shared mono chrome — :is() dedupe (safe natively) */
:is(.proof-badge, .channel-badge, .version-badge, .help-table kbd) {
  font-family: var(--font-mono);
  font-size: 11px;
}

.proof-badge {
  display: inline-flex;
  place-items: center;
  place-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-inline-start: 8px;
  font-weight: 700;
  cursor: help;
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);

  &.hidden { display: none; }
}

/* ── Tenant sidebar (Registry topbar) ──────────────────────────────── */

.tenant-sidebar {
  display: flex;
  place-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tenant-btn {
  display: inline-flex;
  place-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;

  &:is(:hover, :focus-visible) {
    color: var(--text);
    border-color: var(--accent);
    outline: none;
  }

  &.active {
    color: var(--accent);
    border-color: var(--tenant-color, var(--accent));
    background: var(--surface-hover);
  }

  /* Idle tenants — exclude active / focus chrome */
  &:not(.active, :hover, :focus-visible) {
    background: var(--surface);
  }
}

.tenant-icon-img {
  border-radius: 4px;
  flex-shrink: 0;
}

.tenant-name {
  max-width: 120px;
  overflow: hidden clip;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Notification toasts ─────────────────────────────────────────── */

.notification-root {
  position: fixed;
  inset-block-end: clamp(16px, 3vw, 24px);
  inset-inline-end: clamp(16px, 3vw, 24px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 2 * var(--pad-inline)));
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.2s ease;
}

.toast-info {
  border-color: var(--accent);
}

.skeleton-row td {
  color: var(--text-dim);
  font-style: italic;
}

/* Shimmer skeletons (preferred over spinner-only panels) */
.skeleton {
  --skeleton-bg: #21262d;
  --skeleton-shine: #30363d;
}

.skeleton-line,
.skeleton-cell {
  height: 12px;
  background: linear-gradient(
    90deg,
    var(--skeleton-bg) 25%,
    var(--skeleton-shine) 50%,
    var(--skeleton-bg) 75%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: skeleton-shine 1.5s ease-in-out infinite;
}

.skeleton-cell {
  height: 16px;
  flex: 1;
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.skeleton-card .skeleton-line + .skeleton-line {
  margin-top: 12px;
}

.skeleton-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.skeleton-row {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #21262d;
}

.skeleton-row.header .skeleton-cell {
  height: 14px;
  animation: none;
  background: var(--skeleton-bg, #21262d);
}

@keyframes skeleton-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line,
  .skeleton-cell,
  .cc-skeleton {
    animation: none;
  }
}

/* ── Main ──────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  max-width: min(var(--layout-max), 100%);
  margin: 0 auto;
  padding-block: var(--pad-block);
  padding-inline: var(--pad-inline);
  width: 100%;
}

/* ── Hero ──────────────────────────────────────────────────────────── */

.hero { margin-bottom: 32px; }

.hero h2 {
  font-size: var(--font-hero);
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.25;
}

.hero-sub { color: var(--text-dim); font-size: 15px; margin-bottom: 20px; }

/* Global surface semantics — injected by glossary-ux from the registry map. */
.portal-surface-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.surface-glossary-link {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.1rem 0.42rem;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 45%, var(--border));
  border-radius: 999px;
  background: var(--tone-info-bg);
  color: var(--brand-accent);
  font: 650 0.64rem/1 var(--font-sans);
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  vertical-align: middle;
}

.surface-glossary-link:is(:hover, :focus-visible) {
  border-color: var(--brand-accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Board primitives (unification SSOT) ─────────────────────────────
 * Promote per-board forks (health-*, doc-*, vh-*, tf-*, live-*) here.
 * @see docs/portal-foundation.md#board-primitives
 * Tone: ok → --green · warn → --yellow · bad → --red · neutral → --text-dim
 */

.portal-page {
  flex: 1;
  width: 100%;
  max-width: min(var(--layout-max), 100%);
  margin: 0 auto;
  padding-block: var(--pad-block, 24px);
  padding-inline: var(--pad-inline, 24px);
  padding-bottom: 48px;
}

/* Alias mature board shells onto portal-page metrics */
.health-page,
.doc-wrap,
.tf-wrap,
.vh-wrap,
.partner-page {
  max-width: min(var(--layout-max), 100%);
  margin-inline: auto;
  padding-inline: var(--pad-inline, 24px);
  padding-bottom: 48px;
  width: 100%;
}

.portal-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-start;
  margin: 8px 0 16px;
}

.portal-hero h1,
.portal-hero .portal-hero__title {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.25;
}

.portal-hero .hero-sub,
.portal-hero .sub {
  width: 100%;
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
  max-width: 72ch;
}

.portal-section,
.section {
  margin: 28px 0;
}

.portal-section > h2,
.section > h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.section-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 12px;
  line-height: 1.4;
}

.portal-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.portal-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.5;
  pointer-events: none;
}

.portal-card--metric .val,
.portal-card .val {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, ui-monospace, monospace);
}

.portal-card--panel {
  padding: 16px 18px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table,
.env-table,
.ops-table,
.live-table,
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--surface);
}

.data-table th,
.env-table th,
.ops-table th,
.live-table th,
.doc-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hover, rgba(255, 255, 255, 0.03));
  white-space: nowrap;
}

.data-table td,
.env-table td,
.ops-table td,
.live-table td,
.doc-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.35);
  vertical-align: top;
}

.data-table .mono,
.env-table .mono,
.ops-table .mono,
.live-table .mono {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
}

/* Row tone rails (Live check pattern) */
.data-table tr.row-ok td:first-child,
.live-table tr.live-row-ok td:first-child,
.ops-table tr.row-ok td:first-child {
  box-shadow: inset 3px 0 0 var(--green, #3fb950);
}
.data-table tr.row-warn td:first-child,
.live-table tr.live-row-warn td:first-child {
  box-shadow: inset 3px 0 0 var(--yellow, #d29922);
}
.data-table tr.row-bad td:first-child,
.live-table tr.live-row-bad td:first-child {
  box-shadow: inset 3px 0 0 var(--red, #f85149);
}

.status-text.ok,
.st-ok { color: var(--tone-ok); font-weight: 600; }
.status-text.warn,
.st-warn { color: var(--tone-warn); font-weight: 600; }
.status-text.bad,
.st-bad { color: var(--tone-bad); font-weight: 600; }

.tone-chip,
.kind-chip,
.plane-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  max-width: 100%;
  word-break: break-word;
}

.tone-chip.tone-ok,
.tone-chip--ok { color: var(--tone-ok); border-color: var(--tone-ok); }
.tone-chip.tone-warn,
.tone-chip--warn { color: var(--tone-warn); border-color: var(--tone-warn); }
.tone-chip.tone-bad,
.tone-chip--bad { color: var(--tone-bad); border-color: var(--tone-bad); }
.tone-chip.tone-neutral,
.tone-chip--neutral { color: var(--tone-skip); }

.kind-chip { color: var(--accent); border-radius: 4px; }
.plane-chip { color: var(--text-dim); border-radius: 4px; }

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 8px;
}

.portal-actions a,
.portal-actions button,
.btn {
  font-size: 13px;
  font-family: inherit;
  padding: 6px 12px;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--accent);
  text-decoration: none;
  background: var(--surface);
  cursor: pointer;
}

.portal-actions a:hover,
.portal-actions button:hover,
.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.portal-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 12px 0 8px;
}

.portal-banner .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.portal-banner.ok .dot { background: var(--tone-ok); box-shadow: 0 0 8px var(--tone-ok); }
.portal-banner.warn .dot { background: var(--tone-warn); }
.portal-banner.bad .dot { background: var(--tone-bad); }
.portal-banner .title { font-weight: 600; font-size: 16px; }
.portal-banner .meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ── Venue identity badges (also public/portal/venues.css) ───────────
 * Brand border+text+8% tint — not status semantics.
 */
:root,
[data-theme="dark"] {
  --venue-poly-border: #2e5cff;
  --venue-poly-text: #58a6ff;
  --venue-poly-bg: rgba(46, 92, 255, 0.08);
  --venue-pinnacle-border: #1a73e8;
  --venue-pinnacle-text: #79c0ff;
  --venue-pinnacle-bg: rgba(26, 115, 232, 0.08);
  --venue-betfair-border: #f5b942;
  --venue-betfair-text: #e3b341;
  --venue-betfair-bg: rgba(245, 185, 66, 0.08);
  --venue-kalshi-border: #7dd3fc;
  --venue-kalshi-text: #a5d6ff;
  --venue-kalshi-bg: rgba(125, 211, 252, 0.08);
  --venue-unknown-border: var(--border, #30363d);
  --venue-unknown-text: var(--text-dim, #8b949e);
  --venue-unknown-bg: rgba(139, 148, 158, 0.08);
}
.venue-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 4px;
  border: 1px solid;
  background: transparent;
  white-space: nowrap;
  user-select: none;
  vertical-align: middle;
}
.venue-badge--sm { font-size: 11px; line-height: 14px; padding: 1px 6px; min-height: 16px; }
.venue-badge--md { font-size: 12px; line-height: 16px; padding: 2px 8px; min-height: 20px; }
.venue-badge__dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.venue-badge--kalshi { color: var(--venue-kalshi-text); border-color: var(--venue-kalshi-border); background: var(--venue-kalshi-bg); }
.venue-badge--kalshi .venue-badge__dot { background: var(--venue-kalshi-border); }
.venue-badge--polymarket { color: var(--venue-poly-text); border-color: var(--venue-poly-border); background: var(--venue-poly-bg); }
.venue-badge--polymarket .venue-badge__dot { background: var(--venue-poly-border); }
.venue-badge--pinnacle { color: var(--venue-pinnacle-text); border-color: var(--venue-pinnacle-border); background: var(--venue-pinnacle-bg); }
.venue-badge--pinnacle .venue-badge__dot { background: var(--venue-pinnacle-border); }
.venue-badge--betfair { color: var(--venue-betfair-text); border-color: var(--venue-betfair-border); background: var(--venue-betfair-bg); }
.venue-badge--betfair .venue-badge__dot { background: var(--venue-betfair-border); }
.venue-badge--unknown { color: var(--venue-unknown-text); border-color: var(--venue-unknown-border); background: var(--venue-unknown-bg); }
.venue-badge--unknown .venue-badge__dot { background: var(--venue-unknown-text); }
.venue-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 11px;
}
.venue-legend__title {
  color: var(--text-dim, #8b949e);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Aligned bar charts (tennis HQ / portal) — grid locks label | track | value */
.bar-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.bar-chart-header { margin-bottom: 12px; }
.bar-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.bar-chart-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.bar-chart-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar-chart-row {
  display: grid;
  grid-template-columns: 72px 1fr 64px;
  align-items: center;
  gap: 12px;
}
.bar-chart-label {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-chart-track {
  height: 8px;
  background: rgba(48, 54, 61, 0.55);
  border-radius: 4px;
  overflow: hidden;
}
.bar-chart-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.3s ease;
  min-width: 0;
}
.bar-chart-value {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: right;
  font-family: var(--font-mono, ui-monospace, monospace);
}

.search-box input {
  width: 100%;
  max-width: 480px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-dim); }

/* ── Error banner ──────────────────────────────────────────────────── */

.error-banner {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.error-banner p { margin-bottom: 4px; }
.error-hint { font-size: 13px; color: var(--text-dim); }
.error-hint code { background: var(--surface); padding: 2px 6px; border-radius: 3px; font-size: 12px; }

.error-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}

.error-state h3 {
  color: #f0f6fc;
  font-family: var(--font-brand);
  font-weight: 600;
  margin-bottom: 8px;
}

.error-state p {
  max-width: 420px;
  margin: 0 auto 8px;
  font-size: 14px;
}

.error-code {
  display: block;
  margin: 16px auto;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
  max-width: 420px;
  word-break: break-all;
}

.error-action {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-sans);
}

.error-action:hover { filter: brightness(1.08); }

.hidden { display: none; }

/* ── Loading ───────────────────────────────────────────────────────── */

.loading-panel,
.ops-loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-dim);
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Dashboard ─────────────────────────────────────────────────────── */

.dashboard { animation: fadeIn .3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: var(--font-metric);
  font-weight: 600;
}

.stat-card span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ── Registry banner ─────────────────────────────────────────────────── */

.registry-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  text-align: center;
  padding: 8px 16px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-hover);
  border-radius: 4px;
}

.registry-freshness {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.registry-freshness::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.registry-freshness--fresh {
  color: var(--status-fresh, var(--tone-ok));
  border-color: color-mix(in srgb, var(--status-fresh, var(--tone-ok)) 40%, var(--border));
  background: var(--status-fresh-bg, var(--tone-ok-bg));
}

.registry-freshness--stale {
  color: var(--status-stale, var(--tone-warn));
  border-color: color-mix(in srgb, var(--status-stale, var(--tone-warn)) 40%, var(--border));
  background: var(--status-stale-bg, var(--tone-warn-bg));
}

.registry-freshness--old {
  color: var(--status-old, var(--tone-old));
  border-color: color-mix(in srgb, var(--status-old, var(--tone-old)) 40%, var(--border));
  background: var(--status-old-bg, var(--tone-old-bg));
}

.registry-freshness--unknown {
  color: var(--tone-skip);
  border-color: color-mix(in srgb, var(--tone-skip) 35%, var(--border));
  background: var(--tone-skip-bg);
}

/* Copy CLI feedback — theme motion + semantic status */
.copy-cli {
  transition:
    border-color var(--duration-fast, 150ms) var(--ease-out, ease),
    color var(--duration-fast, 150ms) var(--ease-out, ease),
    background var(--duration-fast, 150ms) var(--ease-out, ease),
    box-shadow var(--duration-fast, 150ms) var(--ease-out, ease);
}
.copy-cli[data-copy-state="copied"] {
  color: var(--status-fresh, var(--tone-ok));
  border-color: color-mix(in srgb, var(--status-fresh, var(--tone-ok)) 50%, var(--border));
  background: var(--status-fresh-bg, var(--tone-ok-bg));
}
.copy-cli[data-copy-state="failed"] {
  color: var(--status-critical, var(--tone-bad));
  border-color: color-mix(in srgb, var(--status-critical, var(--tone-bad)) 50%, var(--border));
  background: var(--status-critical-bg, var(--tone-bad-bg));
}

.ops-callout {
  font-size: 12px;
  line-height: 1.45;
  color: var(--yellow, #d29922);
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid rgba(210, 153, 34, 0.35);
  border-radius: var(--radius, 8px);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.ops-callout code {
  font-size: 11px;
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 3px;
}

.ops-callout a {
  color: var(--accent);
  margin-left: 4px;
}

.ops-weave-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 8px 0 12px;
}

.ops-weave-h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ops-weave-scripts {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-dim);
}

.ops-weave-scripts code {
  font-size: 11px;
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 3px;
}

.ops-weave-script-group {
  margin: 10px 0 14px;
  padding: 8px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}
.ops-weave-script-group[data-group='registry'] {
  border-color: color-mix(in srgb, var(--yellow, #e6b84d) 35%, var(--border));
}
.ops-weave-script-group[data-group='ops'] {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.ops-weave-script-group[data-group='harness'] {
  border-color: color-mix(in srgb, var(--green, #3fb950) 35%, var(--border));
}
.ops-weave-group-h {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.ops-copy-cmd {
  margin-left: 6px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 1.6;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}
.ops-copy-cmd:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ops-script-id {
  font-size: 9px;
  opacity: 0.65;
  margin-right: 2px;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}
#portal-weave-scripts-meta {
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 8px;
}

.ops-weave-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
  color: var(--accent);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.ops-weave-chip:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.ops-weave-chip[data-group='ops'] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.ops-weave-chip[data-group='harness'] {
  border-color: color-mix(in srgb, var(--green, #3fb950) 40%, var(--border));
}
.ops-weave-chip[data-group='registry'] {
  border-color: color-mix(in srgb, var(--yellow, #e6b84d) 35%, var(--border));
}
.ops-weave-chip[data-group='related'] {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
}

/* ── Package grid ──────────────────────────────────────────────────── */

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.pkg-card,
.ops-panel,
.stat-card,
.card,
.verification-result {
  position: relative;
  overflow: hidden;
}

.pkg-card::before,
.ops-panel::before,
.stat-card::before,
.card::before,
.verification-result::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.25), transparent);
  pointer-events: none;
}

.pkg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .15s, box-shadow .15s;
  cursor: default;
}

.pkg-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.pkg-card.focused {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pkg-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.pkg-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  word-break: break-all;
}

.pkg-badge-new {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--green);
  color: var(--bg);
  vertical-align: middle;
  margin-left: 4px;
}

.metric-value,
.ops-metric,
.stat-card .stat-num,
.card .val,
.health-card .val {
  font-family: var(--font-mono);
  font-size: var(--font-metric);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.ops-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(210, 153, 34, 0.5);
  background: rgba(210, 153, 34, 0.12);
  color: var(--yellow, #d29922);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.ops-table tbody tr.ops-row-warn td {
  background: rgba(248, 81, 73, 0.06);
}

.ops-handshake-detail {
  margin-top: 6px;
  font-size: 12px;
}

.ops-handshake-detail summary {
  cursor: pointer;
  color: var(--text-dim);
}

.ops-mono,
.proof-hash,
.code-block,
.phash,
.mono,
.env-key {
  font-family: var(--font-mono);
}

.pkg-version {
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--surface-hover);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  color: var(--text-dim);
}

.pkg-type {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  margin-bottom: 8px;
}

.pkg-description {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.5;
}

.pkg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pkg-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-hover);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.pkg-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

.pkg-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-dim);
}

/* ── Health bars ───────────────────────────────────────────────────── */

.pkg-health-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pkg-health-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(48, 54, 61, 0.6);
  overflow: hidden;
}
.health-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.pkg-health-bar.healthy .health-fill { background: var(--green); }
.pkg-health-bar.warning .health-fill { background: var(--yellow); }
.pkg-health-bar.critical .health-fill { background: var(--red); }
.pkg-health-label {
  font-size: 11px;
  white-space: nowrap;
}
.pkg-health-label.healthy { color: var(--green); }
.pkg-health-label.warning { color: var(--yellow); }
.pkg-health-label.critical { color: var(--red); }
.pkg-detail-btn {
  margin-top: 8px;
  padding: 4px 12px;
  font-size: 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  cursor: pointer;
  transition: background .15s;
}
.pkg-detail-btn:hover { background: var(--surface-hover); }

/* ── Filter row ─────────────────────────────────────────────────────── */

.filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.filter-groups {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.filter-section, .sort-section {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-label {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chip {
  min-height: 30px;
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.filter-chip:is(:hover, :focus-visible) {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}
.filter-chip.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}
.filter-chip--scope {
  font-family: var(--font-mono);
  font-size: 11px;
}
.filter-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin: -14px 0 16px;
}
.filter-summary {
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.filter-clear {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 500 12px var(--font-sans);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 4px;
}
.filter-clear:is(:hover, :focus-visible) {
  background: var(--accent-glow);
  outline: 2px solid transparent;
}
.filter-clear:disabled {
  color: var(--text-dim);
  cursor: default;
  opacity: 0.45;
  background: transparent;
}
.filter-clear--empty {
  display: block;
  margin: 14px auto 0;
}
#sort-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

/* ── Detail overlay ────────────────────────────────────────────────── */

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  animation: fadeIn .15s ease;
}
.detail-panel {
  width: min(560px, 90vw);
  max-height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 32px 24px;
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-dim);
  cursor: pointer;
}
.detail-close:hover { color: var(--text); }
.detail-name {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}
.detail-health { margin: 16px 0; }
.detail-health .pkg-health-bar { height: 8px; margin-bottom: 6px; }
.health-breakdown {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.detail-section { margin: 20px 0; }
.detail-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.detail-section p { font-size: 13px; color: var(--text); }
.detail-readme {
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-meta {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

.detail-actions {
  margin-bottom: 16px;
}

.copy-install-btn {
  padding: 6px 16px;
  font-size: 13px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  cursor: pointer;
  transition: all .15s;
}
.copy-install-btn:hover,
.copy-create-btn:hover { background: var(--accent); color: var(--bg); }

.copy-create-btn {
  background: rgba(63, 185, 80, 0.15);
  border-color: var(--green);
  color: var(--green);
}
.copy-create-btn:hover { background: var(--green); color: var(--bg); }

/* ── Version list ─────────────────────────────────────────────────── */

.version-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.version-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: var(--surface-hover);
  border-radius: 4px;
  font-size: 13px;
}

.version-num {
  font-family: var(--font-mono);
  color: var(--text);
  min-width: 80px;
}

.version-tags { display: flex; gap: 4px; flex: 1; }

.tag-dist {
  background: rgba(63, 185, 80, 0.15);
  border-color: var(--green);
  color: var(--green);
  font-size: 10px;
  font-weight: 600;
}

.version-date { color: var(--text-dim); white-space: nowrap; }

/* ── Dependency list ──────────────────────────────────────────────── */

.dep-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dep-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--surface-hover);
  border-radius: 4px;
  font-size: 13px;
}

.dep-name {
  font-family: var(--font-mono);
  color: var(--accent);
}

.dep-ver {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}
.detail-meta code {
  font-size: 11px;
  background: var(--bg);
  padding: 2px 4px;
  border-radius: 3px;
}

/* ── Help overlay ──────────────────────────────────────────────────── */

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}

.help-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90vw;
  position: relative;
}

.help-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-dim);
  cursor: pointer;
}
.help-close:hover { color: var(--text); }

.help-panel h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.help-table {
  width: 100%;
  border-collapse: collapse;

  td {
    padding-block: 6px;
    padding-inline: 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.4);

    &:first-child {
      padding-inline-end: 12px;
    }

    &:last-child {
      color: var(--text-dim);
      text-align: end; /* logical — flips with dir=rtl */
    }
  }

  kbd {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding-block: 1px;
    padding-inline: 5px;
  }
}

/* ── Footer ────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── Responsive (media query ranges) ───────────────────────────────── */

@media (width < 641px) {
  .stats-row { grid-template-columns: 1fr; }
  .package-grid { grid-template-columns: 1fr; }
  .filter-row {
    align-items: stretch;
  }
  .filter-groups {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .filter-section {
    align-items: flex-start;
    flex-direction: column;
  }
  .sort-section {
    margin-inline-start: auto;
  }
  .topbar-inner { gap: 12px; }
  .topbar-nav {
    gap: 8px;
    overflow: auto hidden; /* x auto, y hidden — horizontal nav scroll */
  }

  .nav-overflow {
    flex-shrink: 0;
  }
}

.topbar-health-link {
  display: flex;
  place-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;

  &:hover .health-label { color: var(--accent); }
}

/* ── Channel verification cards ────────────────────────────────────── */

.channel-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 16px;
}

.proof-snapshot-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-sans);
}

.proof-snapshot-select {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  max-width: 100%;
}

.channel-filter {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.channel-filter legend {
  font-size: 12px;
  color: var(--text-dim);
  padding: 0 4px;
}

.channel-filter label {
  font-size: 13px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.verification-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.verification-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.verification-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.verification-title {
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 160px;
}

:is(.channel-badge, .version-badge) {
  padding-block: 2px;
  padding-inline: 8px;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(88, 166, 255, 0.35);
}

/* Default accent chrome — exclude semantic variants via multi-arg :not() */
.channel-badge:not(.canary, .pinned, .stable, .latest) {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.35);
  background: var(--accent-glow);
}

.channel-badge {
  &.canary {
    color: var(--yellow);
    border-color: rgba(210, 153, 34, 0.45);
    background: rgba(210, 153, 34, 0.12);
  }

  &.pinned { color: var(--text-dim); }

  &:is(.stable, .latest) {
    color: var(--green);
    border-color: rgba(63, 185, 80, 0.4);
    background: rgba(63, 185, 80, 0.12);
  }
}

.version-badge:not(.match-ok, .match-no) {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.35);
}

.version-badge {
  &.match-ok {
    color: var(--green);
    border-color: rgba(63, 185, 80, 0.4);
  }

  &.match-no {
    color: var(--yellow);
    border-color: rgba(210, 153, 34, 0.45);
  }

  &.subsystem-runtime {
    color: var(--accent);
  }

  &.subsystem-package-manager {
    color: var(--purple, #a371f7);
    border-color: rgba(163, 113, 247, 0.4);
    background: rgba(163, 113, 247, 0.1);
  }

  &.subsystem-networking {
    color: var(--cyan, #39c5cf);
    border-color: rgba(57, 197, 207, 0.4);
    background: rgba(57, 197, 207, 0.1);
  }

  &.subsystem-bundler {
    color: var(--orange, #f0883e);
    border-color: rgba(240, 136, 62, 0.4);
    background: rgba(240, 136, 62, 0.1);
  }

  &.subsystem-test {
    color: var(--green);
    border-color: rgba(63, 185, 80, 0.4);
    background: rgba(63, 185, 80, 0.1);
  }

  &.subsystem-other {
    color: var(--text-dim);
    border-color: rgba(139, 148, 158, 0.35);
  }

  &.introduced-in {
    color: var(--text-dim);
    border-color: rgba(139, 148, 158, 0.3);
    font-variant-numeric: tabular-nums;
  }
}

/* Failed probes — exclude passes from fail emphasis */
.verification-result:not([data-passed='true']) .status-text {
  font-weight: 700;
}

.verification-result time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.test-result pre {
  margin: 6px 0 12px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-x: auto;
}

.status.pass .status-text { color: var(--green); font-weight: 600; font-size: 12px; }
.status.fail .status-text { color: var(--red); font-weight: 600; font-size: 12px; }

.result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
}

.result-links a { color: var(--accent); text-decoration: none; }
.result-links a:hover { text-decoration: underline; }

/* deploy-stamp: 20260801T211729Z */
