:root {
  --navy: #172446;
  --navy-deep: #101a34;
  --brand: #39388d;
  --brand-2: #4f55c7;
  --brand-soft: #eeeffb;
  --blue-soft: #eaf3ff;
  --cyan: #13a8b8;
  --cyan-soft: #e6f8fa;
  --ink: #17213a;
  --muted: #657089;
  --line: #dfe3ed;
  --line-strong: #cfd5e2;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --green: #16865e;
  --green-soft: #e9f7f1;
  --amber: #b56b0b;
  --amber-soft: #fff4de;
  --red: #c3454e;
  --red-soft: #fff0f1;
  --shadow: 0 12px 30px rgba(31, 45, 84, 0.08);
  --shadow-strong: 0 24px 55px rgba(17, 31, 67, 0.18);
  --radius: 18px;
  --sidebar: 254px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% -8%, rgba(79, 85, 199, 0.08), transparent 30rem),
    var(--canvas);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(57, 56, 141, 0.25);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 26px 18px 20px;
  color: #fff;
  background:
    linear-gradient(165deg, rgba(79, 85, 199, 0.22), transparent 38%),
    var(--navy-deep);
  box-shadow: 12px 0 32px rgba(12, 24, 54, 0.08);
}

.brand-block {
  padding: 3px 10px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-block img {
  display: block;
  width: 158px;
  max-height: 48px;
  object-fit: contain;
  object-position: left center;
  filter: brightness(0) invert(1);
}

.product-name {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav {
  display: grid;
  gap: 7px;
  margin-top: 27px;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  font-size: 0.91rem;
  font-weight: 650;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(93, 98, 215, 0.9), rgba(57, 56, 141, 0.94));
  box-shadow: 0 12px 24px rgba(23, 28, 91, 0.28);
}

.nav-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1rem;
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.18);
}

.sidebar-spacer {
  flex: 1;
}

.demo-status {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 18px 7px 0;
  padding: 13px 11px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.demo-status div {
  display: grid;
  gap: 3px;
}

.demo-status strong {
  font-size: 0.78rem;
}

.demo-status span:not(.status-dot) {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.75rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #54dab0;
  box-shadow: 0 0 0 5px rgba(84, 218, 176, 0.12);
}

.sidebar-footer {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-align: center;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 17px 32px;
  border-bottom: 1px solid rgba(207, 213, 226, 0.86);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.title-block {
  min-width: 0;
}

.eyebrow,
.panel-kicker {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.panel-kicker.light {
  color: rgba(255, 255, 255, 0.7);
}

.topbar h1 {
  margin: 6px 0 0;
  color: var(--navy);
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.05;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 17px;
}

.data-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid #d9ddf3;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.data-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-2);
}

.apu-select-label {
  display: grid;
  gap: 5px;
}

.apu-select-label > span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.apu-select-label select {
  width: min(355px, 34vw);
  padding: 9px 35px 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 650;
}

.mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--navy);
  background: #fff;
}

.view {
  display: none;
  padding: 28px 32px 46px;
  animation: enter 240ms ease;
}

.view.active {
  display: block;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.overview-stack {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h3,
.formula-card h3 {
  margin: 6px 0 0;
  color: var(--navy);
  font-size: 1.08rem;
  line-height: 1.35;
}

.context-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.78);
}

.context-main > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-code {
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.status-pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.72rem;
  font-weight: 750;
}

.status-pill.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.context-main h2 {
  margin: 8px 0 4px;
  color: var(--navy);
  font-size: clamp(1.05rem, 1.7vw, 1.38rem);
}

.context-main p,
.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.context-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.context-actions > div {
  display: grid;
  gap: 4px;
  min-width: 140px;
}

.context-actions span {
  color: var(--muted);
  font-size: 0.76rem;
}

.context-actions strong {
  color: var(--navy);
  font-size: 1rem;
}

.primary-button,
.secondary-button,
.tiny-button,
.text-button {
  border: 0;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 11px 19px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 20px rgba(57, 56, 141, 0.21);
  font-weight: 750;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(57, 56, 141, 0.27);
}

.primary-button.compact {
  min-height: 40px;
  padding: 9px 15px;
  font-size: 0.86rem;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.secondary-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--navy);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 700;
}

.secondary-button:hover:not(:disabled) {
  background: #f7f8fc;
}

