:root {
  --bg: #0a0d13;
  --panel: #10151e;
  --panel-2: #141b26;
  --line: #1e2836;
  --line-soft: #18202c;
  --text: #e7eef9;
  --muted: #8b99ae;
  --muted-dim: #64728a;
  --accent: #4c8dff;
  --accent-soft: rgba(76, 141, 255, 0.12);
  --ok: #35d39b;
  --warn: #f0b445;
  --bad: #ff6b6b;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 78% -12%, rgba(76, 141, 255, 0.10), transparent 62%),
    radial-gradient(760px 420px at 8% -6%, rgba(53, 211, 155, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 22px 56px;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

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

/* ---------- app bar ---------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 0 12px;
  margin-bottom: 4px;
  background: linear-gradient(180deg, rgba(10, 13, 19, 0.96) 62%, rgba(10, 13, 19, 0.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(76, 141, 255, 0.28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; letter-spacing: 0.14em; font-size: 13px; }
.brand-sub { font-size: 11px; color: var(--muted-dim); letter-spacing: 0.02em; }

.nav { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.nav-link {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav-link.is-active { color: var(--text); background: var(--panel-2); border-color: var(--line); }

.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.status-pill:hover { border-color: rgba(76, 141, 255, 0.5); }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-dim);
  box-shadow: 0 0 0 3px rgba(139, 153, 174, 0.12);
}
.status-pill.is-active .status-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(53, 211, 155, 0.18); animation: breathe 2.6s ease-in-out infinite; }
.status-pill.is-degraded .status-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(240, 180, 69, 0.18); }
.status-pill.is-down .status-dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.18); }
.status-count { color: var(--muted); font-size: 11px; }

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.volume { display: flex; flex-direction: column; text-align: right; line-height: 1.2; }
.volume-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-dim); }
.volume-value { font-size: 17px; font-weight: 650; }
.volume-note { font-size: 10.5px; color: var(--muted-dim); }

/* ---------- hero ---------- */

.hero { padding: 26px 0 4px; }
.eyebrow { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-dim); }
.hero h1 { margin: 0; font-size: clamp(22px, 3vw, 32px); font-weight: 680; letter-spacing: -0.02em; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
}

/* ---------- KPI ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 22px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); }
.kpi-value { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.kpi-note { font-size: 11px; color: var(--muted); }

/* ---------- panels ---------- */

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(16, 21, 30, 0.86) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
  scroll-margin-top: 84px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 640; letter-spacing: -0.01em; }
.panel-sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.count {
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
  margin-left: 4px;
}
.head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.badge {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge-ok { color: var(--ok); border-color: rgba(53, 211, 155, 0.32); background: rgba(53, 211, 155, 0.08); }
.badge-warn { color: var(--warn); border-color: rgba(240, 180, 69, 0.32); background: rgba(240, 180, 69, 0.08); }
.badge-bad { color: var(--bad); border-color: rgba(255, 107, 107, 0.32); background: rgba(255, 107, 107, 0.08); }

/* ---------- posture ---------- */

.posture-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.stat-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); }
.stat-value { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.stat-value-sm { font-size: 14px; font-weight: 600; }
.stat-note { font-size: 11px; color: var(--muted); }
.stat-action { justify-content: space-between; }

/* ---------- verification ---------- */

.verify-block { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.verify-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.verify-head h3 { margin: 0; font-size: 12.5px; font-weight: 620; letter-spacing: 0.02em; }
.verify-source { font-size: 10.5px; color: var(--muted-dim); }
.verify-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 12px;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  min-width: 0;
}
.check-mark { font-size: 11px; line-height: 1.4; font-weight: 700; flex: none; }
.check.pass .check-mark { color: var(--ok); }
.check.fail .check-mark { color: var(--bad); }
.check-body { min-width: 0; }
.check-name { font-size: 11.5px; font-weight: 600; }
.check-detail { font-size: 10.5px; color: var(--muted); word-break: break-word; }
.loading { font-size: 12px; color: var(--muted); }

/* ---------- filters + pipeline ---------- */

.input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  padding: 9px 11px;
  min-width: 260px;
}
.input:focus { outline: none; border-color: rgba(76, 141, 255, 0.55); box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.12); }

