:root {
  color-scheme: light;
  --color-bg: #f3f6f4;
  --color-surface: #fff;
  --color-surface-soft: #eaf1ed;
  --color-text: #17251f;
  --color-muted: #617169;
  --color-primary: #176b4d;
  --color-primary-dark: #0d4b35;
  --color-accent: #d7a83d;
  --color-border: #d8e2dd;
  --color-info: #e6f0fa;
  --shadow: 0 14px 38px rgb(22 53 40 / 8%);
  --radius-large: 1.35rem;
  --radius-medium: 0.9rem;
  --container: 76rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 20rem; margin: 0; color: var(--color-text); background: var(--color-bg); line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid #b7830d; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.15; }
h1 { margin-bottom: 0.35rem; font-size: clamp(1.35rem, 3vw, 1.8rem); letter-spacing: -0.035em; }
h2 { margin-bottom: 0.55rem; font-size: clamp(1.65rem, 4vw, 2.4rem); letter-spacing: -0.035em; }
h3 { margin-bottom: 0.45rem; font-size: 1.05rem; }
.container { width: min(calc(100% - 2rem), var(--container)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted, .page-heading p, .card p, .table-toolbar p { color: var(--color-muted); }

.skip-link { position: fixed; z-index: 50; top: 0.75rem; left: 0.75rem; padding: 0.7rem 1rem; color: #fff; background: var(--color-primary-dark); border-radius: 0.5rem; transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }

.app-header { padding: 1.25rem 0; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.header-content, .brand-block, .header-actions, .page-heading, .card-heading, .table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.brand-block { justify-content: flex-start; }
.brand-mark { display: grid; width: 2.8rem; height: 2.8rem; flex: 0 0 auto; place-items: center; color: #fff; background: var(--color-primary); border-radius: 0.8rem; font-size: 1.2rem; font-weight: 900; }
.header-description { margin-bottom: 0; color: var(--color-muted); font-size: 0.88rem; }
.header-scenario-select { display: grid; width: 16rem; min-width: 0; gap: 0.2rem; }
.header-scenario-select label { color: var(--color-muted); font-size: 0.68rem; font-weight: 750; }
.header-scenario-select select { width: 100%; min-height: 2.55rem; padding: 0.45rem 2rem 0.45rem 0.65rem; color: var(--color-text); background: #fff; border: 1px solid var(--color-border); border-radius: 0.65rem; }
.eyebrow { margin-bottom: 0.35rem; color: var(--color-primary); font-size: 0.69rem; font-weight: 850; letter-spacing: 0.13em; text-transform: uppercase; }
.scenario-status, .app-ready, .badge { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 0.5rem; padding: 0.45rem 0.7rem; color: var(--color-muted); background: var(--color-surface-soft); border: 1px solid transparent; border-radius: 999px; font-size: 0.76rem; font-weight: 750; }
.status-dot { width: 0.5rem; height: 0.5rem; background: var(--color-accent); border-radius: 50%; }
.scenario-status[data-state="invalid"] { color: #75241f; background: #fae9e7; border-color: #e8c0bc; }
.scenario-status[data-state="invalid"] .status-dot { background: #a23a33; }
.scenario-status[data-state="saved"] .status-dot { background: var(--color-primary); }

.button { min-height: 2.55rem; padding: 0.58rem 0.9rem; border: 1px solid transparent; border-radius: 0.65rem; font-weight: 750; cursor: pointer; }
.button-primary { color: #fff; background: var(--color-primary); }
.button-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.button-secondary { color: var(--color-primary-dark); background: var(--color-surface); border-color: var(--color-border); }
.button-danger { color: #812a25; background: #fff; border-color: #ddb8b4; }
.button-small { min-height: 2.2rem; padding: 0.4rem 0.7rem; font-size: 0.78rem; }
.button:disabled { color: #75827c; background: #e5eae7; border-color: #b9c3be; border-style: dashed; cursor: not-allowed; opacity: 1; }

.app-navigation { position: sticky; z-index: 20; top: 0; overflow-x: auto; background: rgb(255 255 255 / 94%); border-bottom: 1px solid var(--color-border); backdrop-filter: blur(12px); }
.tabs { display: flex; min-width: max-content; }
.tab { padding: 0.95rem 1rem; color: var(--color-muted); background: transparent; border: 0; border-bottom: 3px solid transparent; font-size: 0.86rem; font-weight: 750; cursor: pointer; }
.tab:first-child { padding-left: 0; }
.tab:hover, .tab:focus-visible, .tab.is-active { color: var(--color-primary-dark); border-bottom-color: var(--color-primary); }

.app-main { min-height: 65vh; padding-block: clamp(2rem, 5vw, 3.5rem) 5rem; }
.tab-panel { display: grid; gap: 1.5rem; }
.tab-panel[hidden] { display: none; }
.page-heading { align-items: flex-end; }
.page-heading p { max-width: 46rem; margin-bottom: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric-card, .card, .table-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-medium); box-shadow: 0 6px 20px rgb(22 53 40 / 4%); }
.metric-card { display: grid; gap: 0.3rem; min-height: 9.5rem; padding: 1.15rem; }
.metric-card strong { align-self: end; font-size: 1.8rem; letter-spacing: -0.04em; }
.metric-card small, .metric-label { color: var(--color-muted); }
.metric-label { font-size: 0.78rem; font-weight: 750; }
.metric-card.is-positive { border-color: #8fc4aa; background: #f6fbf8; }
.metric-card.is-negative { border-color: #d7aaa6; background: #fff9f8; }
.metric-card.is-warning { border-color: #d9c083; background: #fffcf3; }
.metric-card.is-negative strong { color: #8a2924; }
.metric-card.is-positive strong { color: var(--color-primary-dark); }
.content-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 1rem; }
.card { padding: 1.35rem; }
.card p:last-child { margin-bottom: 0; }
.card-wide { min-height: 18rem; }
.card-heading { align-items: flex-start; }
.empty-state { display: grid; min-height: 11rem; place-content: center; color: var(--color-muted); text-align: center; }
.empty-state span { color: var(--color-primary); font-size: 2rem; }
.empty-section { display: flex; align-items: center; gap: 1rem; min-height: 11rem; }
.section-icon { display: grid; width: 3.5rem; height: 3.5rem; flex: 0 0 auto; place-items: center; color: var(--color-primary); background: var(--color-surface-soft); border-radius: 50%; font-weight: 850; }

.table-card { overflow: hidden; }
.table-toolbar { padding: 1.2rem; }
.table-toolbar p { margin-bottom: 0; font-size: 0.88rem; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--color-border); }
table { width: 100%; min-width: 46rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 0.85rem 1rem; text-align: right; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
th { color: var(--color-muted); background: var(--color-surface-soft); font-size: 0.75rem; letter-spacing: 0.02em; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
.dre-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.view-switch { margin: 0; padding: 0; border: 0; }
.view-switch legend { margin-bottom: 0.4rem; font-size: 0.78rem; font-weight: 750; }
.view-switch > div { display: inline-flex; padding: 0.2rem; background: var(--color-surface-soft); border-radius: 0.65rem; }
.view-option { min-height: 2.35rem; padding: 0.45rem 0.8rem; color: var(--color-muted); background: transparent; border: 0; border-radius: 0.5rem; font-weight: 750; cursor: pointer; }
.view-option.is-active { color: #fff; background: var(--color-primary); }
.view-option:disabled { color: #77837d; background: #dce3df; cursor: not-allowed; text-decoration: line-through; }
.compact-field { width: min(14rem, 100%); }
.dre-table { min-width: max-content; }
.dre-table th, .dre-table td { min-width: 9rem; }
.dre-table thead th:first-child, .dre-table tbody th { position: sticky; z-index: 2; left: 0; min-width: 15rem; text-align: left; }
.dre-table thead th:first-child { z-index: 3; background: var(--color-surface-soft); }
.dre-table tbody th { background: var(--color-surface); }
.dre-line-expense th { padding-left: 1.5rem; color: var(--color-muted); font-weight: 600; }
.dre-line-subtotal th, .dre-line-subtotal td { background-color: #f4f8f6; border-top: 1px solid #bfcfc7; font-weight: 750; }
.dre-line-subtotal th { background: #f4f8f6; }
.dre-line-result th, .dre-line-result td { color: var(--color-primary-dark); background: #e5f0eb; border-top: 2px solid var(--color-primary); font-weight: 850; }
.dre-line-result th { background: #e5f0eb; }
.value-negative { color: #8a2924; }
.cash-flow-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.cash-flow-table { min-width: 78rem; }
.cash-flow-table tbody tr:first-child { background: #f4f8f6; font-weight: 750; }
.cash-flow-table .cash-flow-net, .cash-flow-table .cash-flow-present { font-weight: 750; }
.cash-flow-table .cash-flow-cumulative { background: #f8faf9; }
.cash-flow-table .payback-balance { color: var(--color-primary-dark); background: #e5f0eb; font-weight: 800; }
.dashboard-toolbar, .dashboard-analysis { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dashboard-toolbar p { max-width: 42rem; margin: 0; }
.dashboard-summary .metric-card { min-height: 7.8rem; }
.dashboard-summary .metric-card strong { overflow-wrap: anywhere; font-size: clamp(1.15rem, 2.2vw, 1.55rem); }
.dashboard-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart-card { min-width: 0; }
.chart-area { min-height: 16rem; margin-top: 1rem; overflow: hidden; }
.chart-area svg { display: block; width: 100%; height: auto; min-height: 14rem; }
.chart-empty { display: grid; min-height: 14rem; place-items: center; color: var(--color-muted); text-align: center; }
.chart-grid-line { stroke: #d8e2dd; stroke-width: 1; }
.chart-zero-line { stroke: #718078; stroke-width: 1.5; }
.chart-bar-positive { fill: #2b8463; }
.chart-bar-negative { fill: #b75b53; }
.chart-balance-line { fill: none; stroke: var(--color-primary); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.chart-payback-point { fill: var(--color-accent); stroke: #72591b; stroke-width: 2; }
.chart-label { fill: #617169; font-size: 11px; }
.dashboard-analysis { align-items: flex-start; }
.dashboard-analysis p { max-width: 52rem; }
.dashboard-disclaimer { margin: 0; color: var(--color-muted); font-size: 0.78rem; text-align: center; }
.scenario-list-heading, .scenario-row, .scenario-row-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.scenario-list-heading p { margin: 0; }
.scenario-list { display: grid; gap: 0.8rem; }
.scenario-row { padding: 1rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-medium); box-shadow: 0 6px 20px rgb(22 53 40 / 4%); }
.scenario-row.is-current { border-color: var(--color-primary); box-shadow: 0 0 0 2px rgb(23 107 77 / 12%); }
.scenario-row-main { display: grid; flex: 1 1 20rem; gap: 0.35rem; }
.scenario-row-main label { font-size: 0.75rem; font-weight: 750; }
.scenario-row-main input { width: min(28rem, 100%); min-height: 2.55rem; padding: 0.55rem 0.7rem; border: 1px solid #b9c9c1; border-radius: 0.6rem; }
.scenario-row-meta { margin: 0; color: var(--color-muted); font-size: 0.75rem; }
.scenario-row-actions { flex-wrap: wrap; justify-content: flex-end; }

.app-dialog { width: min(32rem, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 1rem; box-shadow: 0 1.5rem 4rem rgba(22, 34, 29, 0.28); color: var(--color-text); }
.app-dialog::backdrop { background: rgba(17, 29, 24, 0.58); }
.app-dialog form { display: grid; gap: 1rem; padding: 1.5rem; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin: 0; }
.dialog-close { width: 2.5rem; height: 2.5rem; border: 1px solid var(--color-border); border-radius: 50%; background: #fff; color: var(--color-text); font-size: 1.5rem; cursor: pointer; }
.export-scenario-name { margin: 0; padding: 0.75rem 1rem; border-radius: 0.65rem; background: var(--color-surface-soft); font-weight: 700; overflow-wrap: anywhere; }
.dialog-actions { justify-content: flex-end; margin-top: 0.5rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
.comparison-controls { display: grid; grid-template-columns: minmax(15rem, 1fr) minmax(18rem, 2fr) minmax(12rem, 0.7fr); align-items: end; gap: 1rem; }
.comparison-controls p { margin-bottom: 0; }
.comparison-selection { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.comparison-option { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.65rem; background: var(--color-surface-soft); border: 1px solid var(--color-border); border-radius: 0.6rem; font-size: 0.78rem; cursor: pointer; }
.comparison-option:has(input:checked) { color: var(--color-primary-dark); border-color: var(--color-primary); }
.comparison-option input { accent-color: var(--color-primary); }
.comparison-table { min-width: max-content; }
.comparison-table th, .comparison-table td { min-width: 14rem; vertical-align: top; }
.comparison-table thead th:first-child, .comparison-table tbody th { position: sticky; z-index: 2; left: 0; min-width: 14rem; text-align: left; }
.comparison-table thead th:first-child { z-index: 3; background: var(--color-surface-soft); }
.comparison-table tbody th { background: var(--color-surface); }
.comparison-value { display: block; color: var(--color-text); font-weight: 750; }
.comparison-difference { display: block; margin-top: 0.2rem; color: var(--color-muted); font-size: 0.72rem; }
.comparison-base-cell { background: #f4f8f6; }
.comparison-highlight { background: #fff8e7; box-shadow: inset 0 0 0 1px #dfc16e; }
.comparison-highlight-label { display: inline-flex; margin-top: 0.3rem; padding: 0.12rem 0.4rem; color: #6d5110; background: #f9e9b8; border-radius: 999px; font-size: 0.65rem; font-weight: 800; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.assumptions-form { display: grid; gap: 1rem; }
.form-section { min-width: 0; margin: 0; padding: 1.35rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-medium); box-shadow: 0 6px 20px rgb(22 53 40 / 4%); }
.form-section legend { padding: 0 0.45rem; font-size: 1rem; font-weight: 800; }
.schedule-heading, .operating-period-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.schedule-heading { margin-bottom: 1rem; }
.schedule-heading p, .operating-period-heading p { margin: 0; color: var(--color-muted); font-size: 0.82rem; }
.operating-schedule { display: grid; gap: 1rem; }
.operating-period { padding: 1rem; background: #f8faf9; border: 1px solid var(--color-border); border-radius: 0.75rem; }
.operating-period-heading { margin-bottom: 1rem; }
.operating-period-heading h3 { margin: 0.45rem 0 0.2rem; }
.operating-field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fixed-investment-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.asset-summary { margin: 0.8rem 0 0; color: var(--color-muted); font-size: 0.8rem; }
.field { display: grid; align-self: start; gap: 0.4rem; }
.field-span-2 { grid-column: 1 / -1; }
.field label, .field-label { font-size: 0.83rem; font-weight: 750; }
.field-label-row { position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 0.4rem; width: fit-content; max-width: 100%; }
.field-info { display: grid; width: 1.15rem; height: 1.15rem; flex: 0 0 auto; padding: 0; place-items: center; color: var(--color-primary-dark); background: var(--color-surface-soft); border: 1px solid #adc7ba; border-radius: 50%; font-size: 0.7rem; font-weight: 850; line-height: 1; cursor: help; }
.field-tooltip { position: absolute; z-index: 30; top: calc(100% + 0.5rem); left: 0; width: min(19rem, calc(100vw - 3rem)); padding: 0.7rem 0.8rem; color: #fff; background: var(--color-primary-dark); border-radius: 0.55rem; box-shadow: var(--shadow); font-size: 0.76rem; font-weight: 500; line-height: 1.45; opacity: 0; pointer-events: none; transform: translateY(-0.25rem); transition: opacity 120ms ease, transform 120ms ease; }
.field-tooltip::before { position: absolute; bottom: 100%; left: 0.65rem; width: 0; height: 0; border-right: 0.35rem solid transparent; border-bottom: 0.4rem solid var(--color-primary-dark); border-left: 0.35rem solid transparent; content: ""; }
.field-info:hover + .field-tooltip, .field-info:focus + .field-tooltip { opacity: 1; transform: translateY(0); }
.field input, .field select, .field textarea { width: 100%; min-height: 2.75rem; padding: 0.65rem 0.75rem; color: var(--color-text); background: #fff; border: 1px solid #b9c9c1; border-radius: 0.6rem; }
.field input:disabled, .field select:disabled, .field textarea:disabled,
.field input[readonly], .field textarea[readonly] { color: #59665f; background: #e8edeb; border-color: #a9b4ae; border-style: dashed; cursor: not-allowed; }
.field:has(input:disabled) label::after, .field:has(select:disabled) label::after,
.field:has(textarea:disabled) label::after, .field:has(input[readonly]) label::after,
.field:has(textarea[readonly]) label::after { display: inline-flex; margin-left: 0.45rem; padding: 0.12rem 0.42rem; color: #4f5d56; background: #e1e7e4; border: 1px solid #b5c0ba; border-radius: 999px; font-size: 0.65rem; font-weight: 750; vertical-align: middle; }
.field:has(input:disabled) label::after, .field:has(select:disabled) label::after,
.field:has(textarea:disabled) label::after { content: "Desabilitado"; }
.field:has(input[readonly]:not(:disabled)) label::after,
.field:has(textarea[readonly]:not(:disabled)) label::after { content: "Somente leitura"; }
.field textarea { resize: vertical; }
.input-with-prefix, .input-with-suffix { display: flex; align-items: stretch; overflow: hidden; background: var(--color-surface-soft); border: 1px solid #b9c9c1; border-radius: 0.6rem; }
.input-with-prefix > span, .input-with-suffix > span { display: grid; flex: 0 0 auto; place-items: center; padding: 0 0.7rem; color: var(--color-muted); font-size: 0.78rem; font-weight: 750; }
.input-with-prefix input, .input-with-suffix input { min-width: 0; border: 0; border-radius: 0; }
.input-with-prefix:has(input:disabled), .input-with-suffix:has(input:disabled),
.input-with-prefix:has(input[readonly]), .input-with-suffix:has(input[readonly]) { background: #dfe5e2; border-color: #a9b4ae; border-style: dashed; }
.input-with-prefix:focus-within, .input-with-suffix:focus-within { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.input-with-prefix input:focus-visible, .input-with-suffix input:focus-visible { outline: 0; }
.field [aria-invalid="true"] { border-color: #9d332d; background: #fff9f8; }
.input-with-prefix:has([aria-invalid="true"]), .input-with-suffix:has([aria-invalid="true"]) { border-color: #9d332d; }
.field-help, .field-error { margin: 0; font-size: 0.76rem; }
.field-error { color: #8a2924; }
.field-warning { margin: 0; color: #77540d; font-size: 0.76rem; }
.optional { color: var(--color-muted); font-weight: 500; }
.checkbox-field { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.85rem; background: var(--color-surface-soft); border-radius: 0.65rem; cursor: pointer; }
.checkbox-field input { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; margin-top: 0.18rem; accent-color: var(--color-primary); }
.checkbox-field:has(input:disabled) { color: #65716b; background: #e5eae7; border: 1px dashed #a9b4ae; cursor: not-allowed; }
.checkbox-field span { display: grid; gap: 0.15rem; }
.checkbox-field small { color: var(--color-muted); }
.switch-field { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem; background: var(--color-surface-soft); border-radius: 0.75rem; cursor: pointer; }
.switch-field > span:first-child { display: grid; gap: 0.15rem; }
.switch-field small { color: var(--color-muted); }
.switch-field input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.switch-control { position: relative; width: 2.8rem; height: 1.55rem; flex: 0 0 auto; background: #a9b8b0; border-radius: 999px; transition: background 150ms ease; }
.switch-control::after { position: absolute; top: 0.2rem; left: 0.2rem; width: 1.15rem; height: 1.15rem; background: #fff; border-radius: 50%; box-shadow: 0 2px 5px rgb(0 0 0 / 20%); content: ""; transition: transform 150ms ease; }
.switch-field input:checked + .switch-control { background: var(--color-primary); }
.switch-field input:checked + .switch-control::after { transform: translateX(1.25rem); }
.switch-field input:focus-visible + .switch-control { outline: 3px solid var(--color-accent); outline-offset: 3px; }
.conditional-fields { display: grid; gap: 1.2rem; margin-top: 1.25rem; }
.conditional-fields[hidden] { display: none; }
.choice-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-fieldset legend { margin-bottom: 0.55rem; padding: 0; font-size: 0.83rem; font-weight: 750; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.choice-card { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.85rem; background: #fff; border: 1px solid #b9c9c1; border-radius: 0.65rem; cursor: pointer; }
.choice-card:has(input:checked) { background: var(--color-surface-soft); border-color: var(--color-primary); }
.choice-card input { margin-top: 0.2rem; accent-color: var(--color-primary); }
.choice-card span { display: grid; gap: 0.1rem; }
.choice-card small { color: var(--color-muted); }
.financing-metrics .metric-card strong { overflow-wrap: anywhere; font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.35rem; }
.form-actions p { margin: 0; color: var(--color-muted); font-size: 0.8rem; }
.alert { display: flex; align-items: flex-start; gap: 0.7rem; padding: 1rem; border-radius: var(--radius-medium); }
.alert p { margin: 0; }
.alert-info { background: var(--color-info); border: 1px solid #c5dbef; }
.alert-success { background: #e6f3ec; border: 1px solid #bedccf; }
.alert-error { color: #75241f; background: #fae9e7; border: 1px solid #e8c0bc; }
.alert span { display: grid; width: 1.35rem; height: 1.35rem; flex: 0 0 auto; place-items: center; border: 1px solid currentcolor; border-radius: 50%; font-size: 0.75rem; font-weight: 850; }

.app-footer { padding: 1.5rem 0; color: var(--color-muted); background: var(--color-surface); border-top: 1px solid var(--color-border); font-size: 0.82rem; }
.app-footer p { margin-bottom: 0; }
.noscript-message { position: fixed; z-index: 60; right: 1rem; bottom: 1rem; left: 1rem; padding: 1rem; color: #fff; text-align: center; background: #7a302b; border-radius: 0.75rem; }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }

@media (max-width: 62rem) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-content { align-items: flex-start; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .operating-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fixed-investment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-charts { grid-template-columns: 1fr; }
}

@media (max-width: 46rem) {
  .header-content, .page-heading, .table-toolbar { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .content-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .schedule-heading { align-items: stretch; flex-direction: column; }
  .dre-toolbar { align-items: stretch; flex-direction: column; }
  .cash-flow-toolbar { align-items: stretch; flex-direction: column; }
  .dashboard-toolbar, .dashboard-analysis { align-items: stretch; flex-direction: column; }
  .scenario-list-heading, .scenario-row { align-items: stretch; flex-direction: column; }
  .scenario-row-actions { justify-content: flex-start; }
  .comparison-controls { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 34rem) {
  .container { width: min(calc(100% - 1.25rem), var(--container)); }
  .brand-mark { display: none; }
  .header-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-actions .header-scenario-select, .header-actions .scenario-status { grid-column: 1 / -1; width: 100%; }
  .header-scenario-select select { width: 100%; max-width: none; }
  .header-actions .button { width: 100%; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 7.5rem; }
  .empty-section { align-items: flex-start; }
  .operating-period-heading { flex-direction: column; }
  .operating-field-grid { grid-template-columns: 1fr; }
  .fixed-investment-grid { grid-template-columns: 1fr; }
}