.text-button {
  padding: 4px 0;
  color: var(--brand);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 800;
}

.tiny-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--brand);
  background: #fff;
  font-size: 0.76rem;
  font-weight: 750;
}

.decision-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 28px;
  overflow: hidden;
  padding: 30px;
  border-radius: 21px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 15%, rgba(99, 211, 220, 0.24), transparent 18rem),
    linear-gradient(125deg, #192954 0%, #35357f 55%, #4c51ba 100%);
  box-shadow: var(--shadow-strong);
}

.decision-hero::after {
  position: absolute;
  right: 30%;
  bottom: -120px;
  width: 290px;
  height: 290px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  content: "";
}

.hero-copy,
.exposure-card {
  position: relative;
  z-index: 1;
}

.hero-copy h3 {
  max-width: 760px;
  margin: 10px 0 7px;
  font-size: clamp(1.45rem, 2.6vw, 2.4rem);
  line-height: 1.12;
}

.hero-copy > p {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.94rem;
  line-height: 1.55;
}

.hero-price-flow {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-top: 27px;
}

.hero-price-flow > div:not(.hero-delta) {
  display: grid;
  gap: 4px;
}

.hero-price-flow span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.75rem;
}

.hero-price-flow strong {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.hero-price-flow > b {
  color: rgba(255, 255, 255, 0.42);
  font-size: 1.4rem;
}

.hero-projected strong {
  color: #7fe5e8;
}

.hero-delta {
  display: grid;
  gap: 3px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.hero-delta span {
  color: #ffcd79;
  font-size: 0.92rem;
  font-weight: 850;
}

.hero-delta small {
  color: rgba(255, 255, 255, 0.67);
  font-size: 0.72rem;
}

.exposure-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 190px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 16px;
  background: rgba(8, 18, 49, 0.38);
  backdrop-filter: blur(8px);
}

.exposure-card > span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.exposure-card > strong {
  margin: 8px 0 3px;
  color: #ffcf78;
  font-size: clamp(2rem, 3.4vw, 3.25rem);
  line-height: 1;
}

.exposure-card > p {
  margin: 5px 0 18px;
  color: rgba(255, 255, 255, 0.67);
  font-size: 0.78rem;
  line-height: 1.45;
}

.confidence-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
}

.confidence-row span {
  color: rgba(255, 255, 255, 0.58);
}

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

.price-kpi {
  position: relative;
  overflow: hidden;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(31, 45, 84, 0.055);
}

.price-kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #aab3c5;
  content: "";
}

.price-kpi.projected::before { background: var(--brand-2); }
.price-kpi.recognized::before { background: var(--cyan); }
.price-kpi.gap::before { background: var(--amber); }

.price-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.price-kpi strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
}

.price-kpi small {
  display: block;
  margin-top: 5px;
  color: #7a8499;
  font-size: 0.73rem;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
}

.bridge-panel,
.productivity-panel,
.apu-panel,
.decision-panel {
  padding: 21px;
}

.live-badge,
.model-chip,
.source-count {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.driver-bridge {
  display: grid;
  gap: 13px;
  margin-top: 20px;
}

.bridge-row {
  display: grid;
  grid-template-columns: 155px minmax(90px, 1fr) 92px;
  align-items: center;
  gap: 12px;
}

.bridge-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 7px;
}

.bridge-row strong {
  font-size: 0.79rem;
}

.bridge-row small {
  color: var(--muted);
  font-size: 0.7rem;
}

.bridge-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f6;
}

