:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-dark: #151b2d;
  --text: #182033;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); }
a { color: inherit; }
button, input { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: var(--surface-dark); color: #fff; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: #fff; color: var(--surface-dark); font-weight: 800; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 2px; color: #aeb5c7; font-size: 12px; }
.nav-group { margin-top: 20px; }
.nav-label { display: block; padding: 0 10px 8px; color: #7f89a4; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 9px 10px; margin: 2px 0; border-radius: 9px; color: #cbd1de; text-decoration: none; font-size: 13px; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset 2px 0 0 #8b83ff; }
.nav-number { width: 20px; color: #7f89a4; font-size: 10px; font-variant-numeric: tabular-nums; }
.sidebar-footer { margin-top: auto; display: flex; gap: 8px; align-items: center; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); color: #8f98ad; font-size: 11px; }
.system-dot { width: 8px; height: 8px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgba(50,213,131,.1); }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.search-wrap { position: relative; width: min(620px, 62vw); }
.search-wrap input { width: 100%; height: 42px; padding: 0 60px 0 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--text); outline: none; }
.search-wrap input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.search-icon { position: absolute; left: 14px; top: 9px; color: var(--muted); font-size: 20px; z-index: 1; }
kbd { position: absolute; right: 10px; top: 9px; padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--muted); font-size: 11px; box-shadow: 0 1px 0 var(--line); }
.search-results { position: absolute; top: 48px; left: 0; right: 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 16px 36px rgba(16,24,40,.14); padding: 8px; }
.search-result { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.search-result:hover { background: var(--surface-soft); }
.search-result strong { display: block; font-size: 13px; }
.search-result small { color: var(--muted); }
.topbar-meta { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 11px; }
.repo-link { color: var(--text); text-decoration: none; font-weight: 600; }
.icon-button { border: 0; background: transparent; cursor: pointer; }
.mobile-menu { display: none; margin-right: 10px; font-size: 22px; }

.content { padding: 32px; max-width: 1600px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.035em; line-height: 1.1; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
h3 { margin: 0; font-size: 14px; }
.page-subtitle { max-width: 760px; margin: 10px 0 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--text); text-decoration: none; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }

.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.two-column { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); }
.three-column { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 20px; }
.kpi-card { padding: 18px 20px; }
.kpi-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.kpi-value { display: block; margin-top: 10px; font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.kpi-note { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.score-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.score-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.score-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.score-top strong { font-size: 12px; }
.score-top span { font-size: 22px; font-weight: 800; letter-spacing: -.04em; }
.progress { height: 7px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #e9ecf2; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.score-note { margin-top: 8px; color: var(--muted); font-size: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 12px; }
th { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; background: var(--surface-soft); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.record-link { color: var(--text); text-decoration: none; font-weight: 700; }
.record-link:hover { color: var(--accent); }
.id-code { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.status { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; background: #f2f4f7; color: #475467; }
.status.released, .status.accepted, .status.approved, .status.established, .status.complete, .status.done, .status.verified, .status.published { color: var(--success); background: var(--success-soft); }
.status.in-progress, .status.in-development, .status.in-review, .status.measuring, .status.monitoring, .status.soft-launched, .status.promoted, .status.review { color: var(--info); background: var(--info-soft); }
.status.planned, .status.planning, .status.evaluating, .status.spec-ready, .status.proposed { color: var(--warning); background: var(--warning-soft); }
.status.blocked, .status.rejected, .status.underperforming { color: var(--danger); background: var(--danger-soft); }
.status.not-started, .status.not-launched, .status.not-measured, .status.not-specified, .status.deferred, .status.archived, .status.superseded { color: #475467; background: #f2f4f7; }

.list { list-style: none; padding: 0; margin: 0; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:first-child { padding-top: 0; }
.list-item:last-child { padding-bottom: 0; border-bottom: 0; }
.rank { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; }
.list-item strong { display: block; font-size: 12px; line-height: 1.4; }
.list-item small { display: block; margin-top: 4px; color: var(--muted); }
.alert-list { display: grid; gap: 9px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid #fedf89; border-radius: 9px; background: var(--warning-soft); color: #7a2e0e; font-size: 12px; line-height: 1.45; }
.alert.danger { border-color: #fecdca; background: var(--danger-soft); color: #912018; }
.alert.success { border-color: #abefc6; background: var(--success-soft); color: #05603a; }
.empty { padding: 26px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); text-align: center; font-size: 12px; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
.detail-section { padding: 20px; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h2 { margin-bottom: 12px; }
.detail-section p { color: var(--muted); line-height: 1.65; font-size: 13px; }
.detail-section ul { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.metadata { display: grid; gap: 12px; }
.metadata-row { display: grid; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.metadata-row:last-child { border-bottom: 0; padding-bottom: 0; }
.metadata-row dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.metadata-row dd { margin: 0; font-size: 12px; line-height: 1.5; word-break: break-word; }
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); font-size: 10px; text-decoration: none; }
.pill:hover { border-color: #a5b4fc; color: var(--accent); }

.pipeline { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.pipeline-step { min-height: 92px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.pipeline-step strong { display: block; font-size: 24px; }
.pipeline-step span { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.principle { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.principle strong { display: block; margin-bottom: 6px; font-size: 12px; }
.principle p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.code-block { padding: 16px; overflow-x: auto; border-radius: 10px; background: #101828; color: #d0d5dd; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.loading-state { padding: 80px 20px; color: var(--muted); text-align: center; }

@media (max-width: 1200px) {
  .score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; transition: left .2s ease; width: 256px; box-shadow: 20px 0 40px rgba(16,24,40,.2); }
  .sidebar.open { left: 0; }
  .mobile-menu { display: block; }
  .topbar { padding: 12px 16px; }
  .topbar-meta { display: none; }
  .search-wrap { width: 100%; }
  .content { padding: 24px 16px; }
  .two-column, .detail-layout { grid-template-columns: 1fr; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .kpi-grid, .score-grid, .three-column, .principles, .pipeline { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .search-wrap kbd { display: none; }
  .search-wrap input { padding-right: 14px; }
  h1 { font-size: 28px; }
}
