:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0e;
  --rail: #0d0f13;
  --surface: #0f1116;
  --surface-2: #151820;
  --surface-hover: #1b202b;
  --line: #1f242e;
  --line-strong: #2d3442;
  --text: #e6e9ef;
  --text-dim: #8c95a6;
  --text-faint: #5b6475;

  --accent: #38bdf8;
  --accent-ink: #04121a;
  --accent-soft: rgba(56, 189, 248, 0.11);
  --accent-line: rgba(56, 189, 248, 0.34);

  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.1);
  --green-line: rgba(52, 211, 153, 0.3);

  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.1);
  --amber-line: rgba(245, 158, 11, 0.3);

  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.1);
  --red-line: rgba(251, 113, 133, 0.32);

  --blue: #38bdf8;
  --blue-soft: rgba(56, 189, 248, 0.1);
  --blue-line: rgba(56, 189, 248, 0.3);

  --input-bg: #0c0e12;
  --table-head: #12151b;
  --table-stripe: rgba(255, 255, 255, 0.012);
  --table-hover: rgba(56, 189, 248, 0.055);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  --radius: 2px;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --rail: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-hover: #e7eaef;
  --line: #dfe3ea;
  --line-strong: #c8cfd9;
  --text: #0f131a;
  --text-dim: #4b5563;
  --text-faint: #6b7280;

  --accent: #0284c7;
  --accent-ink: #ffffff;
  --accent-soft: rgba(2, 132, 199, 0.09);
  --accent-line: rgba(2, 132, 199, 0.3);

  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.09);
  --green-line: rgba(5, 150, 105, 0.28);

  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.09);
  --amber-line: rgba(180, 83, 9, 0.28);

  --red: #e11d48;
  --red-soft: rgba(225, 29, 72, 0.09);
  --red-line: rgba(225, 29, 72, 0.28);

  --blue: #0284c7;
  --blue-soft: rgba(2, 132, 199, 0.09);
  --blue-line: rgba(2, 132, 199, 0.28);

  --input-bg: #ffffff;
  --table-head: #f3f5f8;
  --table-stripe: rgba(0, 0, 0, 0.015);
  --table-hover: rgba(2, 132, 199, 0.05);
  --shadow: 0 12px 30px rgba(15, 19, 26, 0.1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

h1, h2, h3, p, dl, dd, ul {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

code, .mono {
  font-family: var(--mono);
  font-size: 0.92em;
  font-variant-ligatures: none;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
}

:where(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 120;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
  text-decoration: none;
}

.mobile-only {
  display: none !important;
}

/* ---------- app shell & top utility bar ---------- */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--rail);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 46px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-left {
  flex: 1;
}

.brand {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  padding-right: 4px;
  flex: none;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 46px;
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar {
  display: none;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 10px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 100ms ease, border-color 100ms ease;
}

.topnav a:hover {
  color: var(--text);
  text-decoration: none;
}

.topnav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.topnav a[aria-current="page"] .tab-count {
  color: var(--accent);
}

/* Build switcher */

.build-menu {
  position: relative;
}

.build-trigger {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
  transition: border-color 110ms ease, background-color 110ms ease;
}

.build-trigger:hover {
  background: var(--surface-2);
}

.build-trigger[aria-expanded="true"] {
  border-color: var(--accent-line);
  background: var(--surface-2);
}

.build-trigger-left,
.build-trigger-right {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.build-trigger-label {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
}

.build-trigger-badge {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.build-trigger-badge[hidden] {
  display: none;
}

.build-trigger-chevron {
  width: 12px;
  height: 12px;
  color: var(--text-dim);
  transition: transform 140ms ease;
}

.build-trigger[aria-expanded="true"] .build-trigger-chevron {
  transform: rotate(180deg);
}

.build-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 296px;
  max-width: calc(100vw - 24px);
  z-index: 80;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.build-popover[hidden] {
  display: none;
}

.popover-section {
  padding: 11px 12px;
}

.popover-section + .popover-section {
  border-top: 1px solid var(--line);
}

.popover-heading {
  margin-bottom: 7px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.build-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.build-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.build-option:hover {
  background: var(--surface-2);
}

.build-option[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.build-option-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.build-option-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-option-id {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
}

.build-option-meta {
  color: var(--text-dim);
  font-size: 11.5px;
}

.build-option-check {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
  opacity: 0;
}

.build-option[aria-checked="true"] .build-option-check {
  opacity: 1;
}

.popover-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.popover-status-head .popover-heading {
  margin-bottom: 0;
}

.popover-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 550;
}

.popover-checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  list-style: none;
}

.popover-checks li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
}

.popover-check-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.popover-check-name {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-check-empty {
  color: var(--text-faint);
  font-size: 12px;
}

/* Command trigger */

.cmd-trigger {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text-dim);
  font-size: 12px;
  transition: border-color 110ms ease, color 110ms ease;
}

.cmd-trigger:hover {
  border-color: var(--line-strong);
  color: var(--text-dim);
}

.cmd-trigger-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cmd-trigger svg {
  width: 14px;
  height: 14px;
}

/* Rail navigation */

.rail-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-group-label {
  padding: 10px 8px 5px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.rail-group-label:first-child {
  padding-top: 2px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background-color 110ms ease, color 110ms ease, border-color 110ms ease;
}

.rail-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.rail-nav a[aria-current="page"] {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 600;
}

.rail-nav a[aria-current="page"] svg {
  color: var(--accent);
}

.rail-link-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.rail-link-left svg {
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  flex: none;
}

.tab-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.tab-count:empty {
  display: none;
}

.rail-nav a[aria-current="page"] .tab-count {
  color: var(--accent);
}

/* Sidebar footer */

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--line);
}

.sidebar-health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

.sidebar-health-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-dim);
  transition: color 120ms ease, background-color 120ms ease;
}