.bridge-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.bridge-track span.negative {
  margin-left: auto;
  background: linear-gradient(90deg, var(--cyan), #58ccd5);
}

.bridge-row > b {
  font-size: 0.78rem;
  text-align: right;
}

.risk-text { color: var(--red) !important; }
.good-text { color: var(--green) !important; }
.muted-text { color: var(--muted) !important; }

.productivity-index {
  display: grid;
  width: 47px;
  height: 47px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-size: 1rem;
  font-weight: 850;
}

.productivity-index.risk {
  color: var(--red);
  background: var(--red-soft);
}

.output-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.output-comparison div {
  display: grid;
  gap: 6px;
  padding: 13px;
  border-radius: 11px;
  background: #f7f8fb;
}

.output-comparison span,
.duration-line span {
  color: var(--muted);
  font-size: 0.71rem;
}

.output-comparison strong {
  color: var(--navy);
  font-size: 0.9rem;
}

.output-comparison > b {
  color: #a1a9ba;
}

.duration-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  margin-top: 15px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.duration-line strong {
  color: var(--navy);
  font-size: 0.86rem;
}

.duration-line small {
  grid-column: 2;
  color: var(--red);
  font-size: 0.72rem;
  text-align: right;
}

.productivity-note {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  color: var(--muted);
}

.productivity-note > span {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.72rem;
  font-weight: 850;
}

.productivity-note p {
  margin: 1px 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
}

.lower-grid {
  grid-template-columns: minmax(0, 1.42fr) minmax(290px, 0.58fr);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table,
.history-table {
  width: 100%;
  margin-top: 17px;
  border-collapse: collapse;
  font-size: 0.79rem;
}

.data-table th,
.data-table td,
.history-table th,
.history-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child,
.history-table th:first-child,
.history-table td:first-child {
  text-align: left;
}

.data-table th,
.history-table th {
  color: var(--muted);
  background: #f7f8fb;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.data-table .subtotal td {
  border-top: 2px solid var(--line-strong);
  color: var(--navy);
  font-weight: 750;
}

.data-table .total-row td {
  border-bottom: 0;
  color: #fff;
  background: var(--navy);
  font-weight: 850;
}

.data-table .total-row td:first-child { border-radius: 8px 0 0 8px; }
.data-table .total-row td:last-child { border-radius: 0 8px 8px 0; }

.resource-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.resource-details summary {
  padding: 14px 2px 4px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.resource-table td:first-child {
  min-width: 190px;
}

.resource-table td:first-child strong,
.resource-table td:first-child small {
  display: block;
}

.resource-table td:first-child small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.decision-list {
  display: grid;
  gap: 11px;
  margin-top: 17px;
}

.decision-item {
  display: grid;
  grid-template-columns: 7px 1fr;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafbfc;
}

.decision-item > span {
  width: 7px;
  height: 100%;
  min-height: 38px;
  border-radius: 999px;
  background: var(--green);
}

.decision-item.medium > span { background: var(--amber); }
.decision-item.high > span { background: var(--red); }

.decision-item strong {
  color: var(--navy);
  font-size: 0.8rem;
}

.decision-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.evidence-health {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.evidence-health > div {
  display: grid;
  gap: 5px;
}

.evidence-health span {
  color: var(--muted);
  font-size: 0.7rem;
}

.evidence-health strong {
  color: var(--navy);
  font-size: 1.1rem;
}

.evidence-health .text-button {
  grid-column: 1 / -1;
  justify-self: start;
}

.trace-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.trace-strip > div {
  display: grid;
  gap: 5px;
  padding: 13px 15px;
  background: #fff;
}

.trace-strip span {
  color: var(--muted);
  font-size: 0.68rem;
}

.trace-strip strong {
  color: var(--navy);
  font-size: 0.75rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 21px;
}

.section-header h2 {
  margin: 6px 0 7px;
  color: var(--navy);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
}

.preset {
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 750;
}

.preset.active,
.preset:hover {
  color: var(--brand);
  border-color: #c5c6ef;
  background: var(--brand-soft);
}

.simulator-layout {
  display: grid;
  grid-template-columns: minmax(325px, 0.67fr) minmax(0, 1.33fr);
  align-items: start;
  gap: 18px;
}

.simulator-controls {
  position: sticky;
  top: 111px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--navy);
  font-size: 0.77rem;
  font-weight: 750;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-size: 0.84rem;
}

.field input:focus,
.field select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(79, 85, 199, 0.09);
}

.full-field {
  margin-top: 18px;
}

.control-section {
  margin-top: 21px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.control-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.control-section-title span {
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 850;
}

.control-section-title small {
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
}

.range-list {
  display: grid;
  gap: 15px;
}

.range-control {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(90px, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.range-control label {
  display: grid;
  gap: 2px;
}

.range-control label span {
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 750;
}

.range-control label small {
  color: var(--muted);
  font-size: 0.66rem;
}

.range-control input {
  --range-position: 30%;
  width: 100%;
  height: 5px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-2) var(--range-position), #dfe3ec var(--range-position));
}

.range-control input::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--brand-2);
  box-shadow: 0 0 0 1px var(--brand-2), 0 3px 8px rgba(42, 44, 116, 0.24);
}

.range-control input::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--brand-2);
  box-shadow: 0 0 0 1px var(--brand-2);
}

