@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #f6f5fa;
  --bg-soft: #eeecf4;
  --surface: #fff;
  --surface-2: #faf9fd;
  --line: #e6e3ef;
  --line-strong: #d8d4e6;
  --txt: #1c1726;
  --txt-dim: #6b6480;
  --txt-faint: #9a93ac;
  --infer: #6d4aff;
  --infer-soft: #efeaff;
  --agent: #0fa9b4;
  --pink: #e0479a;
  --ok: #16a866;
  --ok-soft: #e1f5ec;
  --warn: #d99411;
  --warn-soft: #fbf0d8;
  --bad: #e0443e;
  --bad-soft: #fde7e5;
  --shadow-sm: 0 1px 2px rgba(28, 23, 38, 0.05), 0 1px 3px rgba(28, 23, 38, 0.04);
  --shadow: 0 8px 24px -10px rgba(28, 23, 38, 0.16), 0 10px 14px -12px rgba(28, 23, 38, 0.16);
}

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Sora', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input,
select {
  font-family: inherit;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100dvh;
}

.sidebar {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 20px 18px 24px;
  background: linear-gradient(180deg, #ffffff 0%, #faf9fd 100%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  width: 140px;
  height: auto;
  display: block;
}

.rail-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.rail-primary {
  background: linear-gradient(180deg, #ffffff 0%, #f7f3ff 100%);
  border-color: #ddd3ff;
}

.rail-label {
  margin-bottom: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--txt-faint);
}

.rail-metric,
.rail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rail-metric + .rail-metric,
.rail-row + .rail-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rail-metric span,
.rail-row span {
  color: var(--txt-dim);
  font-size: 11px;
  line-height: 1.4;
}

.rail-metric strong {
  max-width: 58%;
  text-align: right;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.rail-row strong {
  max-width: 58%;
  text-align: right;
  font-size: 11px;
  line-height: 1.45;
}

.rail-note p {
  margin-bottom: 12px;
  color: var(--txt-dim);
  font-size: 12px;
  line-height: 1.55;
}

.rail-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--bg-soft);
  color: var(--txt-dim);
}

.rail-status.good {
  background: var(--ok-soft);
  color: var(--ok);
}

.rail-status.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.rail-status.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(230, 227, 239, 0.8);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
}

.top-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--infer);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--txt-dim);
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.content {
  width: min(100%, 1380px);
  padding: 24px 28px 48px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.intro {
  max-width: 860px;
  margin-bottom: 26px;
}

.intro-kicker {
  margin-bottom: 8px;
  color: var(--infer);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.intro-copy {
  color: var(--txt-dim);
  font-size: 14px;
  line-height: 1.7;
}

.section-block {
  margin-top: 18px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card.pad {
  padding: 20px;
}

h1 {
  margin-bottom: 10px;
  font-size: 34px;
  letter-spacing: -1px;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
  letter-spacing: -0.4px;
}

.muted {
  color: var(--txt-dim);
  font-size: 13px;
  line-height: 1.65;
}

.note {
  border-left: 3px solid var(--infer);
  border-radius: 12px;
  background: var(--infer-soft);
  padding: 14px 15px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--txt-dim);
}

.note-rationale {
  margin-top: 16px;
}

.sec {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 14px;
}

.sec .dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--infer);
}

.sec h3 {
  font-size: 15px;
}

.sec span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--txt-faint);
}

.sec-rationale .dot {
  background: var(--pink);
}

.sec-technical .dot {
  background: var(--ok);
}

.edition-grid,
.pillar-grid,
.form-grid,
.model-grid,
.kpi-grid,
.arch-grid {
  display: grid;
  gap: 12px;
}

.edition-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.pillar-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.model-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.arch-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.edition {
  position: relative;
  min-height: 214px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
  cursor: pointer;
  transition: 0.16s ease;
}

.edition:hover,
.pillar-card:hover,
.model-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.edition input,
.pillar-card input,
.model-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.edition.active,
.model-card.active {
  border-color: var(--infer);
  box-shadow: 0 0 0 3px var(--infer-soft), var(--shadow);
}

.edition .label,
.pillar-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.edition .label {
  margin-bottom: 10px;
}

.edition .name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.edition .tag {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--bg-soft);
  color: var(--txt-dim);
  font-size: 10px;
  font-weight: 800;
}

.edition.active .tag {
  background: var(--infer-soft);
  color: var(--infer);
}

.edition ul {
  margin-top: 12px;
  padding-left: 18px;
  color: var(--txt-dim);
  font-size: 12px;
  line-height: 1.7;
}

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

.field label,
.kpi .l,
.arch .a-label,
.table th {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--txt-faint);
}

.field input,
.field select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--txt);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--infer);
  box-shadow: 0 0 0 3px var(--infer-soft);
}

.field-toggle {
  justify-content: center;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--txt);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.check-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--infer);
}

.field-help {
  color: var(--txt-faint);
  font-size: 11px;
  line-height: 1.45;
}

.pillar-card,
.model-card,
.arch {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  transition: 0.14s ease;
}

.pillar-card .head {
  margin-bottom: 8px;
}

.pillar-card .name,
.model-name {
  font-size: 13px;
  font-weight: 900;
}

.pillar-card .desc,
.model-use,
.arch .a-note,
.kpi .s {
  color: var(--txt-dim);
  font-size: 11px;
  line-height: 1.5;
}

.toggle {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #d8d4e6;
  position: relative;
  flex: none;
}

.toggle:after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: 0.14s ease;
}

.pillar-card input:checked + .head .toggle {
  background: linear-gradient(90deg, var(--infer), var(--agent));
}

.pillar-card input:checked + .head .toggle:after {
  left: 18px;
}

.model-meta,
.score-value,
.crumb,
.sec span {
  font-family: 'IBM Plex Mono', monospace;
}

.model-meta {
  margin: 5px 0 7px;
  font-size: 10px;
  color: var(--txt-faint);
}

.kpi {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, var(--surface-2) 100%);
}

.kpi .v,
.arch .a-value {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.75px;
}

.score-row {
  display: grid;
  grid-template-columns: 120px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.score-label {
  color: var(--txt-dim);
  font-size: 12px;
  font-weight: 800;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-soft);
}

.bar div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--infer), var(--agent));
}

.score-value {
  text-align: right;
  color: var(--txt-dim);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 12px;
}

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

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
}

.good {
  background: var(--ok-soft);
  color: var(--ok);
}

.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.neutral {
  background: var(--bg-soft);
  color: var(--txt-dim);
}

.details {
  display: none;
  margin-top: 18px;
}

.details.show {
  display: block;
}

.formula {
  border-radius: 16px;
  background: #211936;
  color: #f4efff;
  padding: 15px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

@media (max-width: 1280px) {
  .app {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .content {
    padding: 22px 22px 42px;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand,
  .rail-primary,
  .rail-note {
    grid-column: 1 / -1;
  }

  .main,
  .scroll {
    overflow: visible;
  }

  .topbar {
    padding: 14px 18px;
  }

  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .sidebar,
  .two-col {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }

  .top-actions {
    width: 100%;
  }
  .btn {
    flex: 1 1 180px;
  }

  .score-row {
    grid-template-columns: 100px 1fr 44px;
  }
}