.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filter {
  font: inherit;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding: 5px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
}
.filter:hover { color: var(--text); border-color: rgba(76, 141, 255, 0.4); }
.filter.is-on { color: var(--text); background: var(--accent-soft); border-color: rgba(76, 141, 255, 0.55); }

.pipeline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.sol-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.sol-card {
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sol-card:hover { border-color: rgba(76, 141, 255, 0.45); }
.sol-card.is-selected { border-color: rgba(76, 141, 255, 0.75); background: rgba(76, 141, 255, 0.07); }

.sol-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sol-agency { font-size: 9.5px; letter-spacing: 0.12em; color: var(--accent); }
.sol-id { font-size: 10.5px; color: var(--muted-dim); font-family: var(--mono); }
.sol-naics { font-size: 10px; color: var(--muted-dim); margin-left: auto; font-family: var(--mono); }
.sol-title { font-size: 13px; font-weight: 620; letter-spacing: -0.005em; }
.sol-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.sol-ceiling { font-weight: 620; color: var(--text); }
.sol-match { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.bar { width: 66px; height: 4px; border-radius: 999px; background: rgba(139, 153, 174, 0.18); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.due { font-size: 10.5px; }
.due-soon { color: var(--warn); }
.due-past { color: var(--bad); }

/* ---------- detail ---------- */

.detail {
  position: sticky;
  top: 76px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.detail-empty { font-size: 12px; color: var(--muted); }
.detail h3 { margin: 2px 0 6px; font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.detail-agency { font-size: 11px; color: var(--muted); }
.detail-kicker { font-size: 9.5px; letter-spacing: 0.14em; color: var(--accent); text-transform: uppercase; }
.detail-rows { margin: 12px 0; display: grid; gap: 1px; border-radius: var(--radius-sm); overflow: hidden; }
.drow { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; background: rgba(10, 13, 19, 0.55); font-size: 11.5px; }
.drow span:first-child { color: var(--muted-dim); }
.drow span:last-child { text-align: right; font-family: var(--mono); font-size: 11px; }
.detail-sub { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); margin: 14px 0 6px; }
.prereq-row { display: flex; flex-wrap: wrap; gap: 5px; }
.prereq { font-size: 10px; padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(53, 211, 155, 0.28); color: var(--ok); background: rgba(53, 211, 155, 0.07); }
.arch { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.detail-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-size: 12px;
  font-weight: 580;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: rgba(76, 141, 255, 0.5); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #04070d; font-weight: 620; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; }

/* ---------- map ---------- */

.map-wrap { position: relative; }
.map-canvas { width: 100%; }
.map-canvas svg { display: block; width: 100%; height: auto; }
.country { fill: #172231; stroke: #1f2c3d; stroke-width: 0.35; }
.graticule { fill: none; stroke: #16202d; stroke-width: 0.3; }
.sphere { fill: none; stroke: #1f2c3d; stroke-width: 0.8; }
.anchor-dot { fill: var(--accent); stroke: #0a0d13; stroke-width: 1.2; cursor: pointer; }
.anchor-halo { fill: var(--accent); opacity: 0.14; animation: halo 3.4s ease-out infinite; }
.anchor.is-selected .anchor-dot { fill: #bfe0ff; }
@keyframes halo { 0% { r: 4; opacity: 0.26; } 70% { r: 15; opacity: 0; } 100% { r: 15; opacity: 0; } }

.map-tip {
  position: absolute;
  pointer-events: none;
  background: #04070d;
  border: 1px solid rgba(76, 141, 255, 0.45);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 11px;
  min-width: 160px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  z-index: 5;
}
.map-tip strong { display: block; font-size: 11.5px; }
.map-tip span { color: var(--muted); }

.anchor-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}
.anchor-item {
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.anchor-item:hover { border-color: rgba(76, 141, 255, 0.45); }
.anchor-item.is-selected { border-color: rgba(76, 141, 255, 0.7); background: rgba(76, 141, 255, 0.07); }
.anchor-name { font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.anchor-dot-sm { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); flex: none; }
.anchor-region { font-size: 10px; color: var(--muted-dim); letter-spacing: 0.06em; }
.anchor-role { font-size: 10.5px; color: var(--muted); }

/* ---------- frameworks ---------- */

.fw-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fw {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.fw-name { font-size: 12.5px; font-weight: 620; display: flex; align-items: center; gap: 7px; }
.fw-scope { font-size: 10.5px; color: var(--muted-dim); margin-top: 2px; }
.fw-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.fw-bar { flex: 1; height: 4px; border-radius: 999px; background: rgba(139, 153, 174, 0.18); overflow: hidden; }
.fw-bar span { display: block; height: 100%; background: var(--ok); }
.fw-count { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }

/* ---------- proposal ---------- */

.proposal-out { border-top: 1px solid var(--line-soft); padding-top: 14px; }
.proposal-out .empty, .empty { font-size: 12px; color: var(--muted); }
.proposal-doc {
  background: #04070d;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cfdaea;
  max-height: 620px;
  overflow: auto;
}
.proposal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

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

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted-dim);
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}
.footer-links { display: flex; gap: 14px; }
.footer-links a { color: var(--muted); }

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

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .verify-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .posture-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .anchor-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fw-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .nav { display: none; }
  .pipeline-layout { grid-template-columns: 1fr; }
  .detail { position: static; }
  .volume { display: none; }
}

@media (max-width: 640px) {
  .shell { padding: 0 14px 40px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .posture-grid, .verify-grid, .anchor-list, .fw-list { grid-template-columns: 1fr; }
  .input { min-width: 0; width: 100%; }
  .panel { padding: 15px; }
}

/* ---- Market Registry verification surface ---- */
.sol-verify {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.sol-verify.is-unverified { border-color: rgba(226, 163, 64, 0.35); color: #e2a340; background: rgba(226, 163, 64, 0.08); }
.sol-verify.is-verified { border-color: rgba(53, 211, 155, 0.35); color: var(--ok); background: rgba(53, 211, 155, 0.08); }
.sol-verify.is-qualified { border-color: rgba(53, 211, 155, 0.55); color: var(--ok); background: rgba(53, 211, 155, 0.16); }
.registry-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(226, 163, 64, 0.3);
  background: rgba(226, 163, 64, 0.07);
  color: #e2a340;
}
.registry-note.is-qualified-note {
  border-color: rgba(53, 211, 155, 0.32);
  background: rgba(53, 211, 155, 0.08);
  color: var(--ok);
}
.badge-warn { border-color: rgba(226, 163, 64, 0.4); color: #e2a340; }

/* ------------------------------ inline sheet ------------------------------ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start;
  justify-content: center; padding: 6vh 20px 40px; overflow-y: auto;
  background: rgba(6, 9, 14, 0.74);
}
.sheet {
  width: min(720px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.sheet-title { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sheet-x {
  font: inherit; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: transparent; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.sheet-x:hover, .sheet-x:focus-visible { color: var(--text); border-color: var(--accent); outline: none; }
.sheet-body { padding: 18px; }
.sheet-lede { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.sheet-rows { display: grid; grid-template-columns: minmax(110px, 165px) 1fr; gap: 8px 16px; margin: 0 0 18px; }
.sheet-rows dt { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); padding-top: 3px; }
.sheet-rows dd { margin: 0; font-size: 13px; color: var(--text); }
.sheet-code {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 12px 14px; margin: 0 0 12px; font-size: 12px; line-height: 1.5;
  overflow-x: auto; color: var(--text); white-space: pre;
}
.sheet-checks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 4px 14px; font-size: 12px; color: var(--muted); }
.sheet-checks li.is-ok span { color: var(--ok); }
.sheet-checks li.is-bad, .sheet-checks li.is-bad span { color: var(--bad); }
.sheet-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--muted-dim); }
.sheet-link { display: inline-block; text-decoration: none; }
body.sheet-open { overflow: hidden; }