.range-control output {
  padding: 5px 5px;
  border-radius: 7px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.range-control output.negative {
  color: var(--red);
  background: var(--red-soft);
}

.range-control output.positive {
  color: var(--green);
  background: var(--green-soft);
}

.range-control.productivity output.negative {
  color: var(--red);
}

.run-button {
  width: 100%;
  flex-direction: column;
  margin-top: 21px;
}

.run-button small {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.72;
}

.simulator-results {
  display: grid;
  gap: 16px;
  min-width: 0;
  transition: opacity 130ms ease;
}

.simulator-results.is-calculating {
  opacity: 0.58;
}

.live-result-card {
  overflow: hidden;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(130deg, var(--navy) 0%, #303477 62%, #4c52bb 100%);
  box-shadow: var(--shadow-strong);
}

.live-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding: 20px 22px 10px;
}

.live-result-header .live-badge,
.model-chip {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

.live-result-header h3 {
  margin: 8px 0 0;
  font-size: 1.1rem;
}

.live-prices {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 19px 22px 22px;
}

.live-prices > div {
  display: grid;
  gap: 4px;
}

.live-prices span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.69rem;
}

.live-prices strong {
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
}

.live-prices small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.65rem;
}

.live-prices > b {
  color: rgba(255, 255, 255, 0.35);
}

.live-economic strong,
.live-economic small {
  color: #79e3e6;
}

.live-exposure {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(8, 15, 43, 0.24);
}

.live-exposure div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.live-exposure span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
}

.live-exposure strong {
  color: #ffcd79;
  font-size: 1.45rem;
}

.live-exposure p {
  max-width: 370px;
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.7rem;
  text-align: right;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}

.mini-grid article {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.mini-grid span,
.mini-grid small {
  color: var(--muted);
  font-size: 0.67rem;
}

.mini-grid strong {
  color: var(--navy);
  font-size: 1.18rem;
}

.compact-panel {
  padding: 19px 20px;
}

.risk-band {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.risk-point {
  display: grid;
  grid-template-columns: 38px minmax(90px, 1fr) 100px 120px;
  align-items: center;
  gap: 11px;
}

.risk-point > span {
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 850;
}

.risk-point > div {
  height: 10px;
  border-radius: 999px;
  background: #edf0f6;
}

.risk-point i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
}

.risk-point.p2 i { background: var(--amber); }
.risk-point.p3 i { background: var(--red); }

.risk-point strong {
  color: var(--navy);
  font-size: 0.8rem;
  text-align: right;
}

.risk-point small {
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--line);
}

.impact-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: #fff;
}

.impact-grid span {
  color: var(--ink);
  font-size: 0.74rem;
}

.impact-grid small {
  color: var(--muted);
  font-size: 0.66rem;
}

.impact-grid strong {
  font-size: 0.76rem;
}

.empty-preview,
.empty-table {
  display: grid;
  min-height: 230px;
  place-items: center;
  align-content: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-preview h3,
.empty-table strong {
  margin: 8px 0 4px;
  color: var(--navy);
}

.empty-preview p,
.empty-table p {
  max-width: 370px;
  margin: 0;
  font-size: 0.82rem;
}

.preview-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 1.2rem;
}

.wizard-shell {
  max-width: 1010px;
  margin: 0 auto;
}

.wizard-progress {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  color: var(--muted);
}

.wizard-step > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 850;
}

.wizard-step div {
  display: grid;
  gap: 2px;
}

.wizard-step strong {
  font-size: 0.78rem;
}

.wizard-step small {
  font-size: 0.66rem;
}

.wizard-step.active > span,
.wizard-step.complete > span {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.wizard-step.active strong,
.wizard-step.complete strong {
  color: var(--navy);
}

.wizard-line {
  height: 1px;
  flex: 1;
  margin: 0 15px;
  background: var(--line-strong);
}

.wizard-form {
  padding: 25px;
}

.wizard-page {
  display: none;
  min-height: 330px;
}

.wizard-page.active {
  display: block;
  animation: enter 180ms ease;
}

.form-section-title {
  display: flex;
  gap: 13px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.form-section-title > span {
  color: var(--brand-2);
  font-size: 1.25rem;
  font-weight: 850;
}

.form-section-title h3 {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 1.05rem;
}

.form-section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  margin-top: 21px;
}

.span-2 {
  grid-column: span 2;
}

.compact-grid {
  max-width: 720px;
}

.template-note,
.contract-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 13px 15px;
  border: 1px solid #d7daf2;
  border-radius: 11px;
  background: var(--brand-soft);
}