.theme-toggle:hover,
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.theme-toggle svg,
.icon-btn svg {
  width: 15px;
  height: 15px;
}

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

/* Status dots */

.pill-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--text-faint);
}

.pill--pass .pill-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.pill--warn .pill-dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.pill--fail .pill-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.pill--loading .pill-dot { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }

.popover-status-pill.pill--pass { border-color: var(--green-line); color: var(--green); background: var(--green-soft); }
.popover-status-pill.pill--warn { border-color: var(--amber-line); color: var(--amber); background: var(--amber-soft); }
.popover-status-pill.pill--fail { border-color: var(--red-line); color: var(--red); background: var(--red-soft); }

/* ---------- workspace & panels ---------- */

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1220px;
  margin-inline: auto;
  padding: 28px clamp(18px, 3vw, 34px) 48px;
}

.boot-note {
  padding: 24px 0;
  color: var(--text-dim);
}

.app-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--red-line);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel[hidden] {
  display: none;
}

.panel-head h1,
.overview-hero h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.panel-sub {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 13.5px;
  max-width: 72ch;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:hover {
  text-decoration: none;
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn--primary:hover {
  opacity: 0.92;
}

/* Overview hero */

.overview-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.overview-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-faint);
}

.kicker-tag {
  font-family: var(--mono);
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.overview-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Flat hairline metric strip */

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.metric-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 16px;
  border-left: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: background-color 120ms ease;
}

.metric-cell:first-child {
  border-left: 0;
}

.metric-cell:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.metric-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.metric-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.metric-total {
  margin-left: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
}

.metric-bar {
  height: 3px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 2px;
}

.metric-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.metric-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.35;
}

/* Overview asymmetric 2-column body */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.card-count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

/* Dataset jump rows */

.dataset-rows {
  display: flex;
  flex-direction: column;
}

.dataset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  margin-inline: -8px;
  border-top: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  transition: background-color 110ms ease;
}

.dataset-row:first-child {
  border-top: 0;
}

.dataset-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.dataset-row-name {
  font-weight: 600;
  font-size: 13px;
}

.dataset-row-desc {
  color: var(--text-dim);
  font-size: 12px;
  margin-left: 8px;
}

.dataset-row-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
}

/* Facts, sources, checks */

.facts {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(0, 1fr);
  gap: 8px 12px;
  font-size: 12.5px;
}

.facts dt {
  color: var(--text-faint);
}

