:root {
    color-scheme: light;
    --bg: #f4f3ed;
    --surface: #ffffff;
    --surface-soft: #eef5ef;
    --surface-warm: #fff8e8;
    --ink: #16241d;
    --muted: #607068;
    --line: #d9e0db;
    --brand: #236547;
    --brand-dark: #174832;
    --brand-light: #dceee3;
    --accent: #f2b441;
    --accent-dark: #8a5a00;
    --danger: #b63a3a;
    --danger-soft: #fff0ef;
    --income: #247a55;
    --expense: #bc573d;
    --shadow: 0 14px 40px rgba(24, 55, 39, 0.08);
    --shadow-small: 0 6px 20px rgba(24, 55, 39, 0.08);
    --radius: 22px;
    --radius-small: 14px;
    --max-width: 1440px;
    --header-height: 86px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 5% 5%, rgba(242, 180, 65, 0.10), transparent 25rem),
        radial-gradient(circle at 95% 15%, rgba(35, 101, 71, 0.08), transparent 32rem),
        var(--bg);
    color: var(--ink);
    line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--brand); text-underline-offset: 0.2em; }
img { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible {
    outline: 3px solid rgba(35, 101, 71, 0.42);
    outline-offset: 3px;
}

.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;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 10px;
    left: 10px;
    transform: translateY(-150%);
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
}
.skip-link:focus { transform: none; }
.noscript { padding: 12px; background: var(--danger); color: white; text-align: center; font-weight: 700; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    min-height: var(--header-height);
    padding: 12px max(24px, calc((100vw - var(--max-width)) / 2));
    border-bottom: 1px solid rgba(217, 224, 219, 0.85);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 16px rgba(24, 55, 39, 0.04);
    backdrop-filter: blur(16px);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    text-decoration: none;
}
.brand-mark {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 15px;
    background: var(--brand);
    box-shadow: 0 8px 18px rgba(35, 101, 71, 0.22);
}
.brand-mark svg { width: 31px; height: 31px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-size: 1.25rem; line-height: 1.05; letter-spacing: -0.03em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.76rem; }
.primary-nav { display: flex; justify-content: center; gap: 3px; padding: 0 20px; }
.nav-link {
    border: 0;
    border-radius: 12px;
    padding: 10px 13px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 650;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.is-active { background: var(--surface-soft); color: var(--brand-dark); }
.nav-link-accent { color: var(--brand); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 260px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-status {
    max-width: 220px;
}

.header-logout-form {
    margin: 0;
}

.header-logout-form .button {
    min-height: 34px;
    padding: 8px 11px;
}
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #40a572; box-shadow: 0 0 0 3px rgba(64, 165, 114, 0.13); }
.status-pill.is-offline .status-dot, .status-pill.is-error .status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(182, 58, 58, 0.12); }
.status-pill.is-ready .status-dot { background: #40a572; }
.status-neutral .status-dot { background: #8a918d; box-shadow: 0 0 0 3px rgba(138, 145, 141, 0.12); }
.icon-button { border: 0; background: transparent; cursor: pointer; }
.mobile-menu-button { display: none; width: 42px; height: 42px; padding: 10px; border-radius: 12px; }
.mobile-menu-button span { display: block; width: 100%; height: 2px; margin: 4px 0; border-radius: 3px; background: var(--ink); }

main { flex: 1; width: min(100%, var(--max-width)); margin: 0 auto; padding: 36px 28px 70px; }
.view { animation: view-in 220ms ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 850px; margin-bottom: 12px; font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.04; letter-spacing: -0.055em; }
h2 { margin-bottom: 8px; font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.18; letter-spacing: -0.025em; }
h3 { margin-bottom: 6px; font-size: 1.03rem; line-height: 1.25; }
p { color: var(--muted); }
.eyebrow { display: inline-block; margin-bottom: 8px; color: var(--brand); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.10em; text-transform: uppercase; }
.fine-print { margin: 14px 0 0; font-size: 0.78rem; line-height: 1.45; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(280px, 0.9fr); gap: 20px; margin-bottom: 22px; }
.hero-card {
    position: relative;
    overflow: hidden;
    display: flex;
    min-height: 318px;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(28px, 5vw, 58px);
    border-radius: 30px;
    background: linear-gradient(135deg, #174832, #297652);
    box-shadow: var(--shadow);
    color: #fff;
}
.hero-card::after {
    position: absolute;
    right: -80px;
    bottom: -110px;
    width: 330px;
    height: 330px;
    border: 54px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    content: "";
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card h1 { max-width: 790px; }
.hero-card p { max-width: 780px; margin-bottom: 0; color: rgba(255, 255, 255, 0.82); font-size: 1.04rem; }
.hero-card .eyebrow { color: #ffe0a3; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.privacy-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 28px;
    border: 1px solid #eadcaf;
    border-radius: 30px;
    background: linear-gradient(160deg, #fffaf0, #fff3d4);
    box-shadow: var(--shadow-small);
}
.privacy-card strong { display: block; margin-bottom: 8px; font-size: 1.15rem; }
.privacy-card p { margin: 0; color: #6c5a2e; }
.privacy-icon, .privacy-shield {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 900;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 13px;
    padding: 10px 17px;
    cursor: pointer;
    font-weight: 750;
    text-decoration: none;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.button-primary { background: var(--accent); color: #2c210c; box-shadow: 0 8px 18px rgba(242, 180, 65, 0.20); }
.button-primary:hover { background: #ffc95d; }
.button-secondary { border-color: #b9d0c1; background: var(--surface-soft); color: var(--brand-dark); }
.button-quiet { border-color: var(--line); background: #fff; color: var(--ink); }
.button-danger { background: var(--danger); color: #fff; }
.button-small { min-height: 36px; padding: 7px 12px; font-size: 0.85rem; }
.hero-card .button-secondary { border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.10); color: #fff; }
.text-button { border: 0; padding: 4px; background: transparent; color: var(--brand); cursor: pointer; font-weight: 750; text-decoration: none; }
.text-button:hover { text-decoration: underline; }
.danger-text { color: var(--danger) !important; }
.button-group { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 142px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 3px 12px rgba(24, 55, 39, 0.035);
}
.metric-card::before { position: absolute; top: 0; left: 0; width: 100%; height: 5px; background: var(--line); content: ""; }
.metric-card > span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 0.83rem; font-weight: 700; }
.metric-card strong { display: block; margin-bottom: 5px; font-size: clamp(1.55rem, 2.7vw, 2.15rem); line-height: 1.05; letter-spacing: -0.04em; }
.metric-card small { color: var(--muted); }
.metric-income::before { background: var(--income); }
.metric-expense::before { background: var(--expense); }
.metric-left::before { background: var(--accent); }
.metric-day::before, .metric-balance::before { background: #527aa3; }
.metric-card.is-negative strong { color: var(--danger); }
.metric-card.is-positive strong { color: var(--brand); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr); gap: 20px; margin-bottom: 20px; }
.dashboard-grid-wide { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); }
.panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 3px 12px rgba(24, 55, 39, 0.035);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2, .panel-heading p { margin-bottom: 0; }
.setup-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.setup-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; }
.setup-list li.is-complete { border-color: #b8d7c4; background: #f2f9f4; }
.setup-list li.is-complete .step-number { background: var(--brand); color: white; }
.setup-list p { margin: 2px 0 0; font-size: 0.86rem; }
.step-number { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--brand-light); color: var(--brand-dark); font-size: 0.86rem; font-weight: 800; }

.budget-bars { display: grid; gap: 15px; }
.budget-bars.large { gap: 18px; }
.budget-bar-row { display: grid; gap: 6px; }
.budget-bar-label { display: flex; justify-content: space-between; gap: 14px; font-size: 0.85rem; font-weight: 700; }
.budget-bar-label span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.budget-bar-track { overflow: hidden; height: 10px; border-radius: 999px; background: #e9eeeb; }
.budget-bar-progress { display: block; width: 100%; height: 10px; border: 0; appearance: none; background: transparent; }
.budget-bar-progress::-webkit-progress-bar { border-radius: 999px; background: #e9eeeb; }
.budget-bar-progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--brand), #4a9871); }
.budget-bar-progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--brand), #4a9871); }
.budget-bar-row:nth-child(2n) .budget-bar-progress::-webkit-progress-value { background: linear-gradient(90deg, #527aa3, #719dc7); }
.budget-bar-row:nth-child(2n) .budget-bar-progress::-moz-progress-bar { background: linear-gradient(90deg, #527aa3, #719dc7); }
.budget-bar-row:nth-child(3n) .budget-bar-progress::-webkit-progress-value { background: linear-gradient(90deg, #b17133, #dda65c); }
.budget-bar-row:nth-child(3n) .budget-bar-progress::-moz-progress-bar { background: linear-gradient(90deg, #b17133, #dda65c); }
.budget-bar-row:nth-child(4n) .budget-bar-progress::-webkit-progress-value { background: linear-gradient(90deg, #8b5d8f, #b383b7); }
.budget-bar-row:nth-child(4n) .budget-bar-progress::-moz-progress-bar { background: linear-gradient(90deg, #8b5d8f, #b383b7); }

.card-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mini-offer-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fafcfb; }
.mini-offer-card h3 { margin-bottom: 2px; }
.mini-offer-card p { margin: 0; font-size: 0.82rem; }
.mini-offer-price { text-align: right; }
.mini-offer-price strong { display: block; color: var(--brand); font-size: 1.3rem; }
.mini-offer-price small { color: var(--muted); text-decoration: line-through; }
.mini-list { display: grid; gap: 10px; }
.mini-benefit { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 15px; }
.mini-benefit-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--brand-light); color: var(--brand); font-weight: 850; }
.mini-benefit p { margin: 1px 0 0; font-size: 0.79rem; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.page-heading h1 { margin-bottom: 8px; }
.page-heading p { max-width: 760px; margin-bottom: 0; font-size: 1.02rem; }
.page-heading-stat { min-width: 180px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; text-align: right; }
.page-heading-stat span { display: block; color: var(--muted); font-size: 0.8rem; }
.page-heading-stat strong { font-size: 1.1rem; }
.local-badge { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); font-weight: 800; white-space: nowrap; }

.content-layout.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.sticky-panel { position: sticky; top: calc(var(--header-height) + 20px); }
.filter-bar { display: grid; grid-template-columns: minmax(240px, 1fr) 190px 190px auto; gap: 10px; margin-bottom: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.88); }
.filter-bar label { min-width: 0; }
.filter-bar input, .filter-bar select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; background: #fff; color: var(--ink); }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--brand); }
.search-field { position: relative; }
.search-field > span:last-child { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--muted); font-size: 1.3rem; pointer-events: none; }
.search-field input { padding-right: 40px; }
.checkbox-control { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--ink); font-weight: 650; }
.checkbox-control input { width: 18px !important; min-height: 18px !important; height: 18px; accent-color: var(--brand); }
.filter-bar .checkbox-control { min-height: 44px; padding: 0 7px; white-space: nowrap; }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 12px 3px; }
.results-heading p { margin: 0; font-size: 0.88rem; }
.offer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.offer-card { position: relative; overflow: hidden; display: flex; min-height: 310px; flex-direction: column; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 3px 12px rgba(24, 55, 39, 0.035); }
.offer-image { position: relative; display: grid; height: 120px; place-items: center; overflow: hidden; background: linear-gradient(135deg, #edf5ef, #f9f5e8); }
.offer-image img { width: 100%; height: 100%; object-fit: cover; }
.offer-placeholder { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 20px; background: #fff; color: var(--brand); box-shadow: var(--shadow-small); font-size: 1.5rem; font-weight: 900; }
.offer-badge { position: absolute; top: 12px; left: 12px; padding: 5px 8px; border-radius: 999px; background: var(--accent); color: #3a2a0a; font-size: 0.72rem; font-weight: 850; }
.demo-badge { position: absolute; top: 12px; right: 12px; padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,0.92); color: var(--muted); font-size: 0.69rem; font-weight: 800; }
.offer-body { display: flex; flex: 1; flex-direction: column; padding: 17px; }
.offer-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; color: var(--muted); font-size: 0.73rem; font-weight: 700; }
.offer-meta span + span::before { margin-right: 6px; content: "•"; }
.offer-title { margin-bottom: 5px; }
.offer-unit { margin: 0 0 13px; font-size: 0.79rem; }
.offer-price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; }
.offer-price strong { display: block; color: var(--brand-dark); font-size: 1.65rem; line-height: 1; letter-spacing: -0.04em; }
.offer-price del { color: var(--muted); font-size: 0.8rem; }
.offer-save { width: 42px; height: 42px; border: 1px solid #b9d0c1; border-radius: 13px; background: var(--surface-soft); color: var(--brand); cursor: pointer; font-size: 1.15rem; font-weight: 900; }
.offer-save.is-saved { border-color: var(--brand); background: var(--brand); color: #fff; }
.offer-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); font-size: 0.73rem; }
.offer-footer span { color: var(--muted); }
.offer-footer a { font-weight: 750; }

.shopping-panel { padding: 21px; }
.count-badge { display: grid; min-width: 30px; height: 30px; padding: 0 8px; place-items: center; border-radius: 999px; background: var(--brand); color: #fff; font-size: 0.8rem; font-weight: 800; }
.shopping-list { display: grid; gap: 8px; max-height: 50vh; overflow: auto; padding-right: 3px; }
.shopping-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; }
.shopping-item strong { display: block; font-size: 0.86rem; }
.shopping-item small { color: var(--muted); }
.shopping-item button { border: 0; background: transparent; color: var(--danger); cursor: pointer; }
.shopping-total { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.shopping-total div { padding: 10px; border-radius: 12px; background: var(--surface-soft); }
.shopping-total span { display: block; color: var(--muted); font-size: 0.7rem; }
.shopping-total strong { font-size: 1.05rem; }

.notice { margin-bottom: 18px; padding: 15px 18px; border: 1px solid #e7d39b; border-radius: 15px; background: var(--surface-warm); color: #5f4a1e; }
.notice strong { color: #48330b; }
.notice.compact { margin: 18px 0 0; font-size: 0.84rem; }
.benefit-filter-bar { grid-template-columns: minmax(240px, 1fr) 220px 210px auto; }
.benefit-filter-bar label > span:not(.sr-only) { display: block; margin: -3px 0 3px; color: var(--muted); font-size: 0.68rem; font-weight: 700; }
.benefit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.benefit-card { display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 3px 12px rgba(24, 55, 39, 0.035); }
.benefit-card-header { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.benefit-category { display: inline-flex; align-items: center; width: fit-content; margin-bottom: 7px; padding: 4px 8px; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); font-size: 0.71rem; font-weight: 800; }
.match-badge { display: inline-flex; flex: 0 0 auto; align-items: center; height: fit-content; padding: 6px 9px; border-radius: 999px; background: #eff1f0; color: var(--muted); font-size: 0.7rem; font-weight: 800; white-space: nowrap; }
.match-badge.match-likely { background: #e1f3e7; color: #1d6846; }
.match-badge.match-maybe { background: #fff3d6; color: #80550b; }
.match-badge.match-no { background: #f4f0ef; color: #7a5a54; }
.match-badge.match-likely_match { background: #dff4e6; color: #155f3d; }
.match-badge.match-possible_match_authority_review { background: #e8f2ed; color: #245f49; }
.match-badge.match-possible_after_prerequisite { background: #fff0c9; color: #7a520d; }
.match-badge.match-possible_match_needs_answers { background: #fff6dc; color: #765b18; }
.match-badge.match-referral_only { background: #e9eff9; color: #31577e; }
.match-badge.match-source_needs_review { background: #f8e8dc; color: #844520; }
.match-badge.match-application_period_closed { background: #f2e7e5; color: #7b3f36; }
.match-badge.match-not_match_known_condition { background: #f3eeee; color: #765957; }
.benefit-card > p { margin-bottom: 13px; }
.benefit-details { display: grid; gap: 8px; margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.benefit-detail { display: grid; grid-template-columns: 115px 1fr; gap: 10px; font-size: 0.81rem; }
.benefit-detail dt { color: var(--muted); font-weight: 700; }
.benefit-detail dd { margin: 0; }
.benefit-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.benefit-card.is-demo { border-style: dashed; }
.rights-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 18px 0; padding: 20px 22px; border: 1px solid #bcd7c7; border-radius: 20px; background: linear-gradient(135deg, #f2f9f5, #fffaf0); }
.rights-summary h2 { margin: 2px 0 5px; font-size: 1.35rem; }
.rights-summary p { margin: 0; color: var(--muted); }
.rights-card { position: relative; }
.rights-school_route { border-color: #b7d4c2; }
.warning-detail { border-left: 3px solid var(--accent); padding-left: 10px; }

.budget-metrics { margin-bottom: 20px; }
.content-layout.budget-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid label { display: grid; align-content: start; gap: 6px; color: var(--ink); font-size: 0.84rem; font-weight: 700; }
.form-grid label > span small { color: var(--muted); font-weight: 500; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; background: #fff; color: var(--ink); }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(35, 101, 71, 0.08); outline: 0; }
.form-span { grid-column: 1 / -1; }
.money-input { position: relative; }
.money-input > span { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 30px; }
.form-preview { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px; border-radius: 13px; background: var(--surface-soft); }
.form-preview strong { font-size: 1.1rem; }
.ledger-panel { margin-top: 20px; }
.inline-filters { display: flex; align-items: center; gap: 10px; }
.inline-filters select { min-height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; }
.table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.ledger-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; white-space: nowrap; }
.ledger-table td { padding: 13px 12px; border-bottom: 1px solid #edf0ee; vertical-align: middle; }
.ledger-table tr:last-child td { border-bottom: 0; }
.ledger-table .amount-income { color: var(--income); font-weight: 800; }
.ledger-table .amount-expense { color: var(--expense); font-weight: 800; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions button { border: 0; border-radius: 9px; padding: 6px 8px; background: #f1f4f2; cursor: pointer; font-size: 0.75rem; }
.row-actions button:last-child { color: var(--danger); }

.household-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.household-form { gap: 17px; }
.form-section { padding-top: 4px; border-bottom: 1px solid var(--line); }
.form-section h2 { margin-bottom: 3px; }
.form-section p { margin-bottom: 13px; font-size: 0.86rem; }
.option-fieldset { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 15px; }
.option-fieldset legend { padding: 0 7px; font-weight: 800; }
.option-fieldset legend small { color: var(--muted); font-weight: 600; }
.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.option-grid .checkbox-control { min-height: 44px; padding: 9px 11px; border: 1px solid #dce5df; border-radius: 12px; background: #fafcfb; }
.form-grid label.checkbox-control { display: flex; align-items: center; align-content: initial; }
.advanced-fields { border: 1px solid var(--line); border-radius: 16px; background: #fafcfb; }
.advanced-fields > summary, .child-extra > summary { padding: 14px 16px; color: var(--brand-dark); font-weight: 800; cursor: pointer; }
.advanced-fields > .form-grid { padding: 0 16px 16px; }
.children-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.children-list { display: grid; gap: 10px; }
.child-row { display: grid; grid-template-columns: 1fr .65fr 1.2fr .65fr auto auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fafcfb; }
.child-row button { width: 42px; height: 42px; border: 1px solid #ead0cc; border-radius: 12px; background: var(--danger-soft); color: var(--danger); cursor: pointer; }
.child-resident { align-self: center; min-width: 150px; }
.child-extra { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.child-extra-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 8px 10px; }
.consent-line { padding: 12px; border-radius: 13px; background: var(--surface-soft); }
.privacy-explainer { position: sticky; top: calc(var(--header-height) + 20px); }
.privacy-explainer h2 { margin-top: 15px; }
.privacy-explainer dl { display: grid; gap: 11px; }
.privacy-explainer dl div { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.privacy-explainer dt { font-weight: 800; }
.privacy-explainer dd { margin: 2px 0 0; color: var(--muted); font-size: 0.84rem; }
.privacy-explainer p { margin-bottom: 0; font-size: 0.84rem; }

.assistant-heading { align-items: center; }
.assistant-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 20px; align-items: start; }
.prompt-panel { position: sticky; top: calc(var(--header-height) + 20px); }
.prompt-chips { display: grid; gap: 8px; }
.prompt-chip { border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; background: #fff; color: var(--ink); cursor: pointer; text-align: left; font-size: 0.86rem; }
.prompt-chip:hover { border-color: #a9c8b5; background: var(--surface-soft); }
.prompt-panel .notice + .notice { margin-top: 10px; }
.assistant-card { overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.assistant-messages { display: grid; align-content: start; gap: 14px; min-height: 420px; max-height: 62vh; overflow-y: auto; padding: 24px; background: linear-gradient(180deg, #f8faf8, #fff); }
.message { display: flex; max-width: 86%; align-items: flex-start; gap: 10px; }
.message-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 11px; background: var(--brand); color: #fff; font-size: 0.82rem; font-weight: 900; }
.message > div:last-child { padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px 16px 16px 16px; background: #fff; }
.message strong { display: block; margin-bottom: 4px; font-size: 0.78rem; }
.message p { margin: 0; color: var(--ink); white-space: pre-wrap; }
.assistant-sources { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.assistant-sources strong { color: var(--muted); }
.assistant-sources ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; }
.assistant-sources a { color: var(--brand-dark); font-size: 0.78rem; font-weight: 700; overflow-wrap: anywhere; }
.message-user { justify-self: end; flex-direction: row-reverse; }
.message-user .message-avatar { background: var(--accent); color: #3f2d09; }
.message-user > div:last-child { border-color: #d3e7da; border-radius: 16px 6px 16px 16px; background: var(--surface-soft); }
.message-loading p::after { display: inline-block; width: 1.1em; overflow: hidden; vertical-align: bottom; content: "…"; animation: loading-dots 1.2s steps(4, end) infinite; }
@keyframes loading-dots { from { width: 0; } to { width: 1.1em; } }
.assistant-form { padding: 18px; border-top: 1px solid var(--line); }
.context-control { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; padding: 11px; border-radius: 13px; background: var(--surface-soft); cursor: pointer; }
.context-control input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.context-control span { display: grid; }
.context-control small { color: var(--muted); font-weight: 500; }
.assistant-input { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.assistant-input textarea { width: 100%; min-height: 90px; max-height: 240px; resize: vertical; border: 1px solid var(--line); border-radius: 15px; padding: 12px; }
.assistant-input textarea:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px rgba(35, 101, 71, 0.08); }
.assistant-meta { display: flex; justify-content: space-between; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 0.72rem; }

.legal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.legal-grid .panel p { margin-bottom: 0; }
.data-actions-panel { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-top: 20px; }
.data-actions-panel p { margin-bottom: 0; }

.site-footer { display: flex; width: min(100%, var(--max-width)); align-items: center; justify-content: space-between; gap: 20px; margin: 0 auto; padding: 26px 28px 38px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.site-footer > div { display: flex; gap: 10px; }
.site-footer strong { color: var(--ink); }
.site-footer nav { display: flex; gap: 14px; align-items: center; }
.bottom-nav { display: none; }

.empty-state { margin: 0; padding: 28px 16px; border: 1px dashed #cbd4ce; border-radius: 15px; background: #fafcfb; text-align: center; }
.empty-state.compact { padding: 16px 12px; font-size: 0.83rem; }
.skeleton-card { min-height: 180px; border-radius: 18px; background: linear-gradient(100deg, #edf0ee 20%, #f8f9f8 40%, #edf0ee 60%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position-x: -200%; } }

.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid #bcd4c5; border-radius: 14px; background: #fff; box-shadow: var(--shadow); animation: toast-in 180ms ease-out; }
.toast.is-error { border-color: #e0b5b0; background: #fff7f6; }
.toast p { margin: 0; color: var(--ink); font-size: 0.86rem; }
.toast button { border: 0; background: transparent; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.dialog-backdrop { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(16, 30, 23, 0.48); backdrop-filter: blur(4px); }
.dialog { width: min(440px, 100%); padding: 24px; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.dialog p { margin-bottom: 20px; }
.dialog .button-group { justify-content: flex-end; }

@media (max-width: 1180px) {
    .site-header { grid-template-columns: auto 1fr auto; }
    .primary-nav { justify-content: flex-end; overflow-x: auto; scrollbar-width: none; }
    .nav-link { padding-inline: 9px; font-size: 0.84rem; }
    .status-pill { display: none; }
    .offer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    :root { --header-height: 74px; }
    .site-header { padding: 10px 18px; }
    .brand-mark { width: 44px; height: 44px; }
    .brand small { display: none; }
    .mobile-menu-button { display: block; }
    .primary-nav {
        position: absolute;
        top: calc(100% + 1px);
        right: 14px;
        left: 14px;
        display: none;
        max-height: calc(100vh - 100px);
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 17px;
        background: #fff;
        box-shadow: var(--shadow);
    }
    .primary-nav.is-open { display: flex; }
    .nav-link { text-align: left; }
    main { padding: 26px 18px 92px; }
    .hero-grid, .dashboard-grid, .dashboard-grid-wide, .content-layout.with-aside, .content-layout.budget-layout, .household-layout, .assistant-layout { grid-template-columns: 1fr; }
    .hero-card { min-height: 300px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sticky-panel, .privacy-explainer, .prompt-panel { position: static; }
    .shopping-panel { order: -1; }
    .shopping-list { max-height: none; }
    .filter-bar, .benefit-filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-bar .search-field { grid-column: 1 / -1; }
    .benefit-grid { grid-template-columns: 1fr; }
    .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .assistant-messages { max-height: 55vh; }
}

@media (max-width: 680px) {
    body { background: var(--bg); }
    .site-header { grid-template-columns: 1fr auto; }
    .header-actions { grid-column: 2; }
    .primary-nav { grid-column: 1 / -1; }
    main { padding-inline: 13px; }
    h1 { font-size: 2.15rem; }
    .hero-card, .privacy-card, .panel, .assistant-card { border-radius: 19px; }
    .hero-card { min-height: 330px; padding: 26px 22px; }
    .hero-card h1 { font-size: 2.25rem; }
    .hero-actions { display: grid; }
    .metric-grid { gap: 10px; }
    .metric-card { min-height: 124px; padding: 17px; border-radius: 17px; }
    .metric-card strong { font-size: 1.55rem; }
    .dashboard-grid, .dashboard-grid-wide { gap: 13px; }
    .panel { padding: 18px; }
    .card-row { grid-template-columns: 1fr; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
    .page-heading-stat { width: 100%; text-align: left; }
    .filter-bar, .benefit-filter-bar { grid-template-columns: 1fr; }
    .filter-bar .search-field { grid-column: auto; }
    .offer-grid { grid-template-columns: 1fr; }
    .offer-card { min-height: 290px; }
    .offer-image { height: 100px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-span { grid-column: auto; }
    .children-heading { align-items: flex-start; flex-direction: column; }
    .child-row { grid-template-columns: 1fr 1fr; }
    .child-row button { grid-column: 1 / -1; width: 100%; }
    .benefit-detail { grid-template-columns: 1fr; gap: 2px; }
    .rights-summary { align-items: flex-start; flex-direction: column; }
    .option-grid, .child-extra-grid { grid-template-columns: 1fr; }
    .assistant-input { grid-template-columns: 1fr; }
    .assistant-input .button { width: 100%; }
    .message { max-width: 96%; }
    .assistant-meta { flex-direction: column; gap: 3px; }
    .legal-grid { grid-template-columns: 1fr; }
    .data-actions-panel { align-items: flex-start; flex-direction: column; }
    .setup-list li { grid-template-columns: auto 1fr; }
    .setup-list .text-button { grid-column: 2; justify-self: start; }
    .site-footer { margin-bottom: 66px; padding-inline: 16px; align-items: flex-start; flex-direction: column; }
    .site-footer nav { flex-wrap: wrap; }
    .bottom-nav {
        position: fixed;
        z-index: 80;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        left: 8px;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        padding: 7px;
        border: 1px solid var(--line);
        border-radius: 19px;
        background: rgba(255,255,255,0.96);
        box-shadow: 0 10px 35px rgba(24, 55, 39, 0.18);
        backdrop-filter: blur(14px);
    }
    .bottom-nav button { display: grid; gap: 2px; place-items: center; border: 0; border-radius: 12px; padding: 5px 2px; background: transparent; color: var(--muted); font-size: 0.65rem; font-weight: 700; }
    .bottom-nav button span { font-size: 1rem; font-weight: 850; }
    .bottom-nav button.is-active { background: var(--surface-soft); color: var(--brand-dark); }
    .toast-region { right: 12px; bottom: 88px; width: calc(100vw - 24px); }
}

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

@media print {
    .site-header, .bottom-nav, .site-footer, .button, .text-button, .filter-bar, .assistant-form { display: none !important; }
    body { background: #fff; }
    main { max-width: none; padding: 0; }
    .view { display: none !important; }
    .view.is-active { display: block !important; }
    .panel, .metric-card { box-shadow: none; break-inside: avoid; }
}

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 8%, rgba(35, 101, 71, 0.08), transparent 32rem),
        radial-gradient(circle at 92% 0%, rgba(242, 180, 65, 0.08), transparent 32rem),
        var(--bg);
}

.auth-main {
    width: min(100%, 780px);
    margin: 0 auto;
    padding: 26px 16px 48px;
}

.auth-shell {
    display: grid;
    gap: 14px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(18px, 4vw, 32px);
    box-shadow: var(--shadow-small);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--surface);
}

.auth-kicker {
    margin: 0;
    color: var(--brand);
    font-size: 0.87rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.auth-description {
    margin: 8px 0 0;
    color: var(--muted);
}

.auth-message {
    margin: 16px 0;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 700;
}

.auth-message-success {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.auth-message-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.auth-inline-form {
    margin: 0 0 10px;
}

.auth-inline-form .button {
    width: 100%;
    justify-content: center;
}

.auth-email-block {
    margin: 18px 0 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.auth-email-block h2 {
    margin: 0;
    font-size: 1.05rem;
}

.auth-email-help {
    margin: 6px 0 12px;
    color: var(--muted);
    font-size: 0.93rem;
}

.auth-field {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    font-weight: 750;
}

.auth-field input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #b9d0c1;
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

.auth-field input:focus-visible {
    outline: 3px solid rgba(35, 101, 71, 0.24);
    outline-offset: 2px;
}

.auth-or {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-or::before,
.auth-or::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--line);
}

.auth-provider-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-status-text {
    margin: 0;
    color: var(--ink);
}

.auth-status-text span {
    display: inline-block;
    margin-left: 8px;
    color: var(--muted);
    font-size: 0.93rem;
}

.auth-actions {
    display: grid;
    gap: 10px;
}

.auth-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 16px 0;
}

.auth-privacy {
    margin: 0;
}

.auth-privacy a {
    color: var(--brand);
}

@media (max-width: 640px) {
    .auth-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .auth-card {
        border-radius: 18px;
        padding: 16px;
    }
}