.template-note {
  display: grid;
  grid-template-columns: auto 1fr;
}

.template-note > span {
  grid-row: 1 / span 2;
  padding: 6px 8px;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
  font-size: 0.65rem;
  font-weight: 850;
}

.template-note strong,
.contract-preview strong {
  color: var(--navy);
  font-size: 0.82rem;
}

.template-note p,
.contract-preview p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.contract-symbol {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--brand);
  font-size: 1.15rem;
}

.confirmation {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 17px;
  color: var(--muted);
  font-size: 0.78rem;
}

.confirmation input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}

.wizard-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.wizard-actions > span {
  color: var(--muted);
  font-size: 0.75rem;
}

.wizard-actions button:first-child {
  justify-self: start;
}

.wizard-actions button:last-child,
.wizard-actions #wizard-next {
  justify-self: end;
}

.history-table {
  margin: 0;
}

.history-table td {
  padding-top: 14px;
  padding-bottom: 14px;
}

.history-table td:first-child strong,
.history-table td:first-child small {
  display: block;
}

.history-table td:first-child small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.model-version {
  padding: 8px 11px;
  border: 1px solid #d4d6ef;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.72rem;
  font-weight: 850;
}

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

.formula-card {
  padding: 23px;
}

.formula-card.wide {
  grid-column: 1 / -1;
}

.formula-flow {
  display: grid;
  grid-template-columns: repeat(7, auto);
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  margin-top: 22px;
}

.formula-flow > div {
  display: grid;
  min-width: 150px;
  gap: 5px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f9fc;
}

.formula-flow > div > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.7rem;
  font-weight: 850;
}

.formula-flow strong {
  color: var(--navy);
  font-size: 0.8rem;
}

.formula-flow small {
  color: var(--muted);
  font-size: 0.68rem;
}

.formula-flow > b {
  color: #9da5b7;
}

.formula-flow .formula-result {
  color: #fff;
  border-color: var(--brand);
  background: linear-gradient(125deg, var(--brand), var(--brand-2));
}

.formula-flow .formula-result span {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.formula-flow .formula-result strong {
  color: #fff;
}

.formula-flow .formula-result small {
  color: rgba(255, 255, 255, 0.68);
}

.fraction {
  display: grid;
  max-width: 330px;
  gap: 7px;
  margin: 22px 0 16px;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 750;
  text-align: center;
}

.fraction i {
  height: 2px;
  background: var(--brand);
}

.formula-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.clean-list {
  display: grid;
  gap: 12px;
  margin: 21px 0 0;
  padding: 0;
  list-style: none;
}

.clean-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.82rem;
}

.clean-list li span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-2);
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 19px;
}

.evidence-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}

.evidence-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.evidence-type,
.evidence-status {
  color: var(--brand);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.evidence-status {
  padding: 4px 6px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
}

.evidence-status.review {
  color: var(--amber);
  background: var(--amber-soft);
}

.evidence-card > strong {
  display: block;
  margin-top: 12px;
  color: var(--navy);
  font-size: 0.8rem;
  line-height: 1.35;
}

.evidence-card > p {
  margin: 5px 0 11px;
  color: var(--muted);
  font-size: 0.7rem;
}

.evidence-card dl {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.evidence-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 9px;
}

.evidence-card dt,
.evidence-card dd {
  margin: 0;
  font-size: 0.65rem;
}

.evidence-card dt { color: var(--muted); }
.evidence-card dd { color: var(--ink); font-weight: 700; text-align: right; }

.loading-inline {
  min-height: 120px;
  place-items: center;
  color: var(--muted);
}

.disclaimer-box {
  display: flex;
  align-items: baseline;
  gap: 15px;
  margin-top: 18px;
  padding: 15px 18px;
  border: 1px solid #ead8b7;
  border-radius: 12px;
  color: #79521f;
  background: #fff9ed;
}

.disclaimer-box strong {
  flex: 0 0 auto;
  font-size: 0.78rem;
}

.disclaimer-box p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.5;
}

