:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #15233b;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #155eef;
  --primary-dark: #0f3fb8;
  --primary-soft: #eaf1ff;
  --success: #087e5b;
  --success-soft: #e6f7f1;
  --warning: #b45309;
  --warning-soft: #fff7e6;
  --danger: #b42318;
  --danger-soft: #fff0ef;
  --purple: #6941c6;
  --purple-soft: #f3efff;
  --shadow: 0 16px 40px rgba(21, 35, 59, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  background:
    radial-gradient(circle at 15% 5%, rgba(84, 120, 255, 0.25), transparent 33%),
    linear-gradient(180deg, #102044 0%, #0c1731 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 34px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #6ea8fe, #2e65e8);
  box-shadow: 0 10px 24px rgba(34, 96, 230, 0.35);
  font-family: "Manrope", sans-serif;
  font-weight: 800;
}
.brand strong {
  display: block;
  font-family: "Manrope", sans-serif;
  font-size: 15px;
}
.brand span {
  color: #aebcdc;
  font-size: 12px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-item {
  width: 100%;
  border: 0;
  color: #b9c5df;
  background: transparent;
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 10px;
  text-align: left;
  font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: rgba(80, 133, 255, .18);
  color: #fff;
  box-shadow: inset 3px 0 0 #72a3ff;
}
.nav-number {
  width: 23px;
  height: 23px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  font-size: 11px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  border-radius: 12px;
}
.sidebar-footer .small { color: #9eadca; }
.sidebar-footer strong { font-size: 13px; }

.main {
  min-width: 0;
}
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 4;
}
.topbar-title {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 16px;
}
.topbar-meta {
  display: flex;
  gap: 14px;
  align-items: center;
}
.status-pill, .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.status-pill { background: var(--primary-soft); color: var(--primary-dark); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary-dark); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }

.content {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.hero {
  padding: 38px;
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 20%, rgba(118, 170, 255, .32), transparent 28%),
    radial-gradient(circle at 10% 95%, rgba(84, 229, 199, .17), transparent 36%),
    linear-gradient(135deg, #0d2148, #173f88);
  box-shadow: var(--shadow);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 40px;
  align-items: center;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: 12px;
  font-weight: 800;
  color: #a9c7ff;
}
.hero h1, .page-title {
  font-family: "Manrope", sans-serif;
  line-height: 1.08;
  margin: 10px 0 14px;
}
.hero h1 { font-size: clamp(34px, 5vw, 58px); max-width: 760px; }
.hero p { max-width: 720px; color: #d8e5ff; font-size: 17px; line-height: 1.7; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-orbit {
  min-height: 290px;
  display: grid;
  place-items: center;
  position: relative;
}
.orbit-core {
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  text-align: center;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 0 0 28px rgba(255,255,255,.04), 0 0 0 58px rgba(255,255,255,.025);
}
.orbit-label {
  position: absolute;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(5, 19, 45, .72);
  border: 1px solid rgba(255,255,255,.16);
  font-size: 12px;
}
.orbit-label.a { top: 22px; }
.orbit-label.b { right: 0; }
.orbit-label.c { bottom: 18px; }
.orbit-label.d { left: 0; }

.btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 17px;
  font-weight: 700;
  transition: .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(21,94,239,.22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.section {
  margin-top: 28px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 14px;
}
.section h2, .card h3 {
  font-family: "Manrope", sans-serif;
}
.section h2 { margin: 0; font-size: 24px; }
.section-sub { color: var(--muted); font-size: 14px; margin-top: 5px; }

.grid-4, .grid-3, .grid-2 {
  display: grid;
  gap: 16px;
}
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(21,35,59,.035);
}
.card-pad { padding: 22px; }
.metric-card { padding: 21px; }
.metric-card .label { color: var(--muted); font-size: 13px; }
.metric-card .value {
  margin-top: 8px;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: 28px;
}
.metric-card .hint { margin-top: 8px; font-size: 12px; color: var(--muted); }

.feature-card { padding: 22px; }
.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 14px;
}
.feature-card h3 { margin: 0 0 8px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.page-title { font-size: 34px; margin: 0 0 8px; }
.page-copy { color: var(--muted); line-height: 1.6; max-width: 790px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 18px;
}
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 700; }
.required { color: var(--danger); }
.input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: .2s;
}
.input:focus, textarea:focus, select:focus {
  border-color: #8eb3ff;
  box-shadow: 0 0 0 4px rgba(21,94,239,.08);
}
textarea { min-height: 110px; resize: vertical; }
.help { color: var(--muted); font-size: 12px; line-height: 1.45; }
.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.assessment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
}
.question-card { padding: 26px; }
.question-kicker {
  color: var(--primary);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.question-card h2 {
  font-family: "Manrope", sans-serif;
  margin: 10px 0;
  font-size: 27px;
  line-height: 1.28;
}
.question-why {
  border-left: 3px solid #9ab9ff;
  padding-left: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 15px 0 20px;
}
.choice-list { display: grid; gap: 10px; }
.choice {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  transition: .2s;
}
.choice:hover { border-color: #9db9f6; background: #fbfdff; }
.choice.selected { border-color: var(--primary); background: var(--primary-soft); }
.choice input { margin-top: 3px; }

.progress-card { padding: 20px; position: sticky; top: 96px; }
.progress-line {
  height: 9px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
}
.progress-line span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #155eef, #5d92ff);
  border-radius: inherit;
}
.progress-value {
  font-family: "Manrope", sans-serif;
  font-size: 28px;
  font-weight: 800;
  margin: 10px 0 2px;
}
.section-list { margin-top: 16px; display: grid; gap: 8px; }
.section-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  padding: 7px 0;
  border-bottom: 1px solid #edf1f6;
}
.section-item.current { color: var(--primary); font-weight: 700; }
.section-item.done { color: var(--success); }

