:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #17211b;
    background: #f3f6f2;
    line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }

.site-header {
    min-height: 70px;
    padding: 0 5vw;
    background: #173f31;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand { font-weight: 750; text-decoration: none; letter-spacing: -.02em; }
nav { display: flex; align-items: center; gap: 22px; }
nav a, .link-button { color: #fff; font: inherit; font-size: .94rem; text-decoration: none; }
nav form { margin: 0; }
.link-button { border: 0; padding: 0; background: transparent; cursor: pointer; }

.container { width: min(1040px, 90vw); margin: 54px auto; }
.auth-card, .card, .module {
    background: #fff;
    border: 1px solid #dce4dc;
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(32, 63, 48, .06);
}
.auth-card { width: min(480px, 100%); margin: 6vh auto; padding: 38px; }
.card { padding: 28px; margin-bottom: 22px; }
.module { padding: 22px; }
.module h2, .card h2 { margin-top: 0; font-size: 1.12rem; }

h1 { margin: 0 0 12px; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.05; letter-spacing: -.04em; }
.eyebrow { margin: 0 0 10px; color: #48705f; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.help { margin-top: 22px; color: #647067; font-size: .88rem; }

.stack { display: grid; gap: 9px; margin-top: 24px; }
.stack.compact { margin-top: 16px; }
.narrow { max-width: 480px; }
label { font-size: .9rem; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid #bac8bf;
    border-radius: 9px;
    padding: 12px 13px;
    margin-bottom: 9px;
    background: #fff;
    color: #17211b;
    font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(39, 113, 82, .2); border-color: #277152; }
button {
    width: fit-content;
    border: 1px solid #1f6749;
    border-radius: 9px;
    padding: 11px 17px;
    background: #1f6749;
    color: #fff;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}
button.secondary { background: #fff; color: #1f6749; }
button.danger { border-color: #9a3a30; background: #9a3a30; }
button:disabled { opacity: .55; cursor: not-allowed; }
details { margin-top: 24px; }
summary { cursor: pointer; color: #365e4d; }
.administrative-details { margin: 0 0 22px; padding: 14px 16px; border: 1px solid #dce4dc; border-radius: 10px; background: #f8faf8; }
.administrative-details summary { font-weight: 750; }
.administrative-details .field { margin-top: 16px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.status-pill { border-radius: 999px; padding: 7px 12px; background: #dff4e8; color: #16613f; font-size: .8rem; font-weight: 800; }
.status-pill.attention { background: #fff1cd; color: #785b0d; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.module-link { text-decoration: none; }
.module-link:hover { border-color: #9db8aa; transform: translateY(-1px); }
.lead { max-width: 720px; color: #59665e; }
.split-grid { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.5fr); gap: 22px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin-bottom: 18px; }
.field { min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field input, .field select { margin-bottom: 0; }
.field-help { display: block; margin-top: 5px; color: #69746d; font-size: .78rem; }
.checkbox-field { display: flex; align-items: center; gap: 9px; align-self: end; min-height: 48px; }
.checkbox-field input { width: auto; margin: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid #e3e8e3; text-align: left; vertical-align: middle; }
th { color: #647067; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.status-pill.muted { background: #edf0ed; color: #586159; }
.action-link { color: #1f6749; font-weight: 750; text-decoration: none; }
.action-link:hover { text-decoration: underline; }
.snapshot-values { display: grid; gap: 14px; margin: 20px 0; }
fieldset { border: 1px solid #dce4dc; border-radius: 12px; padding: 18px; }
legend { padding: 0 8px; font-weight: 800; }
legend span { color: #69746d; font-size: .8rem; font-weight: 500; }
.compact-list { display: grid; gap: 7px; min-width: 280px; margin: 0; padding: 0; list-style: none; }
.compact-list li { display: flex; justify-content: space-between; gap: 18px; }
.unknown-value { color: #785b0d; }
.empty-state { text-align: center; padding: 52px 28px; }
.button-link { display: inline-block; border-radius: 9px; padding: 11px 17px; background: #1f6749; color: #fff; font-weight: 750; text-decoration: none; }
.dashboard-filter { display: flex; align-items: flex-end; justify-content: space-between; }
.dashboard-filter form { width: min(470px, 100%); }
.inline-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 7px; }
.inline-form select { margin: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { min-width: 0; padding: 20px; border: 1px solid #dce4dc; border-radius: 14px; background: #fff; box-shadow: 0 12px 35px rgba(32, 63, 48, .05); }
.metric-card span, .metric-card small { display: block; color: #647067; }
.metric-card strong { display: block; margin: 7px 0 4px; font-size: clamp(1.25rem, 2.5vw, 1.8rem); line-height: 1.15; }
.metric-card small { font-size: .75rem; }
.ownership-grid { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); margin-bottom: 0; }
.subtle { color: #69746d; font-size: .82rem; }
.asset-ownership-label { display: block; }
.distribution-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.distribution-list { display: grid; gap: 17px; }
.distribution-row > div:first-child { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 6px; font-size: .88rem; }
.distribution-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e8eee9; }
.distribution-track span { display: block; height: 100%; border-radius: inherit; background: #277152; }
.history-detail { margin-top: 16px; }
.planner-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin: 0 0 26px; }
.secondary-link { border: 1px solid #1f6749; background: #fff; color: #1f6749; }
.planner-metrics { margin-top: 4px; }
.projection-bars { display: grid; gap: 12px; margin-top: 22px; }
.projection-row { display: grid; grid-template-columns: 54px minmax(100px, 1fr) 110px; align-items: center; gap: 12px; font-size: .84rem; }
.projection-row strong { text-align: right; }
.heading-actions { display: flex; align-items: center; gap: 14px; }
.budget-year-form { margin-top: 20px; }
.budget-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.budget-settings-form { margin-top: 18px; }
.compact-actions { margin: 4px 0 0; }
.add-budget-line { padding-top: 4px; border-top: 1px solid #e3e8e3; }
.add-budget-line summary { padding: 18px 0 4px; font-weight: 750; }
.add-budget-line form { margin-top: 18px; }
.budget-table { min-width: 0; table-layout: auto; }
.budget-table th, .budget-table td { padding: 10px 9px; }
.budget-table th { white-space: normal; }
.budget-table td:not(.budget-edit-column) { white-space: nowrap; }
.budget-table .budget-source-column { min-width: 150px; max-width: 240px; white-space: normal; overflow-wrap: anywhere; }
.budget-table .budget-edit-column { position: sticky; left: 0; z-index: 2; width: 1%; min-width: 88px; white-space: nowrap; background: #fff; box-shadow: 6px 0 8px -8px rgba(23, 33, 27, .45); }
.budget-table thead .budget-edit-column, .budget-table tfoot .budget-edit-column { z-index: 3; }
.column-picker { margin: 18px 0; padding: 12px 14px; border: 1px solid #dce4dc; border-radius: 10px; background: #f8faf8; }
.column-picker > summary { display: flex; align-items: center; gap: 9px; font-weight: 750; }
.column-picker-form { margin-top: 12px; }
.column-picker-form > p { margin: 0 0 10px; }
.column-picker-options { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.column-option { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 500; }
.column-option input { width: auto; margin: 0; }
.column-picker .form-actions { flex-wrap: wrap; margin: 14px 0 0; }
.budget-table tfoot th, tfoot th { color: #17211b; border-top: 2px solid #dce4dc; }
.compact-lead { margin-top: 5px; font-size: .92rem; }
.delete-form { margin-top: 28px; padding-top: 22px; border-top: 1px solid #e3e8e3; }

.notice { margin: 0 auto 20px; border-radius: 10px; padding: 13px 16px; }
.notice ul { margin: 0; padding-left: 20px; }
.notice.success { background: #def4e7; color: #155d3d; }
.notice.warning { background: #fff1c9; color: #735709; }
.notice.error { background: #fde5e2; color: #81271f; }

.qr-code { width: fit-content; padding: 14px; margin: 20px 0; border: 1px solid #dce4dc; border-radius: 12px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 520px; margin: 18px 0; }
.recovery-codes code { padding: 9px; border-radius: 6px; background: #f1f4f1; }
.session-list { margin: 18px 0; border-top: 1px solid #e3e8e3; }
.session-row { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid #e3e8e3; }
.session-row span { display: block; color: #69746d; font-size: .86rem; }
.session-row time { color: #69746d; font-size: .86rem; }

@media (max-width: 680px) {
    .site-header { align-items: flex-start; flex-direction: column; padding-top: 18px; padding-bottom: 18px; }
    nav { width: 100%; justify-content: space-between; gap: 10px; }
    .container { margin-top: 34px; }
    .auth-card { padding: 26px; }
    .module-grid, .recovery-codes, .split-grid, .form-grid, .metric-grid, .distribution-grid, .planner-grid { grid-template-columns: 1fr; }
    .field.span-2 { grid-column: span 1; }
    .page-heading, .session-row, .dashboard-filter { flex-direction: column; }
    .heading-actions { width: 100%; justify-content: space-between; }
    .budget-metrics { grid-template-columns: 1fr; }
    nav { overflow-x: auto; }
    .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions button, .form-actions .button-link { width: 100%; text-align: center; }
    .projection-row { grid-template-columns: 45px minmax(70px, 1fr) 95px; }
}
