:root {
  color-scheme: light;
  --ink: #172a28;
  --ink-soft: #50625d;
  --paper: #f3f3eb;
  --paper-bright: #fcfcf8;
  --line: #d7ddd3;
  --line-strong: #bcc8bb;
  --moss: #24584d;
  --moss-dark: #173c35;
  --lime: #d6f06a;
  --lime-dark: #bbd94e;
  --rust: #a94e34;
  --blue-grey: #e7ece5;
  --shadow: 0 20px 60px rgb(24 42 39 / 8%);
  font-family: Inter, "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #89a928; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header { min-height: 46px; display: flex; align-items: center; gap: 16px; padding: 0 max(18px, calc((100vw - 1440px) / 2)); color: #f4f6ef; background: var(--ink); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 19px; font-weight: 800; letter-spacing: -.06em; }
.wordmark-icon, .brand-mark { display: grid; place-items: center; color: var(--ink); background: var(--lime); font-weight: 900; }
.wordmark-icon { width: 25px; height: 25px; border-radius: 7px 7px 7px 2px; font-size: 15px; }
.wordmark-dot { color: var(--lime); }
.header-tabs { display: flex; align-items: center; gap: 2px; margin-right: auto; }
.tab-button { min-height: 30px; padding: 0 14px; border: 0; border-radius: 4px; color: #aab8a9; background: transparent; cursor: pointer; font-size: 12px; font-weight: 750; }
.tab-button:hover { color: #f0f2eb; background: rgb(255 255 255 / 10%); }
.tab-button.is-active { color: var(--ink); background: var(--lime); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions form { margin: 0; }
.session-label input { width: 125px; border: 0; border-bottom: 1px solid #566760; border-radius: 0; padding: 5px 4px; color: #f4f6ef; background: transparent; font-size: 11px; }
.session-label input::placeholder { color: #aab8a9; }
.icon-button { min-height: 29px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid #52635b; border-radius: 4px; color: #f4f6ef; background: transparent; cursor: pointer; font-size: 11px; }
.icon-button:hover { border-color: var(--lime); color: var(--lime); }

.page-shell { width: min(1440px, 100% - 56px); margin: 0 auto; padding-top: 24px; }

.workspace-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 16px; padding: 17px 20px; border: 1px solid var(--line); background: var(--paper-bright); }
.scenario-picker { display: grid; grid-template-columns: auto minmax(190px, 330px); align-items: center; gap: 8px 14px; }
.scenario-picker .eyebrow { grid-column: 1 / -1; color: var(--ink-soft); }
.scenario-picker select, .scenario-picker input { min-width: 220px; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; padding: 8px 26px 8px 2px; color: var(--ink); background: transparent; font-weight: 700; }
.scenario-picker input { grid-column: 2; margin-top: -8px; padding-left: 2px; font-size: 11px; font-weight: 500; }
.save-status { align-self: center; color: #698076; font-size: 11px; }
.save-status.saving { color: #946316; }
.save-status.error { color: #a33d31; }
.toolbar-actions, .panel-actions { display: flex; align-items: center; gap: 8px; }
.button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 15px; border: 1px solid transparent; border-radius: 3px; cursor: pointer; font-size: 12px; font-weight: 700; transition: background .16s ease, color .16s ease, border .16s ease; }
.button-primary { color: var(--ink); background: var(--lime); }
.button-primary:hover { background: var(--lime-dark); }
.button-quiet { border-color: var(--line); background: transparent; }
.button-quiet:hover { border-color: var(--moss); background: var(--blue-grey); }
.button-danger { color: #8a4034; }

.utility-panel { margin-top: 14px; padding: 22px; border: 1px solid var(--line-strong); background: var(--paper-bright); box-shadow: var(--shadow); }
.utility-panel:first-child { margin-top: 0; }
.utility-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.utility-panel-heading .eyebrow { margin-bottom: 5px; color: var(--moss); }
.utility-panel h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -.035em; }
.utility-panel > p { max-width: 760px; margin: 12px 0 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.close-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 22px; }
.utility-panel textarea { width: 100%; min-height: 75px; resize: vertical; padding: 12px; border: 1px solid var(--line); background: #f5f6f0; font: 12px/1.5 ui-monospace, "SFMono-Regular", Consolas, monospace; }
.panel-actions { margin-top: 10px; }
.inline-message { min-height: 18px; margin: 10px 0 0 !important; color: var(--moss); font-size: 12px !important; }
.history-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.history-controls > label:not(.file-picker) { display: grid; gap: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.history-controls select { min-width: 155px; min-height: 39px; border: 1px solid var(--line); border-radius: 3px; padding: 0 9px; color: var(--ink); background: white; }
.file-picker { min-height: 39px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; font-size: 12px; font-weight: 700; }
.file-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.history-preview { margin-top: 16px; color: var(--ink-soft); font-size: 12px; }
.history-group-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 5px 14px; margin-top: 10px; }
.history-group-list span { display: flex; justify-content: space-between; gap: 10px; padding: 7px 9px; background: #f2f3ec; }
.history-group-list b { color: var(--ink); }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 18px 0 42px; }
.summary-card { min-width: 0; padding: 17px 18px 15px; border: 1px solid var(--line); background: var(--paper-bright); }
.summary-card-top { display: flex; align-items: center; gap: 9px; }
.car-marker { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: var(--moss-dark); background: #e5edce; font-size: 9px; font-weight: 800; }
.summary-name { overflow: hidden; font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.summary-label { margin: 18px 0 4px; color: var(--ink-soft); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.summary-value { margin: 0; font-variant-numeric: tabular-nums; font-size: clamp(25px, 3vw, 34px); font-weight: 700; letter-spacing: -.055em; }
.comparison-track { height: 4px; overflow: hidden; margin: 13px 0 9px; background: #e7eae1; }
.comparison-track progress { display: block; width: 100%; height: 100%; border: 0; appearance: none; background: transparent; }
.comparison-track progress::-webkit-progress-bar { background: transparent; }
.comparison-track progress::-webkit-progress-value { background: var(--moss); }
.comparison-track progress::-moz-progress-bar { background: var(--moss); }
.summary-card-bottom, .capital-line { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: 10px; font-variant-numeric: tabular-nums; }
.capital-line { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.capital-line strong { color: var(--moss); font-weight: 750; }
.tab-panel { min-width: 0; }
.key-table-section { margin: 12px 0 42px; }
.key-table-scroll { overflow-x: auto; border: 1px solid var(--line-strong); background: var(--paper-bright); box-shadow: var(--shadow); }
.key-table { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.key-table th, .key-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.key-table th:last-child, .key-table td:last-child { border-right: 0; }
.key-table thead th { color: #f5f7ef; background: var(--ink); text-align: left; }
.key-table thead th:not(:first-child) { text-align: right; }
.key-table thead .car-marker { display: inline-grid; margin-right: 7px; color: var(--moss-dark); background: var(--lime); vertical-align: middle; }
.key-table tbody th { width: 250px; color: var(--ink); background: #f8f9f3; text-align: left; }
.key-table tbody th span, .key-table tbody th small { display: block; }
.key-table tbody th small { margin-top: 2px; color: #7c8a7f; font-size: 9px; font-weight: 500; }
.key-table tbody tr:nth-child(even) td { background: #f8f9f3; }
.key-table tbody tr:nth-child(3) td, .key-table tbody tr:nth-child(4) td { color: var(--moss); font-size: 13px; font-weight: 800; }

.table-section { margin-bottom: 42px; }
.table-heading-row { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 14px; }
.table-heading-row .eyebrow { margin-bottom: 5px; color: var(--moss); }
.table-heading-row h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.table-hint { max-width: 370px; margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.table-hint strong { color: var(--moss); }
.table-wrap { width: 100%; border: 1px solid var(--line-strong); background: var(--paper-bright); box-shadow: var(--shadow); }
.calculator-table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12px; }
.calculator-table th, .calculator-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calculator-table th:last-child, .calculator-table td:last-child { border-right: 0; }
.calculator-table thead th { position: sticky; z-index: 4; top: 0; height: 59px; padding: 8px 12px; color: #f5f7ef; background: var(--ink); text-align: left; }
.calculator-table thead .parameter-heading { position: sticky; z-index: 6; left: 0; width: 190px; color: #aebbb0; font-size: 9px; letter-spacing: .13em; }
.calculator-table .car-heading { width: 210px; }
.car-heading-inner { min-width: 0; display: flex; align-items: center; gap: 8px; }
.car-heading-name { min-width: 0; overflow: hidden; flex: 1; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.remove-car { width: 24px; height: 24px; border: 1px solid #54635c; border-radius: 50%; color: #d3dbd1; background: transparent; cursor: pointer; font-size: 17px; line-height: 1; }
.remove-car:hover { border-color: #eb9b7f; color: #ffad8e; }
.calculator-table .add-car-heading { width: 72px; padding: 4px; text-align: center; }
.add-car-button { width: 32px; height: 32px; border: 1px solid var(--lime); border-radius: 50%; color: var(--ink); background: var(--lime); cursor: pointer; font-size: 22px; line-height: 1; }
.add-car-button:hover { background: var(--lime-dark); }
.add-car-heading small { display: block; margin-top: 2px; color: #b5c1b3; font-size: 8px; letter-spacing: .08em; }
.calculator-table tbody th.field-heading { position: sticky; z-index: 2; left: 0; width: 190px; padding: 8px 11px; background: #f8f9f3; text-align: left; vertical-align: top; }
.calculator-table tbody td { width: 210px; height: 40px; padding: 5px 9px; background: var(--paper-bright); vertical-align: middle; }
.calculator-table tbody td.add-car-space { width: 72px; background: #f8f9f3; }
.field-name { display: block; font-size: 11px; font-weight: 700; }
.field-unit { display: block; margin-top: 2px; color: #7c8a7f; font-size: 9px; font-weight: 500; }
.group-row th { position: sticky; z-index: 3; left: 0; padding: 9px 12px; color: #f2f5ec; background: var(--moss); text-align: left; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.result-group th { background: #8b9c82; color: var(--ink); }
.cell-input { width: 100%; min-height: 31px; border: 1px solid #e0e5dc; border-radius: 2px; padding: 5px 7px; color: var(--ink); background: #fff; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.cell-input:hover { border-color: #a9b7a7; }
.cell-input:focus { border-color: var(--moss); }
.cell-input.text-input { text-align: left; font-weight: 650; }
.sync-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; margin-top: 6px; }
.sync-input { width: 100%; min-width: 0; height: 25px; border: 1px dashed #adb99f; border-radius: 2px; padding: 3px 5px; background: #f5f7ed; font-size: 10px; text-align: right; }
.sync-input::placeholder { color: #89977c; }
.sync-button { border: 0; padding: 0 5px; color: var(--moss); background: #e8eedb; cursor: pointer; font-size: 9px; font-weight: 750; }
.sync-button:hover { background: var(--lime); }
.result-row .field-heading { background: #f0f2e8 !important; }
.result-row td.result-cell { color: #314a3e; background: #f8f9f3; font-variant-numeric: tabular-nums; text-align: right; }
.result-row.major-result th, .result-row.major-result td { color: var(--ink); background: #e8efd7 !important; font-weight: 800; }
.history-row td { color: #5e7469; background: #f6f7f1; font-size: 10px; }
.history-cell { display: grid; gap: 4px; }
.history-cell span { display: flex; justify-content: space-between; gap: 6px; }
.service-cell { min-width: 165px; }
.service-summary { display: grid; gap: 6px; }
.service-summary-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; color: var(--ink-soft); font-size: 9px; }
.service-summary-row .unit { color: #819084; }
.service-summary-row input { width: 100%; grid-column: 1 / -1; }
.service-summary small { color: var(--moss); font-size: 9px; font-weight: 700; }
.service-details { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.service-details summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--moss); font-size: 10px; font-weight: 750; }
.service-details summary::-webkit-details-marker { display: none; }
.service-details summary::before { content: "+"; display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--moss); font-size: 11px; font-weight: 700; }
.service-details[open] summary::before { content: "−"; }
.service-inputs { display: grid; gap: 9px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.service-visit-list { display: grid; gap: 5px; }
.visit-field { display: grid; grid-template-columns: 1fr 70px; gap: 6px; align-items: center; font-size: 9px; }
.visit-field > span { color: var(--ink-soft); }
.visit-field small { display: block; margin-top: 2px; color: #93a092; font-size: 8px; }
.visit-field input::placeholder { color: #afb9ad; }
.table-footer { display: flex; align-items: center; gap: 7px; padding: 10px 2px; color: var(--ink-soft); font-size: 10px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; margin-left: 9px; border-radius: 50%; }
.legend-dot:first-child { margin-left: 0; }
.input-dot { background: var(--moss); }
.result-dot { background: var(--lime-dark); }
.legend-note { margin-left: auto; }
.mobile-hint { display: none; }

.method-note { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 20px; margin: 0 0 48px; padding: 18px 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.method-index { color: var(--moss); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.method-note p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.method-note strong { color: var(--ink); }
.site-footer { display: flex; justify-content: space-between; padding: 0 0 22px; color: #819087; font-size: 9px; font-weight: 750; letter-spacing: .12em; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; color: #f4f6ef; background: var(--ink); }
.login-card { width: min(440px, 100%); padding: clamp(26px, 6vw, 54px); border: 1px solid #3c514a; background: #203a34; box-shadow: 0 35px 90px rgb(0 0 0 / 20%); }
.brand-mark { width: 40px; height: 40px; margin-bottom: 25px; border-radius: 12px 12px 12px 3px; font-size: 24px; }
.login-card .eyebrow { margin-bottom: 12px; color: var(--lime); }
.login-card h1 { font-size: clamp(40px, 12vw, 56px); }
.login-card h1 em { color: var(--lime); }
.login-copy { margin: 17px 0 27px; color: #becbc0; font-family: Georgia, serif; font-size: 16px; line-height: 1.5; }
.login-form { display: grid; gap: 9px; }
.login-form label { color: #c1cec2; font-size: 11px; font-weight: 700; }
.login-form input[type="password"] { height: 45px; border: 1px solid #586d63; border-radius: 3px; padding: 0 12px; color: #f4f6ef; background: #172a28; }
.login-form .button { margin-top: 8px; }
.login-footnote { margin: 22px 0 0; color: #9bab9f; font-size: 10px; line-height: 3px; }
.form-error { padding: 10px 12px; border-left: 3px solid #eb9b7f; color: #ffd3c2; background: #713e35; font-size: 12px; }

@media (max-width: 900px) {
  .site-header { gap: 12px; padding: 0 20px; }
  .header-tabs { gap: 0; }
  .tab-button { padding: 0 10px; font-size: 11px; }
  .session-label input { width: 95px; }
  .page-shell { width: calc(100% - 40px); padding-top: 18px; }
  .workspace-toolbar { gap: 16px; }
  .calculator-table thead .parameter-heading, .calculator-table tbody th.field-heading { width: 170px; }
  .calculator-table .car-heading, .calculator-table tbody td { width: 190px; }
  .method-note { grid-template-columns: 70px 1fr; }
  .method-note p:last-child { grid-column: 2; }
}

@media (max-width: 620px) {
  .site-header { min-height: 42px; gap: 8px; padding: 0 14px; }
  .wordmark { font-size: 17px; }
  .wordmark-icon { width: 28px; height: 28px; }
  .header-tabs { gap: 0; }
  .tab-button { min-height: 26px; padding: 0 8px; font-size: 11px; }
  .header-actions { gap: 5px; }
  .header-actions .icon-button { width: 30px; min-height: 27px; justify-content: center; padding: 0; font-size: 12px; }
  .header-actions .icon-button span { display: none; }
  .session-label input { width: 75px; font-size: 10px; }
  .page-shell { width: calc(100% - 28px); padding-top: 16px; }
  .workspace-toolbar { align-items: stretch; flex-direction: column; gap: 12px; padding: 13px; }
  .scenario-picker { grid-template-columns: 1fr; gap: 6px; }
  .scenario-picker select { width: 100%; min-width: 0; }
  .save-status { font-size: 10px; }
  .toolbar-actions { justify-content: space-between; }
  .toolbar-actions .button { flex: 1; }
  .utility-panel { padding: 16px 13px; }
  .utility-panel h2 { font-size: 20px; }
  .panel-actions { align-items: stretch; flex-wrap: wrap; }
  .panel-actions .button { flex: 1 1 42%; }
  .history-controls { align-items: stretch; flex-direction: column; }
  .history-controls > *, .history-controls select { width: 100%; }
  .file-picker { justify-content: center; }
  .summary-grid { grid-template-columns: 1fr; gap: 8px; margin: 13px 0 32px; }
  .summary-card { padding: 13px 14px; }
  .summary-label { margin-top: 12px; }
  .summary-value { font-size: 31px; }
  .table-heading-row { align-items: start; flex-direction: column; gap: 8px; }
  .table-hint { font-size: 10px; }
  .calculator-table { min-width: 760px; font-size: 11px; }
  .calculator-table thead th { height: 53px; }
  .calculator-table thead .parameter-heading, .calculator-table tbody th.field-heading { width: 150px; }
  .calculator-table .car-heading, .calculator-table tbody td { width: 175px; }
  .calculator-table .add-car-heading, .calculator-table tbody td.add-car-space { width: 58px; }
  .calculator-table tbody th.field-heading { padding: 7px 8px; }
  .field-name { font-size: 10px; }
  .sync-control { grid-template-columns: 1fr; }
  .sync-button { min-height: 22px; }
  .mobile-hint { display: block; padding: 7px 0 0; color: #819087; font-size: 9px; }
  .legend-note { display: none; }
  .method-note { grid-template-columns: 1fr; gap: 8px; margin-bottom: 32px; }
  .method-note p:last-child { grid-column: auto; }
}