.global-alert {
  margin: 17px 32px 0;
  padding: 12px 14px;
  border: 1px solid #f1c8cc;
  border-radius: 10px;
  color: #99313a;
  background: var(--red-soft);
  font-size: 0.82rem;
}

.loading-state {
  display: grid;
  min-height: 460px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid #d9dced;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: 380px;
  padding: 12px 15px;
  border: 1px solid #cbe5db;
  border-radius: 10px;
  color: #126346;
  background: #f0fbf6;
  box-shadow: var(--shadow-strong);
  font-size: 0.82rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.error {
  color: #94323b;
  border-color: #efc7ca;
  background: var(--red-soft);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1220px) {
  .decision-hero { grid-template-columns: 1.25fr 0.75fr; }
  .price-grid { grid-template-columns: repeat(2, 1fr); }
  .main-grid,
  .lower-grid { grid-template-columns: 1fr; }
  .evidence-grid { grid-template-columns: repeat(2, 1fr); }
  .formula-flow { grid-template-columns: 1fr auto 1fr; }
  .formula-flow > div { min-width: 0; }
  .formula-flow > b:nth-of-type(3),
  .formula-flow > div:nth-of-type(4) { margin-top: 8px; }
}

@media (max-width: 980px) {
  :root { --sidebar: 228px; }
  .topbar { padding-inline: 22px; }
  .view { padding-inline: 22px; }
  .data-badge { display: none; }
  .decision-hero { grid-template-columns: 1fr; }
  .exposure-card { min-height: auto; }
  .simulator-layout { grid-template-columns: 1fr; }
  .simulator-controls { position: static; }
  .mini-grid { grid-template-columns: repeat(2, 1fr); }
  .trace-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .sidebar {
    width: min(286px, 86vw);
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-menu { display: block; }
  .topbar { min-height: 82px; gap: 12px; }
  .topbar-actions { margin-left: auto; }
  .apu-select-label > span { display: none; }
  .apu-select-label select { width: min(300px, 43vw); }
  .view { padding: 21px 15px 38px; }
  .global-alert { margin-inline: 15px; }
  .context-strip,
  .section-header { align-items: flex-start; flex-direction: column; }
  .context-actions { width: 100%; justify-content: space-between; }
  .hero-price-flow { flex-wrap: wrap; }
  .price-grid { grid-template-columns: 1fr 1fr; }
  .live-prices { grid-template-columns: 1fr; }
  .live-prices > b { transform: rotate(90deg); justify-self: start; }
  .live-exposure { align-items: flex-start; flex-direction: column; }
  .live-exposure p { text-align: left; }
  .risk-point { grid-template-columns: 36px 1fr 95px; }
  .risk-point small { display: none; }
  .impact-grid { grid-template-columns: 1fr; }
  .trace-layout { grid-template-columns: 1fr; }
  .formula-card.wide { grid-column: auto; }
  .formula-flow { grid-template-columns: 1fr; }
  .formula-flow > b { transform: rotate(90deg); justify-self: center; }
  .wizard-progress { align-items: flex-start; }
  .wizard-step { min-width: 34px; }
  .wizard-step div { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .evidence-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar { padding: 12px 13px; }
  .eyebrow { font-size: 0.61rem; }
  .topbar h1 { font-size: 1.25rem; }
  .apu-select-label select { width: 155px; font-size: 0.74rem; }
  .decision-hero { padding: 23px 19px; }
  .hero-price-flow { align-items: flex-start; flex-direction: column; }
  .hero-price-flow > b { transform: rotate(90deg); }
  .price-grid,
  .mini-grid,
  .trace-strip { grid-template-columns: 1fr; }
  .bridge-row { grid-template-columns: 1fr 70px; }
  .bridge-row .bridge-track { grid-column: 1 / -1; grid-row: 2; }
  .output-comparison { grid-template-columns: 1fr; }
  .output-comparison > b { transform: rotate(90deg); justify-self: center; }
  .range-control { grid-template-columns: 1fr 47px; }
  .range-control input { grid-column: 1 / -1; grid-row: 2; }
  .wizard-form { padding: 19px 15px; }
  .wizard-actions { grid-template-columns: 1fr 1fr; }
  .wizard-actions > span { display: none; }
  .disclaimer-box { align-items: flex-start; flex-direction: column; }
}
