@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap");
:root {
  --navy: #081d33;
  --blue: #d2e5f7;
  --lilac: #c8bcf5;
  --lime: #e2f2a7;
  --paper: #f7f7f7;
  --line: #dce3e8;
  --muted: #647384;
  --danger: #a34852;
  --radius: 14px;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--navy);
  font:
    14px "DM Sans",
    Arial,
    sans-serif;
}
a {
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  outline-offset: 4px;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 14px;
  line-height: 1.35;
}
button:hover {
  border-color: #a69bc5;
  background: #f1edf9;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary,
button.primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  text-decoration: none;
  padding: 11px 17px;
  border-radius: 8px;
}
.primary:hover {
  background: #203d59;
}
button.quiet {
  border: 0;
  background: transparent;
  color: var(--muted);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #8a76ba;
  outline-offset: 3px;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 10px 11px;
  max-width: 100%;
  font-size: 14px;
}
input[type="number"] {
  width: 100%;
  font-variant-numeric: tabular-nums;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #7561a7;
}
textarea {
  width: 100%;
  resize: vertical;
}
p {
  line-height: 1.65;
}
h1 {
  font-size: clamp(27px, 2.6vw, 38px);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -1.2px;
  margin: 0 0 12px;
}
h2 {
  font-size: 21px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.5px;
  margin: 0 0 18px;
}
h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 14px;
}
.lede {
  color: var(--muted);
  max-width: 800px;
  margin: 0 0 28px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 10px;
}
.subnote,
.grid-help {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  margin: 16px 0;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Shell */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 76px;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 14px 26px;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}
.brand {
  text-decoration: none;
  font-size: 30px;
  letter-spacing: 5px;
  font-weight: 500;
  line-height: 1;
}
.brand span {
  display: block;
  font-size: 7px;
  letter-spacing: 2px;
  margin-top: 7px;
}
.header-note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}
.header-note b {
  font-weight: 500;
  color: var(--navy);
}
.demo-badge {
  margin-left: auto;
  background: #eff4d8;
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 10px;
}
.workspace {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: calc(100dvh - 76px);
}
aside {
  position: sticky;
  top: 76px;
  align-self: start;
  height: calc(100dvh - 76px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
nav a {
  padding: 12px;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}
nav a.active {
  background: var(--navy);
  color: #fff;
}
nav > a:nth-of-type(4) {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  border-radius: 0;
}
nav > a:nth-of-type(n + 4) {
  font-size: 12px;
  color: var(--muted);
}
nav > a.active {
  color: #fff;
}
.subnav {
  padding: 0 0 8px 12px;
}
.subnav a {
  font-size: 11px;
  padding: 8px;
}
.sidebar-bottom {
  margin-top: auto;
  line-height: 1.9;
  color: var(--muted);
  font-size: 11px;
}
.sidebar-bottom button,
.file-label {
  display: block;
  width: 100%;
  margin-top: 10px;
  font-size: 12px;
  text-align: left;
}
.file-label {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
}
.file-label input {
  display: none;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #507660;
  margin-right: 5px;
}
main {
  padding: 24px clamp(20px, 3vw, 48px) 32px;
  min-width: 0;
  max-width: 1800px;
}
footer {
  font-size: 10px;
  color: var(--muted);
  padding: 36px 0 0;
}
#scenario-menu {
  display: none;
}
/* Persistent comparison */
#plan-toolbar {
  position: sticky;
  top: 88px;
  z-index: 12;
  box-shadow: 0 3px 12px #081d3308;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid #d4dce5;
  border-left: 3px solid #a695cf;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 28px;
  background: #fff;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.plan-state {
  min-width: 110px;
  max-width: 210px;
}
.plan-state > span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}
.plan-state > b {
  display: block;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-metrics {
  display: flex;
  gap: 24px;
  flex: 1;
}
.plan-metrics > span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.plan-metrics b {
  display: block;
  color: var(--navy);
  font-size: 18px;
  font-weight: 500;
  margin-top: 3px;
}
.plan-metrics small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
}
.plan-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.plan-actions button {
  font-size: 11px;
  padding: 8px 10px;
}
.notice {
  position: relative;
  background: #edf4cc;
  padding: 12px 38px 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 12px;
}
.notice > button {
  position: absolute;
  right: 8px;
  top: 7px;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  font-size: 18px;
}
.notice.error {
  background: #fae2e1;
  color: #802b36;
}
.comparison-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0 32px;
}
.comparison-table {
  min-width: 600px;
}
.change-list p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin: 0;
}
.change-list b {
  font-size: 12px;
  font-weight: 500;
}
.change-list small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
/* Launch economics */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
}
.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.topline h2 {
  margin: 0;
}
.launch-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin: 0 0 26px;
}
.launch-heading h1 {
  margin: 6px 0 10px;
}
.launch-heading p {
  margin: 6px 0;
  color: #536779;
}
.launch-heading > button {
  flex-shrink: 0;
}
.overview-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 12px;
}
.overview-caption > b {
  font-size: 13px;
}
.overview-caption > span {
  font-size: 11px;
  color: var(--muted);
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0 28px;
  font-variant-numeric: tabular-nums;
}
.kpi {
  padding: 20px;
}
.kpi > span {
  font-size: 11px;
  color: var(--muted);
}
.kpi > b {
  display: block;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.8px;
  font-weight: 500;
  margin: 14px 0 8px;
  line-height: 1.2;
}
.kpi > small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  display: block;
}
.portfolio-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 28px 0 36px;
}
.portfolio-item {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 12px;
  background: #fff;
}
.portfolio-item .product-image {
  width: 58px;
  height: 74px;
  object-fit: contain;
  margin: 0;
}
.portfolio-item > span {
  display: grid;
  gap: 6px;
}
.portfolio-item b {
  font-size: 13px;
}
.portfolio-item small {
  font-size: 11px;
  color: var(--muted);
}
.product-disabled {
  opacity: 0.6;
}
.decision-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  gap: 24px;
  margin: 28px 0;
}
.hero-chart {
  background: var(--navy);
  color: #fff;
  border: 0;
}
.hero-chart button {
  background: #18384f;
  color: #fff;
  border-color: #52677a;
}
.hero-chart button:hover {
  background: #294e68;
  border-color: #c8bcf5;
}
.hero-chart .eyebrow,
.hero-chart .muted {
  color: #bccddd;
}
.hero-chart svg {
  width: 100%;
  height: auto;
  min-height: 210px;
  display: block;
  margin: 22px 0;
}
.hero-chart p {
  font-size: 12px;
  color: #dbe4ec;
  line-height: 1.7;
}
.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 10px;
  margin-top: 15px;
  color: #dce6ef;
}
.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  vertical-align: middle;
  margin-right: 7px;
}
.decision-lab {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.decision-lab h2,
.decision-lab p {
  margin: 0;
}
.decision-lab p {
  font-size: 12px;
  color: var(--muted);
}
.decision-lab button {
  text-align: left;
}
.report-doors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 32px 0;
}
.report-doors button {
  text-align: left;
  padding: 20px;
}
.report-doors b {
  font-size: 13px;
}
.report-doors span {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 8px;
  color: var(--muted);
}
.funding-status {
  padding: 20px;
  background: #edf5de;
  border-radius: 12px;
  margin: 28px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.funding-status.warning {
  background: #fff0dc;
  color: #803a17;
}
.funding-status span {
  font-size: 12px;
}
.grid2,
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 28px 0;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.product-image {
  display: block;
  width: 100%;
  height: 210px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 20px;
}
.image-placeholder {
  display: grid;
  place-items: center;
  background: #edf3f8;
  border: 1px dashed #aebdcc;
  border-radius: 10px;
  min-height: 110px;
  padding: 20px;
  color: var(--muted);
}
.portfolio-item .image-placeholder {
  width: 58px;
  min-width: 58px;
  min-height: 74px;
  padding: 6px;
  font-size: 9px;
}
.pill {
  font-size: 10px;
  border-radius: 20px;
  background: var(--blue);
  padding: 5px 9px;
  display: inline-block;
}
.pill.good {
  background: var(--lime);
}
.pill.warn {
  background: #f9e3df;
}
.product .amount {
  font-size: 25px;
  margin: 16px 0 6px;
}
.mini-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-size: 12px;
  gap: 16px;
}
.mini-row b {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.capital-card {
  background: var(--lilac);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.capital-card .big {
  font-size: 42px;
}
.capital-drill {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  border: 0;
  font-size: 36px;
  text-align: left;
}
/* Planning inputs */
.tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 20px 0 26px;
}
.tools label {
  font-size: 12px;
}
.tools select {
  margin-left: 6px;
}
.view-inputs > .eyebrow,
.view-inputs > .lede {
  display: none;
}
.view-inputs > h1 {
  font-size: 30px;
  margin-bottom: 20px;
}
.input-steps {
  display: flex;
  gap: 5px;
  margin: 20px 0 14px;
  overflow: auto;
  padding-bottom: 4px;
}
.input-steps a {
  flex: 1;
  min-width: 110px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid #dce3e8;
  padding: 9px 7px;
  font-size: 12px;
  white-space: nowrap;
}
.input-steps a.active {
  border-color: #8872b3;
  color: var(--navy);
  font-weight: 600;
}
.input-steps small {
  display: none;
}
.step-intro {
  margin: 12px 0 28px;
  color: var(--muted);
  font-size: 12px;
}
.step-intro summary {
  font-size: 12px;
  font-weight: 400;
}
.step-intro p {
  max-width: 850px;
}
.section-stack {
  display: grid;
  gap: 32px;
}
.input-section {
  padding: 28px;
}
.input-section > h2 {
  margin: 0 0 24px;
}
.input-section > h2 + .month-editor {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}
.input-section > h2 + .month-editor > h3 {
  display: none;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 18px 0 24px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 12px;
  color: #4c6073;
  line-height: 1.5;
}
.field-grid .wide {
  grid-column: 1/-1;
}
.field-help {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 400;
}
.field input,
.field select {
  width: 100%;
}
.deep {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 20px;
}
.deep summary,
summary {
  cursor: pointer;
  font-weight: 500;
}
.deep[open] > summary {
  margin-bottom: 24px;
}
.month-editor {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.month-editor h3 {
  margin: 0 0 12px;
}
.period-action {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0 18px;
}
.period-action span {
  font-size: 11px;
  color: var(--muted);
}
.grid-toolbar {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 14px;
}
.grid-toolbar > button {
  white-space: nowrap;
  font-size: 11px;
}
.grid-years {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.grid-years button {
  font-size: 11px;
  padding: 8px 9px;
}
.grid-years .active {
  background: #e8e2f7;
  color: #3d3563;
  border-color: #c2b5e0;
}
.editable-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid #d9e0e9;
  border-radius: 10px;
  background: #fff;
  scrollbar-width: thin;
}
.editable-grid {
  width: max-content;
  min-width: 100%;
  font-size: 13px;
}
.editable-grid thead th {
  font-size: 11px;
  text-align: center;
  padding: 12px 10px;
}
.editable-grid th:first-child {
  min-width: 180px;
  max-width: 240px;
  white-space: normal;
  padding: 12px 16px;
  font-size: 12px;
  background: #f7f9fc;
}
.editable-grid td {
  padding: 0;
  border-right: 1px solid #e6eaf0;
  min-width: 92px;
}
.editable-grid input {
  display: block;
  width: 100%;
  min-width: 90px;
  max-width: 116px;
  border: 0;
  border-radius: 0;
  padding: 13px 10px;
  text-align: right;
  color: #18354c;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.editable-grid input::placeholder {
  color: #718096;
  font-style: italic;
}
.editable-grid input:focus {
  outline: 2px solid #8b7bc1;
  outline-offset: -2px;
  background: #f0edfb;
}
.editable-grid tr:focus-within > th {
  background: #e7e1f7;
}
.editable-grid .fill-row {
  font-size: 11px;
  white-space: nowrap;
  border: 0;
  border-radius: 0;
  background: #f8fafc;
  padding: 12px;
  color: #576880;
}
.batch-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.batch-totals > div {
  padding: 14px;
  background: #f0f4f7;
  border-radius: 10px;
}
.batch-totals small,
.batch-totals b,
.batch-totals span {
  display: block;
}
.batch-totals b {
  font-size: 16px;
  margin: 8px 0;
}
.batch-totals span,
.batch-totals small {
  font-size: 11px;
  color: var(--muted);
}
.step-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 32px 0;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.step-footer a {
  text-decoration: none;
  padding: 12px;
}
.image-editor {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 32px;
}
.image-editor .product-image {
  height: 130px;
  margin: 0;
}
.image-editor .file-label {
  display: inline-block;
  width: auto;
  background: var(--navy);
  color: #fff;
  margin-right: 12px;
}
.new-only {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 24px 0;
}
.new-only input {
  margin-top: 3px;
}
.order-calendar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.order-calendar label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}
.small-inputs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.small-inputs input {
  padding: 8px;
}
.result-updated {
  outline: 2px solid #a695cf;
}
.control-bar,
.baseline-tools {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 28px;
}
.control-bar label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.baseline-tools span {
  font-size: 12px;
  color: var(--muted);
}
/* Reports and traceability */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  max-height: 70vh;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #eaf0f4;
  text-align: right;
  white-space: nowrap;
}
th {
  font-weight: 500;
  color: #526477;
  background: #f0f5f9;
  position: sticky;
  top: 0;
  z-index: 2;
}
th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  text-align: left;
  min-width: 220px;
  background: #fff;
  z-index: 1;
}
th:first-child {
  z-index: 3;
  background: #f0f5f9;
}
.total-row td {
  background: #edf4fa;
  font-weight: 600;
}
.total-row td:first-child {
  background: #edf4fa;
}
.section-row td,
.section-row td:first-child {
  background: var(--navy);
  color: #fff;
}
.cell {
  border: 0;
  padding: 2px 0;
  background: transparent;
  border-radius: 0;
  font: inherit;
  text-align: right;
  min-width: 65px;
  border-bottom: 1px dotted #9aabba;
}
.cell:hover {
  color: #7660b2;
  background: transparent;
}
.negative {
  color: var(--danger);
}
.tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}
.tabs button.active {
  background: var(--navy);
  color: #fff;
}
.formula {
  padding: 16px;
  background: #f0f5fa;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.8;
  margin: 22px 0;
}
.flow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.flow span {
  padding: 8px 10px;
  background: var(--blue);
  font-size: 11px;
  border-radius: 7px;
}
.list {
  padding-left: 18px;
  line-height: 1.9;
}
.checkline {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.checkline b {
  color: #48603a;
}
.checklist {
  margin-top: 24px;
}
.empty {
  padding: 30px;
}
.lot {
  display: grid;
  grid-template-columns: 115px minmax(150px, 1fr) 110px;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.lot .track {
  background: #eef3f8;
  height: 24px;
  border-radius: 15px;
  position: relative;
}
.lot .stage {
  position: absolute;
  top: 0;
  height: 24px;
  border-radius: 15px;
  min-width: 3px;
}
.stage.production {
  background: var(--lilac);
}
.stage.transit {
  background: var(--blue);
}
.stage.sell {
  background: var(--lime);
}
.lot small {
  font-size: 10px;
}
.scenario-card {
  border-top: 4px solid var(--blue);
}
.scenario-card:nth-child(2) {
  border-top-color: var(--lilac);
}
.scenario-card:nth-child(3) {
  border-top-color: var(--lime);
}
.scenario-card strong {
  font-size: 26px;
  display: block;
  margin: 20px 0;
  font-weight: 500;
}
.unit-economics {
  margin: 28px 0;
}
.unit-economics .kpis {
  margin-bottom: 0;
}
.unit-economics .kpi {
  background: #f5f7fa;
  padding: 16px;
}
.unit-economics .kpi b {
  font-size: 23px;
}
/* Dialogs */
dialog {
  border: 0;
  border-radius: 16px;
  padding: 28px;
  max-width: 800px;
  width: calc(100vw - 28px);
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 0 20px 100px #081d3355;
  color: var(--navy);
}
dialog::backdrop {
  background: #081d3377;
}
dialog h2 {
  font-size: 26px;
}
dialog .detail-value {
  font-size: 34px;
}
dialog th:first-child,
dialog td:first-child {
  min-width: 150px;
}
#close-detail {
  margin-top: 26px;
}
#trace-back {
  margin-bottom: 22px;
}
.preview-impact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #ebe7f9;
  border-radius: 10px;
  padding: 18px;
  gap: 20px;
  margin: 24px 0;
  font-size: 12px;
}
.preview-impact b {
  display: block;
  font-size: 21px;
  margin-top: 9px;
  font-variant-numeric: tabular-nums;
}
.period-preview-table {
  max-height: 280px;
  overflow: auto;
  margin: 20px 0;
}
.period-preview-table th {
  position: sticky;
  top: 0;
}
.period-error {
  color: #a32c3d;
}
.period-error:empty {
  display: none;
}
#period-form .field-grid {
  gap: 22px;
  margin: 24px 0;
}
#period-preview {
  margin-top: 28px;
}
#period-preview > h3 {
  margin-bottom: 18px;
}
/* Agent, as a working column */
.agent-toggle {
  background: #eee9f9;
  color: #44395e;
  border-color: #c7bbdf;
  font-size: 12px;
  padding: 10px 14px;
  white-space: nowrap;
}
.agent-toggle[aria-expanded="true"] {
  background: var(--navy);
  color: #fff;
}
.agent-workbench {
  position: sticky;
  top: 76px;
  align-self: start;
  height: calc(100dvh - 76px);
  min-width: 0;
  border-left: 1px solid #cfd7e2;
  background: #fff;
}
.agent-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.agent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #f0edf8;
  flex-shrink: 0;
}
.agent-heading strong {
  font-size: 14px;
  font-weight: 600;
}
.agent-close {
  padding: 3px 9px;
  font-size: 23px;
  background: transparent;
  border-color: transparent;
  line-height: 1.2;
}
.agent-context {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid #e6e8ee;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.agent-context-name {
  color: #45566a;
  max-width: 70%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.agent-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 20px 16px;
  overscroll-behavior: contain;
}
.agent-empty {
  padding: 12px 0;
}
.agent-empty h3 {
  font-size: 16px;
  line-height: 1.4;
  margin: 20px 0 12px;
}
.agent-empty p {
  font-size: 12px;
  color: var(--muted);
}
.agent-suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.agent-suggestions button {
  font-size: 12px;
  text-align: left;
  background: #f5f3fa;
}
.agent-bubble {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.75;
  padding: 20px 0;
  border-bottom: 1px solid #e0e5ed;
  overflow-wrap: anywhere;
}
.agent-bubble.user {
  background: #f0edf8;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  margin: 16px 0 0;
  color: #534566;
  font-weight: 500;
}
.agent-bubble.agent-error {
  color: #802b36;
}
.agent-error button {
  display: block;
  font-size: 12px;
  margin-top: 16px;
  white-space: normal;
}
.agent-thinking {
  color: var(--muted);
}
.agent-form {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}
.agent-form label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px;
}
.agent-form textarea {
  min-height: 66px;
  max-height: 140px;
  font-size: 13px;
  line-height: 1.5;
}
.agent-form > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.agent-form small {
  font-size: 10px;
  color: var(--muted);
}
.agent-form .primary {
  font-size: 12px;
  padding: 9px 14px;
}
.agent-proposal {
  background: #f2f6e6;
  border: 1px solid #d9e4b7;
  border-radius: 10px;
  margin: 20px 0;
  padding: 16px;
  font-size: 12px;
  line-height: 1.65;
}
.agent-proposal p {
  overflow-wrap: anywhere;
}
.agent-proposal button {
  margin-top: 10px;
}
@media (min-width: 1280px) {
  body.agent-open .workspace {
    grid-template-columns: 180px minmax(0, 1fr) 420px;
  }
  body.agent-open main {
    padding: 24px;
  }
  body.agent-open .decision-layout {
    grid-template-columns: 1fr;
  }
  body.agent-open .portfolio-strip {
    grid-template-columns: 1fr;
  }
  body.agent-open .portfolio-item .product-image {
    height: 54px;
  }
  body.agent-open .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.agent-open #plan-toolbar {
    flex-wrap: wrap;
  }
  body.agent-open .plan-state {
    max-width: 130px;
  }
  body.agent-open .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.agent-open .grid3 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1279px) {
  .agent-workbench {
    position: fixed;
    inset: 0;
    z-index: 80;
    width: 100%;
    height: 100dvh;
  }
  .agent-panel {
    max-width: 760px;
    margin: auto;
    background: #fff;
  }
  body.agent-open {
    overflow: hidden;
  }
  .header-note {
    display: none;
  }
  #plan-toolbar {
    flex-wrap: wrap;
  }
  .plan-metrics {
    gap: 18px;
  }
  .plan-actions {
    margin-left: auto;
  }
  .decision-layout {
    grid-template-columns: 1fr;
  }
  .grid3 {
    grid-template-columns: 1fr;
  }
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portfolio-item {
    gap: 8px;
  }
  .portfolio-item .product-image {
    width: 44px;
    height: 60px;
  }
  .portfolio-item b {
    font-size: 12px;
  }
  .portfolio-item small {
    font-size: 10px;
  }
  .grid2,
  .hero {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 160px minmax(0, 1fr);
  }
  aside {
    padding: 20px 8px;
  }
  main {
    padding: 24px 20px;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portfolio-strip {
    grid-template-columns: 1fr;
  }
  .report-doors {
    grid-template-columns: 1fr;
  }
  .launch-heading {
    align-items: flex-start;
  }
  .launch-heading > button {
    font-size: 12px;
  }
  .overview-caption {
    flex-direction: column;
    gap: 6px;
  }
  .batch-totals {
    grid-template-columns: repeat(2, 1fr);
  }
  .small-inputs {
    grid-template-columns: repeat(3, 1fr);
  }
  .plan-state {
    display: none;
  }
  .plan-actions {
    margin: 0;
  }
  .plan-metrics {
    flex-basis: 100%;
  }
}
@media (max-width: 650px) {
  header {
    height: 66px;
    padding: 12px 16px;
    gap: 10px;
  }
  .brand {
    font-size: 25px;
    letter-spacing: 4px;
  }
  .brand span {
    font-size: 6px;
  }
  .demo-badge {
    display: none;
  }
  .agent-toggle {
    margin-left: auto;
    font-size: 11px;
    padding: 9px 10px;
  }
  .workspace {
    display: block;
    min-height: calc(100dvh - 66px);
  }
  aside {
    position: static;
    height: auto;
    overflow: visible;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 10px;
  }
  nav {
    flex-direction: row;
    align-items: center;
    overflow: auto;
    gap: 3px;
  }
  nav > a {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 11px;
    padding: 10px;
  }
  nav > a:nth-of-type(4) {
    margin-top: 0;
    border-top: 0;
  }
  nav > a:nth-of-type(n + 4) {
    font-size: 11px;
  }
  .subnav {
    display: none;
  }
  .sidebar-bottom {
    display: none;
    position: fixed;
    z-index: 30;
    top: 66px;
    right: 12px;
    width: 240px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 40px #081d3325;
  }
  .scenario-menu-open .sidebar-bottom {
    display: grid;
    gap: 12px;
  }
  #scenario-menu {
    display: block;
    font-size: 11px;
    padding: 9px 10px;
  }
  header .agent-toggle {
    margin-left: 0;
  }
  header .brand {
    margin-right: auto;
  }
  .sidebar-bottom > .dot,
  .sidebar-bottom > small,
  .sidebar-bottom > br {
    display: none;
  }
  .sidebar-bottom {
    font-size: 0;
  }
  .sidebar-bottom button,
  .sidebar-bottom .file-label {
    display: inline-block;
    width: auto;
    margin: 0;
    font-size: 10px;
    padding: 7px 9px;
  }
  .sidebar-bottom .quiet {
    margin-left: 0;
  }
  main {
    padding: 20px 14px 28px;
  }
  #plan-toolbar {
    top: 66px;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 24px;
  }
  .plan-metrics {
    gap: 12px;
    justify-content: space-between;
  }
  .plan-metrics > span {
    font-size: 9px;
  }
  .plan-metrics b {
    font-size: 17px;
  }
  .plan-metrics small {
    font-size: 9px;
  }
  .plan-actions {
    gap: 4px;
    justify-content: space-between;
    width: 100%;
  }
  .plan-actions button {
    font-size: 10px;
    padding: 7px 9px;
  }
  .notice {
    font-size: 11px;
  }
  .launch-heading {
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
  }
  .launch-heading h1 {
    font-size: 29px;
  }
  .launch-heading p {
    font-size: 12px;
  }
  .launch-heading .eyebrow {
    font-size: 9px;
  }
  .overview-caption {
    margin-top: 24px;
  }
  .overview-caption > span {
    font-size: 10px;
  }
  .card {
    padding: 20px;
  }
  .kpis {
    gap: 10px;
    margin: 14px 0 28px;
  }
  .kpi {
    padding: 15px;
  }
  .kpi > span {
    font-size: 10px;
  }
  .kpi > b {
    font-size: 22px;
    margin: 12px 0 8px;
  }
  .kpi > small {
    font-size: 10px;
  }
  .portfolio-strip {
    margin: 28px 0;
  }
  .portfolio-item .product-image {
    width: 50px;
    height: 60px;
  }
  .portfolio-item b {
    font-size: 13px;
  }
  .portfolio-item small {
    font-size: 11px;
  }
  .decision-layout {
    gap: 24px;
  }
  .topline {
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
  }
  .hero-chart h2 {
    font-size: 21px;
  }
  .hero-chart button {
    font-size: 11px;
  }
  .hero-chart svg {
    min-height: 170px;
    margin: 20px 0;
  }
  .chart-legend {
    gap: 10px;
    font-size: 9px;
  }
  .field-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .input-section {
    padding: 20px;
  }
  .section-stack {
    gap: 28px;
  }
  .tools {
    gap: 8px;
    margin: 16px 0 22px;
  }
  .tools button {
    font-size: 11px;
    padding: 9px 10px;
  }
  .input-steps {
    margin: 18px 0 12px;
  }
  .input-steps a {
    font-size: 11px;
    min-width: auto;
    padding: 8px 10px;
  }
  .step-intro {
    margin-bottom: 24px;
  }
  .view-inputs > h1 {
    font-size: 26px;
  }
  .field {
    font-size: 12px;
  }
  .field-help {
    font-size: 11px;
  }
  .period-action {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .grid-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .grid-years button {
    font-size: 10px;
  }
  .editable-grid th:first-child {
    min-width: 125px;
    max-width: 150px;
    padding: 10px;
    font-size: 11px;
  }
  .batch-totals {
    gap: 10px;
  }
  .batch-totals > div {
    padding: 12px;
  }
  .batch-totals b {
    font-size: 14px;
  }
  .image-editor {
    grid-template-columns: 1fr;
  }
  .image-editor .product-image {
    width: 130px;
  }
  .order-calendar {
    grid-template-columns: repeat(3, 1fr);
  }
  th:first-child,
  td:first-child {
    min-width: 155px;
    padding: 11px 10px;
    max-width: 185px;
    white-space: normal;
  }
  table {
    font-size: 11px;
  }
  th,
  td {
    padding: 11px;
  }
  .lot {
    grid-template-columns: 82px minmax(100px, 1fr) 75px;
    gap: 8px;
    font-size: 11px;
  }
  .lot button {
    padding: 9px 6px;
    font-size: 10px;
  }
  .lot.muted {
    font-size: 8px;
  }
  .lot .track,
  .lot .stage {
    height: 20px;
  }
  .preview-impact {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .preview-impact b {
    font-size: 20px;
  }
  dialog {
    padding: 22px;
    max-height: 92dvh;
  }
  .comparison-table {
    min-width: 550px;
  }
  #detail-body {
    overflow-x: auto;
  }
  .step-footer {
    font-size: 11px;
  }
  .agent-form {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .agent-form textarea {
    max-height: 100px;
  }
  .agent-heading {
    padding: 12px 16px;
  }
  .agent-context {
    padding: 9px 16px;
  }
  .agent-messages {
    padding: 0 18px 16px;
  }
  .agent-bubble {
    font-size: 14px;
    line-height: 1.7;
  }
  .change-list p {
    flex-direction: column;
    gap: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