.facts dd {
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.sources {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 0;
  list-style: none;
}

.sources li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.source-name {
  font-weight: 600;
  font-size: 13px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11.5px;
}

.source-link:hover {
  color: var(--accent);
}

.checks {
  display: flex;
  flex-direction: column;
  padding: 0;
  list-style: none;
}

.checks li {
  display: grid;
  grid-template-columns: 10px minmax(150px, 210px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.checks li:first-child {
  border-top: 0;
  padding-top: 2px;
}

.checks li.detail-empty {
  display: block;
  border-top: 0;
  color: var(--text-dim);
  font-size: 13px;
}

.check-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}

.check-name {
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.check-detail {
  color: var(--text-dim);
  font-size: 12.5px;
}

.check--pass .check-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.check--warn .check-dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.check--fail .check-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.prose p {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.prose p + p {
  margin-top: 8px;
}

.prose code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
}

/* ---------- toolbar & inputs ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field > label {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.field--grow {
  flex: 1 1 260px;
  min-width: 200px;
}

.select-wrap {
  position: relative;
  display: flex;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -4px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(45deg);
  pointer-events: none;
}

select,
input[type="search"] {
  width: 100%;
  height: 35px;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  transition: border-color 120ms ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 30px 0 10px;
  cursor: pointer;
}

input[type="search"] {
  padding: 0 11px;
}

input[type="search"]::placeholder {
  color: var(--text-faint);
}

select:hover,
input[type="search"]:hover {
  border-color: var(--text-faint);
}

input[type="search"]:focus,
select:focus {
  border-color: var(--accent);
}

.toolbar-meta {
  margin-left: auto;
  padding-bottom: 8px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}

.note {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--text-faint);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12.5px;
}

.note--missing {
  border-color: var(--amber-line);
  border-left-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

.note[hidden] {
  display: none;
}

/* ---------- chips & filter chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
}

.chip--pass, .chip--resolved { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }
.chip--warn, .chip--ambiguous { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber); }
.chip--fail, .chip--missing, .chip--disagree { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }
.chip--fixed, .chip--healed, .chip--interface { border-color: var(--blue-line); background: var(--blue-soft); color: var(--blue); }
.chip--global, .chip--mixed { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.chip--signature { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 550;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.filter-chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.filter-chip[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}

.filter-chip[data-status="resolved"] .filter-dot { background: var(--green); }
.filter-chip[data-status="healed"] .filter-dot,
.filter-chip[data-status="fixed"] .filter-dot { background: var(--blue); }
.filter-chip[data-status="ambiguous"] .filter-dot { background: var(--amber); }
.filter-chip[data-status="missing"] .filter-dot { background: var(--red); }

.filter-count {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.8;
}

/* ---------- tables ---------- */

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  max-height: min(68vh, 740px);
  overflow: auto;
  overscroll-behavior: contain;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 12px;
  background: var(--table-head);
  border-bottom: 1px solid var(--line-strong);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td {
  background: var(--table-stripe);
}

.data-table tbody tr:hover td {
  background: var(--table-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .dim { color: var(--text-dim); }
.data-table .num { font-family: var(--mono); text-align: right; }
.data-table .dec { display: block; font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.data-table .col-action { width: 1%; white-space: nowrap; text-align: right; }
.dash { color: var(--text-faint); }
.empty-row td { padding: 26px 14px; text-align: center; color: var(--text-dim); }

.twin-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  color: var(--text-dim);
  font-size: 12px;
}

.twin-label {
  padding: 0 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.alias-hint {
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 10.5px;
}

.copy-btn {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 550;
}

.copy-btn:hover { color: var(--text); border-color: var(--text-faint); }
.copy-btn.is-copied { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }
.copy-btn.is-failed { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }

/* Signature expand */

.sig-table tr[data-sig] { cursor: pointer; }

.sig-toggle {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  position: relative;
}

.sig-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -4px 0 0 -3px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(45deg);
  transition: transform 130ms ease;
}

.sig-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg);
  margin-top: -2px;
}

.detail-row td {
  padding: 0 !important;
  background: var(--bg) !important;
}

.sig-detail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.kv { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv--span-2 { grid-column: span 2; }
.kv--span-4 { grid-column: 1 / -1; }
.kv-label { font-size: 10px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); }
.kv-value { font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.code {
  display: block;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11.5px;
  word-break: break-all;
}

/* ---------- schemas split ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.pick-list {
  list-style: none;
  padding: 0;
  max-height: min(64vh, 660px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pick {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
}

.pick:hover { background: var(--surface-2); color: var(--text); }
.pick[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); font-weight: 600; }
.pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-count { font-size: 11px; color: var(--text-faint); flex: none; }

.detail-pane { min-width: 0; }
.detail-head h3 { font-family: var(--mono); font-size: 17px; font-weight: 650; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.detail-section-title { margin: 16px 0 8px; font-size: 11px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); }
.fields-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.fields-scroll { max-height: 460px; overflow: auto; }
.detail-empty { color: var(--text-dim); font-size: 13px; padding: 6px 0; }

.enums-block { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.enums-block > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text); }
.enum-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.enum { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: var(--surface); }
.enum > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; }
.enum-name { font-family: var(--mono); font-weight: 600; }
.enum-members table { width: 100%; border-collapse: collapse; margin-top: 8px; font-family: var(--mono); font-size: 11.5px; }
.enum-members th, .enum-members td { padding: 4px 6px; border-top: 1px solid var(--line); text-align: left; }

/* SDK generator tab */

.sdk-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sdk-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.sdk-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.sdk-opt input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.sdk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sdk-bar .field {
  min-width: 240px;
}

.sdk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sdk-actions .toolbar-meta {
  padding-bottom: 0;
  margin-right: 4px;
}

.sdk-preview-card {
  padding: 14px 16px;
}

.sdk-preview {
  margin: 0;
  padding: 12px 14px;
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
  tab-size: 4;
}

/* API table */

.api-table .api-desc { color: var(--text-dim); font-size: 12.5px; }
.link-out { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; }
.icon-ext { width: 11px; height: 11px; flex: none; }
.link-out.is-missing { color: var(--text-faint); }

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.footer-inner {
  max-width: 1220px;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 16px clamp(18px, 3vw, 34px);
  color: var(--text-faint);
  font-size: 12px;
}

.footer-inner strong { color: var(--text); font-family: var(--mono); }
.footer-meta { font-family: var(--mono); font-size: 11.5px; }

/* ---------- command palette modal ---------- */

.cmd-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 24px;
}

.cmd-modal[hidden] {
  display: none;
}

.cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(4px);
}

.cmd-dialog {
  position: relative;
  width: 100%;
  max-width: 580px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.cmd-input-row svg {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  flex: none;
}

.cmd-input-row input {
  flex: 1;
  border: 0;
  background: transparent;
  height: 26px;
  padding: 0;
  font-size: 14px;
  outline: none;
}

.cmd-results {
  list-style: none;
  padding: 6px;
  max-height: 360px;
  overflow: auto;
}

.cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}

.cmd-item:hover,
.cmd-item[aria-selected="true"] {
  background: var(--surface-2);
}

.cmd-item[aria-selected="true"] {
  outline: 1px solid var(--accent-line);
}

.cmd-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cmd-item-name {
  font-family: var(--mono);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-item-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  flex: none;
}

.cmd-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

.cmd-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--rail);
  color: var(--text-faint);
  font-size: 11px;
}

