:root {
  color-scheme: light;
  --brand: #3fd6c7;
  --brand-dark: #0b747a;
  --brand-deep: #075a5f;
  --brand-soft: #e6faf7;
  --ink: #20242c;
  --text: #4b505a;
  --muted: #6b7280;
  --line: #dfe4e8;
  --line-strong: #c8d0d6;
  --surface: #ffffff;
  --ground: #f4f6f7;
  --ground-deep: #eaedef;
  --success: #13795b;
  --success-soft: #eaf8f1;
  --warning: #956400;
  --warning-soft: #fff8df;
  --danger: #c33b4a;
  --danger-soft: #fff0f2;
  --yellow: #f4c64e;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-float: 0 14px 42px rgba(32, 36, 44, 0.09);
  --font: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ground);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--ground);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
summary,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button,
input,
textarea {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(63, 214, 199, 0.34);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 12px clamp(18px, 2.5vw, 40px) 14px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #12a899 0%, #3fd6c7 26%, #8fede2 50%, #3fd6c7 74%, #12a899 100%);
}

.brand-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

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

.brand-divider {
  width: 1px;
  height: 38px;
  background: var(--line);
}

.eyebrow,
.step-kicker,
.rail-label {
  margin: 0 0 3px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brand-block h1 {
  margin: 0;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.save-status {
  max-width: 190px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #073f43;
  background: var(--brand);
  border-color: var(--brand);
}

.button-primary:hover {
  background: #2fcabc;
  border-color: #2fcabc;
}

.button-quiet,
.button-back {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

.button-quiet:hover,
.button-back:hover {
  border-color: var(--brand-dark);
  color: var(--brand-dark);
}

.button-next {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: #bcece6;
}

.button-danger {
  color: white;
  background: var(--danger);
  border-color: var(--danger);
}

.print-heading {
  display: none;
}

.app-shell {
  width: min(100%, 1680px);
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 210px minmax(520px, 1fr) minmax(340px, 410px);
  grid-template-areas: "nav main result";
  align-items: start;
}

.chapter-rail {
  grid-area: nav;
  position: sticky;
  top: 78px;
  min-height: calc(100vh - 78px);
  padding: 28px 16px 20px;
  background: #f8f9fa;
  border-right: 1px solid var(--line);
}

.chapter-rail ol {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.chapter-rail li + li {
  margin-top: 4px;
}

.chapter-button {
  position: relative;
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 9px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.chapter-button::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: transparent;
}

.chapter-button:hover {
  background: #eef1f2;
}

.chapter-button.is-active {
  color: var(--ink);
  background: var(--brand-soft);
}

.chapter-button.is-active::before {
  background: var(--brand);
}

.chapter-number {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chapter-button.is-active .chapter-number {
  color: #073f43;
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

.chapter-button strong,
.chapter-button small {
  display: block;
}

.chapter-button strong {
  font-size: 14px;
  font-weight: 600;
}

.chapter-button small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-progress {
  margin: 26px 8px 0;
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: var(--ground-deep);
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--brand-dark);
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.danger-action {
  margin: 28px 8px 0;
  color: var(--danger);
}

.workspace {
  grid-area: main;
  min-width: 0;
  padding: 26px clamp(20px, 2.4vw, 38px) 70px;
  background: var(--surface);
}

.worksheet {
  max-width: 920px;
  margin: 0 auto;
}

.worksheet[hidden] {
  display: none;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 0 24px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.section-heading p:not(.step-kicker) {
  max-width: 690px;
  margin: 10px 0 0;
  color: var(--text);
  font-size: 14px;
}

.draft-chip,
.share-total,
.fee-total,
.status-dot {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--ground);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.draft-chip {
  padding: 6px 10px;
}

.share-total,
.fee-total {
  padding: 9px 12px;
  font-variant-numeric: tabular-nums;
}

.share-total.is-valid {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b8e1d0;
}

.share-total.is-invalid {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f0c3c9;
}

.fee-total {
  min-width: 72px;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: #bcece6;
  font-size: 16px;
  text-align: center;
}

.field-group {
  min-width: 0;
  margin: 26px 0 0;
  padding: 0;
  border: 0;
}

.field-group + .field-group {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.field-group legend {
  width: 100%;
  margin: 0 0 15px;
  padding: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.field-group-accent {
  padding: 20px !important;
  border: 1px solid #bcece6 !important;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
}

.field-group-accent legend {
  width: auto;
  padding: 0 7px;
  background: var(--brand-soft);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.field-wide {
  grid-column: 1 / -1;
}

.field input,
.field textarea,
.compact-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:hover,
.field textarea:hover,
.compact-field input:hover {
  border-color: #9aa6ae;
}

.field input:focus,
.field textarea:focus,
.compact-field input:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(63, 214, 199, 0.15);
  outline: 0;
}

.field input.is-invalid,
.compact-field input.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field small,
.compact-field small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
}

.input-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit input {
  padding-right: 52px;
}

.input-unit em {
  position: absolute;
  right: 11px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  pointer-events: none;
}

.key-field .input-unit input {
  border-color: var(--brand-dark);
  font-size: 18px;
  font-weight: 600;
}

.field-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.info-dot {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin-left: 3px;
  padding: 0;
  border: 1px solid #91a0aa;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.choice-card {
  min-height: 92px;
  display: grid;
  grid-template-columns: 19px 1fr;
  align-items: start;
  gap: 11px;
  padding: 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.choice-card:has(input:checked) {
  border-color: var(--brand-dark);
  background: var(--brand-soft);
}

.choice-card input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--brand-dark);
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card strong {
  font-size: 14px;
  font-weight: 600;
}

.choice-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.callout {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: var(--radius-sm);
}

.callout svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.callout strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.callout p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.callout-info {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: #bcece6;
}

.callout-warning {
  color: #6c4a00;
  background: var(--warning-soft);
  border-color: #eedb9a;
}

.merch-table {
  margin-top: 20px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.merch-head,
.merch-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) minmax(88px, 0.55fr) minmax(126px, 0.8fr) minmax(92px, 0.6fr);
  gap: 14px;
  align-items: center;
}

.merch-head {
  padding: 10px 12px;
  color: var(--muted);
  background: var(--ground);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.merch-head span:last-child,
.merch-row output {
  text-align: right;
}

.merch-row {
  min-height: 88px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.merch-name {
  min-width: 0;
  display: grid;
  grid-template-columns: 8px 1fr;
  align-items: start;
  gap: 10px;
}

.source-mark {
  width: 8px;
  height: 34px;
  margin-top: 2px;
  border-radius: 4px;
  background: var(--brand);
}

.source-consignment { background: var(--brand); }
.source-midia { background: #4387c7; }
.source-approved { background: var(--yellow); }
.source-external { background: #a18ae0; }

.merch-name strong,
.merch-name small {
  display: block;
}

.merch-name strong {
  font-size: 13px;
  font-weight: 600;
}

.merch-name small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

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

.compact-field input {
  min-height: 40px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.compact-field .input-unit input {
  padding-right: 35px;
}

.merch-row output {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.validation-message {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.advanced-box {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ground);
}

.advanced-box summary {
  padding: 13px 15px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.advanced-box[open] summary {
  border-bottom: 1px solid var(--line);
}

.switch-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 11px;
  padding: 14px 15px;
}

.switch-row input,
.service-row input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--brand-dark);
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  font-size: 12px;
  font-weight: 600;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.compact-switch {
  margin-top: 14px;
  padding: 0;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 11px;
}

.preset-button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.preset-button:hover {
  border-color: var(--brand-dark);
  color: var(--brand-dark);
}

.service-list {
  margin-top: 14px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.service-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.service-row:first-child {
  border-top: 0;
}

.service-row:has(input:checked) {
  background: #f3fcfa;
}

.service-core {
  min-height: 82px;
}

.service-copy strong,
.service-copy small {
  display: block;
}

.service-copy strong {
  font-size: 13px;
  font-weight: 600;
}

.service-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.service-rate {
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.managed-only[hidden] {
  display: none;
}

.budget-group {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.budget-intro {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 16px;
}

.budget-intro > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.budget-intro h3,
.budget-intro p {
  margin: 0;
}

.budget-intro h3 {
  font-size: 15px;
  font-weight: 600;
}

.budget-intro p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.budget-intro output {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.budget-spend { border-top: 3px solid #f08b75; }
.budget-assets { border-top: 3px solid var(--brand); }

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

.compact-budget {
  min-width: 0;
}

.financing-group {
  padding: 18px;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-md);
  background: var(--ground);
}

.financing-group legend {
  width: auto;
  padding: 0 7px;
  background: var(--ground);
}

.section-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.result-rail {
  grid-area: result;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 78px);
  overflow: auto;
  padding: 24px;
  background: #f8f9fa;
  border-left: 1px solid var(--line);
  scrollbar-width: thin;
}

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

.result-topline h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
}

.status-dot > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}

.status-dot.is-ready {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b8e1d0;
}

.status-dot.is-ready > span {
  background: var(--success);
}

.status-dot.is-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f0c3c9;
}

.status-dot.is-error > span {
  background: var(--danger);
}

.scenario-control {
  margin: 18px 0 0;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
}

.scenario-control label {
  min-width: 0;
}

.scenario-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scenario-control span {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 6px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.scenario-control input:checked + span {
  color: #073f43;
  background: var(--brand);
}

.scenario-control input:focus-visible + span {
  outline: 3px solid rgba(63, 214, 199, 0.35);
  outline-offset: 2px;
}

.hero-result {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid #bcece6;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
}

.hero-result > p,
.hero-result > span {
  margin: 0;
  color: var(--brand-deep);
  font-size: 11px;
}

.hero-result > strong {
  display: block;
  margin: 5px 0 2px;
  color: var(--brand-deep);
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hero-result.is-negative {
  border-color: #f0c3c9;
  background: var(--danger-soft);
}

.hero-result.is-negative > p,
.hero-result.is-negative > span,
.hero-result.is-negative > strong {
  color: #9f2635;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
  padding-top: 11px;
  border-top: 1px solid rgba(11, 116, 122, 0.18);
  color: var(--text);
  font-size: 11px;
}

.hero-meta b {
  font-variant-numeric: tabular-nums;
}

.pnl-list {
  margin: 16px 0 0;
  padding: 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.pnl-list > div,
.cash-panel dl > div,
.internal-analysis dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
}

.pnl-list > div:first-child,
.cash-panel dl > div:first-child,
.internal-analysis dl > div:first-child {
  border-top: 0;
}

.pnl-list dt,
.pnl-list dd,
.cash-panel dt,
.cash-panel dd,
.internal-analysis dt,
.internal-analysis dd {
  margin: 0;
  font-size: 11px;
}

.pnl-list dd,
.cash-panel dd,
.internal-analysis dd {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.pnl-total {
  color: var(--ink);
  background: var(--surface);
  font-weight: 700;
}

.break-even-panel,
.cash-panel,
.internal-analysis {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.result-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.result-section-title h3,
.owner-panel h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.result-section-title strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.break-even-track {
  position: relative;
  height: 8px;
  margin: 20px 0 9px;
  background: var(--ground-deep);
}

.break-even-track span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--brand);
}

.break-even-track i {
  position: absolute;
  top: -5px;
  left: 0;
  width: 2px;
  height: 18px;
  background: var(--ink);
}

.break-even-panel p,
.owner-panel p,
.internal-analysis p,
.legal-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.owner-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 14px 15px;
  border: 1px solid #bcece6;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
}

.owner-panel p {
  margin-top: 2px;
}

.owner-panel > strong {
  color: var(--brand-deep);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.cash-panel dl,
.internal-analysis dl {
  margin: 10px 0 0;
}

.return-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-top: 12px;
  background: var(--line);
  border: 1px solid var(--line);
}

.return-grid span {
  min-width: 0;
  padding: 10px;
  background: var(--ground);
}

.return-grid small,
.return-grid strong {
  display: block;
}

.return-grid small {
  color: var(--muted);
  font-size: 9px;
}

.return-grid strong {
  margin-top: 3px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.internal-analysis summary {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
}

.internal-analysis p {
  margin-top: 10px;
}

.result-warnings {
  margin-top: 14px;
}

.warning-item {
  position: relative;
  margin-top: 6px;
  padding-left: 15px;
  color: #7d5700;
  font-size: 10px;
  line-height: 1.4;
}

.warning-item::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

.warning-item.is-error {
  color: var(--danger);
}

.warning-item.is-error::before {
  background: var(--danger);
}

.legal-note {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.confirm-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}

.confirm-dialog::backdrop {
  background: rgba(20, 25, 30, 0.45);
}

.confirm-dialog form {
  padding: 26px;
}

.dialog-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 21px;
}

.confirm-dialog h2 {
  margin: 16px 0 0;
  font-size: 22px;
}

.confirm-dialog p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.tooltip {
  position: fixed;
  z-index: 90;
  max-width: 250px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: var(--shadow-float);
  pointer-events: none;
}

@media (max-width: 1260px) {
  .app-shell {
    grid-template-columns: 190px minmax(520px, 1fr);
    grid-template-areas:
      "nav main"
      "nav result";
  }

  .result-rail {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .result-topline,
  .scenario-control,
  .hero-result,
  .pnl-list,
  .result-warnings,
  .legal-note {
    grid-column: 1 / -1;
  }

  .break-even-panel,
  .owner-panel,
  .cash-panel,
  .internal-analysis {
    margin-top: 0;
  }

  .cash-panel,
  .internal-analysis {
    grid-column: 1 / -1;
  }

  .save-status {
    display: none;
  }
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand-divider,
  .eyebrow {
    display: none;
  }

  .brand-logo {
    width: 88px;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .toolbar-actions::-webkit-scrollbar,
  .chapter-rail::-webkit-scrollbar {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .chapter-rail {
    position: sticky;
    z-index: 20;
    top: 0;
    min-height: auto;
    padding: 8px 14px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 249, 250, 0.97);
    backdrop-filter: blur(10px);
    scrollbar-width: none;
  }

  .rail-label,
  .rail-progress,
  .danger-action,
  .chapter-button small {
    display: none;
  }

  .chapter-rail ol {
    width: max-content;
    display: flex;
    gap: 5px;
    margin: 0;
  }

  .chapter-rail li + li {
    margin: 0;
  }

  .chapter-button {
    width: auto;
    min-height: 48px;
    grid-template-columns: 24px auto;
    gap: 7px;
    padding: 7px 10px;
  }

  .chapter-button::before {
    top: auto;
    right: 8px;
    bottom: -8px;
    left: 8px;
    width: auto;
    height: 3px;
  }

  .chapter-number {
    width: 24px;
    height: 24px;
  }

  .workspace {
    padding: 24px 18px 48px;
  }

  .result-rail {
    display: block;
    padding: 24px 18px 40px;
    scroll-margin-top: 64px;
  }

  .break-even-panel,
  .owner-panel,
  .cash-panel,
  .internal-analysis {
    margin-top: 14px;
  }
}

@media (max-width: 680px) {
  .toolbar-actions .button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 11px;
    font-size: 12px;
  }

  .brand-block h1 {
    font-size: 17px;
  }

  .section-heading {
    display: block;
  }

  .draft-chip,
  .share-total,
  .fee-total {
    display: inline-block;
    margin-top: 14px;
  }

  .section-heading h2 {
    font-size: 29px;
  }

  .form-grid-2,
  .form-grid-3,
  .choice-grid,
  .budget-columns {
    grid-template-columns: 1fr;
  }

  .merch-head {
    display: none;
  }

  .merch-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .merch-name {
    grid-column: 1 / -1;
  }

  .merch-row output {
    grid-column: 1 / -1;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
  }

  .merch-row output::before {
    content: "Contribución mensual: ";
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
  }

  .preset-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .service-row {
    grid-template-columns: 20px minmax(0, 1fr) 50px;
  }

  .section-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .section-footer .button {
    width: 100%;
  }

  .field-group-accent,
  .budget-group,
  .financing-group {
    padding: 15px !important;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  :root {
    --ink: #111318;
    --text: #343840;
    --line: #cfd4d8;
    --line-strong: #afb7bd;
  }

  html,
  body {
    background: white !important;
    font-size: 10.5pt;
  }

  .topbar,
  .chapter-rail,
  .section-footer,
  .internal-only,
  .preset-row,
  .advanced-box,
  .info-dot,
  .confirm-dialog,
  .tooltip,
  .result-warnings {
    display: none !important;
  }

  .print-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 8mm;
    border-bottom: 1.5pt solid var(--ink);
  }

  .print-heading img {
    width: 34mm;
    height: auto;
  }

  .print-heading div {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }

  .print-heading strong {
    font-size: 16pt;
  }

  .print-heading span {
    color: var(--text);
  }

  .app-shell {
    display: block;
    width: auto;
    min-height: 0;
  }

  .workspace,
  .result-rail {
    padding: 0;
    background: white;
    border: 0;
  }

  .worksheet,
  .worksheet[hidden] {
    display: block !important;
    max-width: none;
    padding: 9mm 0 0;
    break-before: page;
  }

  .worksheet:first-child {
    break-before: auto;
  }

  .section-heading h2 {
    font-size: 19pt;
  }

  .draft-chip,
  .share-total,
  .fee-total {
    border-radius: 3px;
  }

  .field input,
  .field textarea,
  .compact-field input {
    min-height: 0;
    padding: 4px 0;
    border-width: 0 0 1px;
    border-radius: 0;
    background: transparent !important;
    color: black;
    box-shadow: none !important;
  }

  .input-unit em {
    right: 0;
  }

  .choice-card,
  .callout,
  .field-group-accent,
  .budget-group,
  .financing-group {
    break-inside: avoid;
    box-shadow: none;
  }

  .result-rail {
    display: block;
    margin-top: 10mm;
    break-before: page;
  }

  .scenario-control {
    display: none;
  }

  .hero-result,
  .pnl-list,
  .break-even-panel,
  .owner-panel,
  .cash-panel {
    break-inside: avoid;
  }

  .hero-result > strong {
    font-size: 34pt;
  }

  .legal-note {
    display: block !important;
  }
}

/* Bilingual personal invitations; inherits the existing MIDIA visual system. */
.language-picker { display:flex; gap:8px; align-items:center; font-size:13px; }
.language-picker select { padding:8px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); }
.invitation-gate { max-width:600px; margin:48px auto; padding:28px; background:var(--surface); border:1px solid var(--line); border-radius:12px; }
.invitation-gate h1 { font-size:28px; }
.invitation-gate input { margin:14px 0; max-width:220px; }
.invitation-actions,.submission-message { max-width:900px; margin:24px auto; padding:20px; background:var(--brand-soft); border-radius:12px; }
.invitation-actions>div {display:flex; flex-wrap:wrap; gap:12px; margin-top:16px;}
.personal-invitation .internal-only,.personal-invitation #importButton,.personal-invitation #resetButton,.personal-invitation #exportButton {display:none!important;}
.invitation-locked .app-shell,.invitation-locked .invitation-actions,.invitation-locked .print-heading {display:none!important;}
html[lang="zh-CN"] {--font:"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",sans-serif;}
html[lang="zh-CN"] .service-copy small {line-height:1.65;}
@media(max-width:600px){.language-picker{flex-wrap:wrap}.invitation-gate{margin:24px 12px}.invitation-actions,.submission-message{margin:20px 12px}.invitation-actions button{width:100%;justify-content:center}}
@media print{.invitation-actions,.language-picker,.invitation-gate,.submission-message{display:none!important;}}

@media(max-width:860px){html[lang="zh-CN"] .merch-row output::before {content:"月度毛利贡献：";}}

.store-switcher,.stores-summary{padding:24px;border-bottom:1px solid var(--line,#dfe4e8)}
.store-switcher label{display:block;font-weight:600;margin-bottom:8px}
.store-switcher select{width:100%;min-height:44px;font:inherit;padding:10px;border:1px solid #c8d0d6;border-radius:8px;background:#fff}
.store-switcher p,.stores-summary p{color:var(--muted,#6b7280);font-size:14px}
.stores-summary h2{font-size:22px;margin:0 0 14px}.stores-table{overflow-x:auto;margin:16px 0}
.stores-table table{width:100%;border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}
.stores-table th,.stores-table td{padding:12px 8px;border-bottom:1px solid #dfe4e8;text-align:right;vertical-align:top}
.stores-table th:first-child{text-align:left;min-width:130px}.stores-table tfoot{font-weight:700;background:#e6faf7}
.store-link{font:inherit;color:#075a5f;text-decoration:underline;cursor:pointer;border:0;background:none;text-align:left;min-height:44px}
.section-footer{flex-wrap:wrap;gap:10px}
@media print{.store-switcher{display:none}.stores-summary [data-add-store]{display:none}.stores-table{overflow:visible}}
.store-switcher [hidden],.stores-summary [hidden],button[data-add-store][hidden]{display:none!important}
