.modeler {
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
  padding: 0 !important;
}

.model-shell {
  width: min(100%, 560px);
  min-height: 0;
  height: 100dvh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px 0;
  overflow: hidden;
  border-radius: 0 !important;
  background:
    linear-gradient(rgba(73, 63, 63, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 63, 63, .04) 1px, transparent 1px),
    var(--paper);
  background-size: 38px 38px;
  box-shadow: none !important;
}

.model-head {
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.model-close { min-height: 44px; }

.model-progress {
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 17px;
}

.model-progress span {
  height: 4px;
  border-radius: 999px;
}

.simulation-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.sim-layout {
  display: grid;
  gap: 22px;
  padding: clamp(28px, 6svh, 50px) 0 26px;
}

.sim-copy { position: static; }

.sim-step,
.proposal-label {
  margin: 0;
  color: var(--brand);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.sim-copy h2,
.sim-result-head h2 {
  margin: 11px 0 0;
  font: 500 clamp(35px, 9.5vw, 48px)/.97 Georgia, serif;
  letter-spacing: -.044em;
  text-wrap: balance;
}

.sim-copy > p:last-child,
.sim-result-head > p {
  margin: 15px 0 0;
  color: #554f47;
  font-size: 16px;
  line-height: 1.42;
}

.sim-panel {
  padding: 17px;
  border: 1px solid rgba(73, 63, 63, .22);
  border-radius: 23px 19px 25px 21px;
  background: rgba(255, 253, 250, .94);
  box-shadow: none;
}

.sim-section + .sim-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.sim-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.sim-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.sim-field > span,
.sim-range-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.sim-input-wrap { position: relative; }

.sim-input-wrap input {
  width: 100%;
  min-height: 64px;
  padding: 0 68px 0 15px;
  border: 1px solid rgba(73, 63, 63, .22);
  border-radius: 15px 12px 17px 13px;
  outline: 0;
  background: var(--bright);
  color: var(--ink);
  font: 500 26px/1 Georgia, serif;
}

.sim-input-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(147, 71, 100, .1);
}

.sim-input-wrap em {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.input-note,
.adjust-help {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.sim-priorities {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.sim-choice,
.sim-preset,
.scenario-tab,
.adjust-toggle {
  appearance: none;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid rgba(73, 63, 63, .2);
  border-radius: 15px 12px 17px 13px;
  background: var(--bright);
  color: var(--ink);
  font: 750 14px/1.25 Inter, sans-serif;
  text-align: left;
  cursor: pointer;
}

.sim-choice:nth-child(even) { border-radius: 12px 17px 13px 16px; }

.sim-choice.selected,
.sim-preset.selected,
.scenario-tab.selected {
  border-color: var(--brand);
  background: rgba(147, 71, 100, .08);
  color: var(--brand);
}

.proposal-label { margin-bottom: 13px; }

.assumption-grid {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px 14px 20px 16px;
  background: var(--bright);
}

.assumption-card {
  min-height: 68px;
  padding: 14px 15px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-areas: "label value";
  align-items: center;
  gap: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.assumption-card + .assumption-card { border-top: 1px solid var(--line); }

.assumption-card strong {
  grid-area: value;
  font: 500 25px/1 Georgia, serif;
  letter-spacing: -.03em;
  text-align: right;
}

.assumption-card span {
  grid-area: label;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
}

.assumption-card:first-child span { color: var(--muted); }

.adjust-toggle {
  width: 100%;
  min-height: 46px;
  margin-top: 15px;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--brand);
  text-align: center;
  font-size: 13px;
}

.adjust-panel {
  margin-top: 5px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.adjust-panel .sim-fields { gap: 12px; }

.sim-range-list {
  display: grid;
  gap: 15px;
  margin-top: 16px;
}

.sim-range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sim-range-head output {
  color: var(--ink);
  font: 500 19px Georgia, serif;
}

.sim-range input[type="range"] {
  width: 100%;
  height: 36px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.allocation-bar,
.value-route {
  display: flex;
  height: 30px;
  overflow: hidden;
  border: 1px solid rgba(73, 63, 63, .16);
  border-radius: 14px 10px 15px 12px;
  background: rgba(73, 63, 63, .06);
}

.allocation-bar i,
.value-route i { display: block; flex: 0 0 auto; min-width: 0; transition: width .25s ease; }
.allocation-bar .human { background: #c98567; }
.allocation-bar .human-ai { background: #82a5a1; }
.allocation-bar .agent { background: #9a86a8; }
.allocation-bar .workflow { background: #b9b3aa; }

.allocation-key,
.value-route-key {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.allocation-key b,
.value-route-key b {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  text-align: right;
}
.allocation-key em,
.value-route-key em { color: var(--muted); font-style: normal; }

.allocation-key span,
.value-route-key span { position: relative; min-height: 37px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; padding: 7px 0 7px 17px; border-top: 1px solid var(--line); }
.allocation-key span:before,
.value-route-key span:before {
  position: absolute;
  left: 0;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 3px 2px 4px 2px;
  background: var(--mode-colour);
  content: "";
}
.allocation-key .human { --mode-colour: #c98567; }
.allocation-key .human-ai { --mode-colour: #82a5a1; }
.allocation-key .agent { --mode-colour: #9a86a8; }
.allocation-key .workflow { --mode-colour: #b9b3aa; }
.value-route-key span:nth-child(1){--mode-colour:var(--green)}
.value-route-key span:nth-child(2){--mode-colour:var(--blue)}
.value-route-key span:nth-child(3){--mode-colour:var(--amber)}
.value-route-key span:nth-child(4){--mode-colour:var(--violet)}

.blueprint-proposal {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 17px;
  border-radius: 17px 13px 19px 15px;
  background: var(--ink);
  color: white;
}

.blueprint-number { font: 500 45px/.9 Georgia, serif; }
.blueprint-proposal strong { font-size: 15px; }
.blueprint-proposal p { margin: 5px 0 0; color: rgba(255,255,255,.62); font-size: 12px; line-height: 1.35; }

.route-summary {
  margin-top: 10px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 17px 13px 19px 15px;
  background: var(--bright);
}

.route-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 13px;
}

.route-summary-head strong { font-size: 14px; }
.route-summary-head span { color: var(--muted); font-size: 12px; }
.value-route { height: 25px; }
.value-route .growth { background: var(--brand); }
.value-route .hiring { background: var(--blue); }
.value-route .cost { background: var(--amber); }
.value-route .resilience { background: var(--violet); }
.value-route-key { font-size: 12px; gap: 0; }
.value-route-key b { min-width: 0; font-size: 14px; }

.sim-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 16px;
}

.sim-preset { min-height: 46px; padding: 8px; text-align: center; font-size: 12px; }

.sim-actions {
  position: fixed;
  z-index: 8;
  bottom: -1px;
  left: 50%;
  width: min(calc(100% - 36px), 524px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(92px, .7fr) minmax(0, 1.5fr);
  gap: 9px;
  margin-top: auto;
  padding: 13px 0 calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(247, 244, 237, .97);
  backdrop-filter: blur(12px);
}

.sim-actions .model-button {
  width: 100%;
  min-height: 54px;
  padding: 8px 11px;
  line-height: 1.2;
}

.sim-result { padding: 30px 0 26px; }
.sim-result-head { display: block; }

.scenario-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 24px;
}

.scenario-tab {
  min-height: 45px;
  padding: 7px 5px;
  text-align: center;
  font-size: 11px;
}

.result-hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(73, 63, 63, .2);
  border-radius: 18px 14px 20px 16px;
  background: var(--bright);
}

.result-hero-card {
  min-height: 74px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-areas: "label value" "note note";
  align-items: center;
  gap: 14px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.result-hero-card.primary {
  grid-column: auto;
  min-height: 136px;
  display: block;
  border-top: 0;
  border-color: var(--brand);
  background: var(--ink);
  color: white;
}
.result-hero-card:not(.primary) small { grid-area: label; }
.result-hero-card:not(.primary) strong { grid-area: value; }
.result-hero-card:not(.primary) span { grid-area: note; margin-top: 5px; }

.result-hero-card small,
.scenario-chart-head,
.compound-result small,
.value-card small,
.truth-ledger small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.result-hero-card.primary small,
.compound-result small { color: var(--brand-soft); }

.result-hero-card strong {
  display: block;
  margin: 0;
  font: 500 clamp(24px, 7vw, 34px)/.95 Georgia, serif;
  letter-spacing: -.04em;
}

.result-hero-card span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.result-hero-card.primary span { color: rgba(255,255,255,.62); }
.result-hero-card.primary strong { margin-top: 17px; }
.result-hero-card.primary span { margin-top: 8px; }

.scenario-chart,
.compound-result {
  margin-top: 10px;
  padding: 16px;
  border: 1px solid rgba(73, 63, 63, .2);
  border-radius: 19px 15px 21px 17px;
  background: rgba(255,253,250,.93);
}

.scenario-chart svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 10px;
  overflow: visible;
}

.sim-chart-grid { stroke: rgba(73,63,63,.11); stroke-width: 1; }
.sim-chart-axis { fill: var(--muted); font: 700 9px Inter, sans-serif; }
.trajectory-legend {
  display: flex;
  gap: 16px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}
.trajectory-legend span { display: inline-flex; align-items: center; gap: 6px; }
.trajectory-legend span:before { width: 18px; height: 2px; background: var(--line-strong); content: ""; }
.trajectory-legend .current-plan:before { background: repeating-linear-gradient(90deg, var(--muted) 0 5px, transparent 5px 9px); }
.trajectory-legend .uniio-plan:before { height: 3px; background: var(--brand); }
.trajectory-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trajectory-line.current-plan { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 6; opacity: .7; }
.trajectory-line.uniio-plan { stroke: var(--brand); stroke-width: 4; }
.trajectory-point { fill: var(--brand); stroke: var(--bright); stroke-width: 2; }
.sim-chart-unit { fill: var(--muted); font: 760 8px Inter, sans-serif; letter-spacing: .04em; }

.compound-result { background: var(--ink); color: white; }
.compound-result strong { display: block; margin-top: 12px; font: 500 42px/.95 Georgia, serif; }
.compound-result p { margin: 7px 0 0; color: rgba(255,255,255,.65); font-size: 13px; line-height: 1.4; }

.compound-track { position: relative; height: 42px; margin-top: 11px; }
.compound-track:before { position: absolute; inset: 20px 0 auto; height: 1px; background: rgba(255,255,255,.2); content: ""; }
.compound-track i { position: absolute; top: 15px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand-soft); box-shadow: 0 0 0 6px rgba(216,168,185,.1); }
.compound-track i:nth-child(1) { left: 0; }
.compound-track i:nth-child(2) { left: 31%; }
.compound-track i:nth-child(3) { left: 64%; }
.compound-track i:nth-child(4) { right: 0; }

.value-grid {
  display: block;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px 12px 17px 13px;
  background: var(--bright);
}

.value-card {
  min-height: 62px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.value-card + .value-card { border-top: 1px solid var(--line); }

.value-card small { min-height: 0; line-height: 1.2; }
.value-card strong { display: block; margin: 0; font: 500 22px/1 Georgia, serif; text-align: right; }

.result-method {
  margin: 17px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-method summary {
  min-height: 50px;
  padding: 16px 0;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
}

.truth-ledger { display: grid; gap: 15px; padding: 5px 0 18px; }
.truth-ledger small { color: var(--brand); }
.truth-ledger p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.42; }
.result-disclosure { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.result-actions { grid-template-columns: minmax(105px, .7fr) minmax(0, 1.5fr); }

.modeler.is-modeling { overflow: hidden; }
.modeler.is-modeling .model-shell { height: 100dvh; min-height: 0; overflow: hidden; }
.modeler.is-modeling .simulation-content { height: calc(100dvh - 108px); min-height: 0; overflow: hidden; padding-bottom: 0; }

.sim-loading {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(16px, 3svh, 28px);
  padding: clamp(22px, 4.5svh, 42px) 0 max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.sim-loading h2 {
  margin: 11px 0 0;
  font: 500 clamp(34px, 9.4vw, 46px)/.97 Georgia, serif;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.sim-loading header > p:last-child {
  margin: 15px 0 0;
  color: #554f47;
  font-size: 16px;
  line-height: 1.42;
}

.loading-engine {
  min-height: 0;
  padding: clamp(12px, 2.4svh, 20px) 16px 14px;
  border: 1px solid rgba(73,63,63,.22);
  border-radius: 23px 19px 25px 21px;
  background: rgba(255,253,250,.94);
}

.loading-engine-graphic {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(44px, auto);
  gap: 8px;
  overflow: hidden;
}

.loading-orbit {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.loading-orbit svg { width: min(100%, 310px); height: 100%; min-height: 170px; overflow: visible; }
.engine-connections path { fill: none; stroke: rgba(147,71,100,.26); stroke-width: 1.25; }
.engine-rings circle { fill: none; stroke: rgba(147,71,100,.17); stroke-width: 1; transform-box: fill-box; transform-origin: center; animation: engine-breathe 2.2s ease-in-out infinite; }
.engine-rings circle:last-child { animation-delay: -.85s; }
.engine-stages circle { fill: var(--paper); stroke: var(--brand); stroke-width: 2; animation: engine-stage 5s ease both; animation-delay: calc(var(--engine-order) * .9s); }
.engine-signal { fill: var(--brand); filter: drop-shadow(0 0 5px rgba(147,71,100,.55)); }
.signal-one { animation: engine-signal-one 2.3s ease-in-out infinite; }
.signal-two { animation: engine-signal-two 2.7s ease-in-out -1.1s infinite; }

.loading-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(147,71,100,.34);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  background: rgba(255,253,250,.95);
  box-shadow: 0 0 0 10px rgba(147,71,100,.045);
}
.loading-core b { color: var(--brand); font: 500 21px Georgia,serif; }

.loading-messages { position: relative; min-height: 48px; border-top: 1px solid var(--line); }
.loading-messages span { position: absolute; inset: 11px 0 auto; color: var(--ink); text-align: center; font-size: 14px; line-height: 1.3; opacity: 0; transform: translateY(7px); animation: engine-message 1.9s ease both; animation-delay: calc(var(--load-order) * 1.65s); }

@keyframes engine-breathe { 50% { opacity: .42; transform: scale(1.045); } }
@keyframes engine-stage { 0% { fill: var(--paper); transform: scale(.72); } 8%,100% { fill: var(--brand); transform: scale(1); } }
@keyframes engine-signal-one { 0%,100% { transform: translate(0,0); opacity: .25; } 48% { transform: translate(81px,-26px); opacity: 1; } 49% { transform: translate(0,0); opacity: 0; } 50% { transform: translate(-50px,69px); opacity: .25; } }
@keyframes engine-signal-two { 0%,100% { transform: translate(0,0); opacity: .2; } 48% { transform: translate(-81px,-26px); opacity: 1; } 49% { transform: translate(0,0); opacity: 0; } 50% { transform: translate(50px,69px); opacity: .2; } }
@keyframes engine-message { 0% { opacity: 0; transform: translateY(7px); } 10%,86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }

@media (max-height: 740px) {
  .sim-loading { gap: 12px; padding-top: 16px; }
  .sim-loading h2 { font-size: 32px; }
  .sim-loading header > p:last-child { margin-top: 10px; font-size: 14px; line-height: 1.32; }
  .loading-orbit svg { min-height: 145px; }
  .loading-core { width: 64px; height: 64px; }
  .loading-messages { min-height: 43px; }
  .loading-messages span { top: 9px; font-size: 13px; }
}

@media (min-width: 440px) {
  .model-shell { padding-left: 22px; padding-right: 22px; }
  .company-inputs { grid-template-columns: 1fr 1fr; }
  .sim-priorities { grid-template-columns: 1fr 1fr; }
  .adjust-panel .sim-fields { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 700px) {
  body { padding: 0; }
  .modeler { padding: 0 !important; }
  .model-shell { height: 100dvh; min-height: 0; border-radius: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .allocation-bar i,
  .value-route i { transition: none; }
  .engine-rings circle,
  .engine-stages circle,
  .engine-signal { animation: none; }
  .engine-stages circle { fill: var(--brand); }
  .loading-messages span { display: none; animation: none; }
  .loading-messages span:last-child { display: block; opacity: 1; transform: none; }
}