.cmd-foot span:last-child {
  margin-left: auto;
  font-family: var(--mono);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

/* ---------- responsive ---------- */

@media (max-width: 1020px) {
  .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .metric-cell:nth-child(4),
  .metric-cell:nth-child(5) {
    border-top: 1px solid var(--line);
  }
  .metric-cell:nth-child(4) {
    border-left: 0;
  }
  .overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 268px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .app-shell.is-drawer-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.55);
  }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 14px;
    background: var(--rail);
    border-bottom: 1px solid var(--line);
  }

  .mobile-brand {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
  }

  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .checks li {
    grid-template-columns: 10px minmax(0, 1fr) auto;
  }

  .check-detail {
    grid-column: 2 / -1;
  }
}

@media (max-width: 560px) {
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric-cell:nth-child(odd) {
    border-left: 0;
  }
  .metric-cell:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

/* ---------- unslop overrides: sharp technical workbench ---------- */

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  flex: 1;
}

.panel-head--inline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head--inline h1 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.panel-head--inline .panel-sub {
  margin-top: 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

.metric-strip {
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.metric-cell {
  padding: 12px 14px;
}

.metric-value {
  font-size: 20px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}

.card,
.build-popover,
.cmd-dialog,
.btn,
.copy-btn,
.theme-toggle,
.icon-btn,
input,
select,
.chip,
.build-trigger-badge,
.popover-status-pill,
.status-filter,
.build-option,
kbd {
  border-radius: var(--radius) !important;
}

.theme-toggle {
  width: 28px;
  height: 28px;
}

.pill--pass .pill-dot,
.pill--warn .pill-dot,
.pill--fail .pill-dot {
  box-shadow: none;
}

.card-head {
  padding: 10px 14px;
}

.data-table th,
.data-table td {
  padding: 7px 12px;
}

.footer {
  border-top: 1px solid var(--line);
  background: var(--rail);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-faint);
}

.footer-disclaimer strong {
  font-family: var(--mono);
  color: var(--text-dim);
}

@media (max-width: 900px) {
  .topbar-inner {
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topnav {
    order: 3;
    width: 100%;
    height: 36px;
    border-top: 1px solid var(--line);
  }
  .topnav a {
    height: 36px;
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
}