.callout {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.callout.info { background: var(--primary-soft); color: #244a90; }
.callout.warning { background: var(--warning-soft); color: #805000; }
.callout.danger { background: var(--danger-soft); color: #842e28; }
.callout.success { background: var(--success-soft); color: #116348; }

.cost-table, .score-table, .alternatives-table {
  width: 100%;
  border-collapse: collapse;
}
.cost-table th, .cost-table td,
.score-table th, .score-table td,
.alternatives-table th, .alternatives-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}
.cost-table th, .score-table th, .alternatives-table th {
  color: var(--muted);
  font-weight: 700;
  background: #fbfcfe;
}
.numeric { text-align: right !important; font-variant-numeric: tabular-nums; }

.result-hero {
  border-radius: 24px;
  padding: 30px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.result-hero.go { background: linear-gradient(135deg, #075e48, #0a8f69); }
.result-hero.pilot { background: linear-gradient(135deg, #9a4b08, #d37b13); }
.result-hero.no-go { background: linear-gradient(135deg, #8a271f, #c43d31); }
.result-label {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  font-weight: 800;
  opacity: .82;
}
.result-title {
  font-family: "Manrope", sans-serif;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 800;
  margin: 8px 0;
}
.result-copy { max-width: 820px; font-size: 16px; line-height: 1.65; opacity: .94; }
.result-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.result-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.19);
  font-size: 12px;
  font-weight: 700;
}

.score-bar {
  display: grid;
  grid-template-columns: 180px 1fr 42px;
  align-items: center;
  gap: 12px;
  margin: 11px 0;
}
.score-bar-label { font-size: 13px; }
.score-track { height: 9px; border-radius: 99px; background: #e9eef5; overflow: hidden; }
.score-track span { display: block; height: 100%; background: linear-gradient(90deg, #155eef, #6b9cff); border-radius: inherit; }
.score-number { font-size: 13px; font-weight: 800; text-align: right; }

.reason-list { padding-left: 20px; margin: 0; }
.reason-list li { margin: 9px 0; line-height: 1.5; }

.chat-box {
  min-height: 260px;
  max-height: 420px;
  overflow-y: auto;
  padding: 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.chat-message {
  max-width: 82%;
  border-radius: 14px;
  padding: 11px 13px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.55;
}
.chat-message.user { margin-left: auto; background: var(--primary); color: #fff; }
.chat-message.agent { background: #fff; border: 1px solid var(--line); }
.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px;
}

.empty {
  text-align: center;
  padding: 60px 25px;
}
.empty h2 { font-family: "Manrope", sans-serif; }
.empty p { color: var(--muted); max-width: 560px; margin: 0 auto 20px; }

.small { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }

.mobile-menu { display: none; }

@media (max-width: 1040px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .assessment-layout { grid-template-columns: 1fr; }
  .progress-card { position: static; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-orbit { min-height: 220px; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    transform: translateX(-100%);
    transition: .22s;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { width: min(100% - 28px, 1180px); padding-top: 24px; }
  .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .page-head { flex-direction: column; }
  .hero { padding: 26px 22px; }
  .hero-orbit { display: none; }
  .question-card { padding: 20px; }
  .score-bar { grid-template-columns: 120px 1fr 34px; }
  .topbar-meta .status-pill { display: none; }
}

@media print {
  .sidebar, .topbar, .form-actions, .chat-section, .no-print { display: none !important; }
  .app-shell { display: block; }
  .content { width: 100%; padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}


/* Decision history */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.decision-history-table {
  min-width: 1050px;
}
.decision-history-table td,
.decision-history-table th {
  white-space: normal;
}
.mb-16 { margin-bottom: 16px; }
