:root {
    color-scheme: dark;
    --bg: #171824;
    --surface: #222435;
    --surface-raised: #2a2d42;
    --surface-soft: #25283a;
    --text: #f3f4fa;
    --muted: #a7abc0;
    --border: #3a3e55;
    --gold: #f3c75b;
    --green: #59c59d;
    --blue: #70b8ec;
    --coral: #ff887f;
    --radius: 18px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(ellipse at 10% -15%, rgba(91, 93, 150, 0.2), transparent 34rem),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
}
[hidden] { display: none !important; }

.app-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 24px clamp(14px, 3vw, 40px) 18px;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 76px;
    margin-bottom: 34px;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(34, 36, 53, 0.92);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 195px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--gold), #e79750);
    color: #242333;
    font-size: 1.2rem;
    font-weight: 850;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 0.96rem; letter-spacing: 0.01em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 0.7rem; }

.primary-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
}

.nav-tab {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 650;
    transition: background 160ms ease, color 160ms ease;
}

.nav-tab:hover { background: var(--surface-raised); color: var(--text); }
.nav-tab.active { background: #383b53; color: var(--text); box-shadow: inset 0 0 0 1px #50546e; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .text-button, .button, .file-picker {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
    font-weight: 650;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button { width: 42px; height: 42px; font-size: 1.05rem; }
.text-button { padding: 10px 13px; font-size: 0.82rem; }
.icon-button:hover, .text-button:hover, .button-secondary:hover, .file-picker:hover { border-color: var(--blue); }
.button:hover, .icon-button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.6; cursor: wait; transform: none; }

.view { animation: view-enter 180ms ease-out; }
@keyframes view-enter { from { opacity: 0.45; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 0 2px 24px;
}

.page-heading h1 {
    max-width: 760px;
    margin: 3px 0 6px;
    font-size: clamp(1.7rem, 3.2vw, 2.45rem);
    line-height: 1.18;
    letter-spacing: -0.035em;
}

.page-heading p { margin-top: 3px; margin-bottom: 0; }
.eyebrow, .tag {
    color: var(--gold);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.11em;
}

.muted { color: var(--muted); font-size: 0.86rem; }
.sync-pill {
    flex: 0 0 auto;
    max-width: 360px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.75rem;
}

.sync-pill.connected { border-color: rgba(89, 197, 157, 0.4); color: var(--green); }
.sync-pill.error { border-color: rgba(255, 136, 127, 0.4); color: var(--coral); }

.redemption-countdown {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
    padding: 20px 24px;
    border-color: rgba(255, 136, 127, 0.42);
    background:
        radial-gradient(ellipse at 100% 0, rgba(255, 136, 127, 0.13), transparent 38%),
        linear-gradient(135deg, rgba(49, 37, 49, 0.98), rgba(34, 36, 53, 0.98));
}
.redemption-countdown-heading, .redemption-countdown-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.redemption-countdown-heading .eyebrow { margin: 0 0 3px; color: var(--coral); }
.redemption-countdown-heading h2 { margin: 0; font-size: clamp(1.05rem, 2.4vw, 1.45rem); }
.redemption-deadline { color: var(--muted); font-size: 0.8rem; }
.redemption-progress-track {
    height: 11px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: #171a28;
}
.redemption-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--coral));
    box-shadow: 0 0 14px rgba(255, 136, 127, 0.35);
    transition: width 700ms ease;
}
.redemption-countdown-details { color: var(--muted); font-size: 0.82rem; }
.redemption-countdown-details strong { margin-left: 4px; color: var(--text); font-variant-numeric: tabular-nums; }

.debt-goal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
    gap: 16px;
    margin-bottom: 18px;
}
.debt-main-card, .debt-strategy-card {
    min-width: 0;
    padding: 22px;
}
.debt-main-card {
    border-color: rgba(243, 199, 91, 0.45);
    background: linear-gradient(135deg, rgba(48, 42, 48, 0.98), rgba(34, 36, 53, 0.98));
}
.debt-main-card > h2 { margin: 8px 0 6px; font-size: clamp(1.25rem, 2.7vw, 1.75rem); }
.debt-main-amount { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 0 0 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.debt-main-amount > strong { color: var(--text); font-size: clamp(1.45rem, 3vw, 2rem); }
.debt-main-amount span strong { color: var(--text); }
.debt-progress-track {
    height: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: #171a28;
}
.debt-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--green));
    transition: width 700ms ease;
}
.debt-main-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 0.78rem; }
.debt-main-footer strong { color: var(--text); }
.debt-subtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.debt-subtile { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: rgba(23, 24, 36, 0.48); }
.debt-subtile > .tag { overflow-wrap: anywhere; }
.debt-subtile > strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.debt-subtile .muted { font-size: 0.75rem; }
.debt-subtile .muted strong { color: var(--text); }
.debt-log-link { justify-self: start; padding: 0; border: 0; background: none; color: var(--blue); cursor: pointer; font-size: 0.74rem; text-align: left; }
.debt-log-link:hover { text-decoration: underline; }
.debt-strategy-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 2px solid var(--green);
}
.debt-strategy-card .eyebrow { margin: 0 0 7px; color: var(--green); }
.debt-strategy-card h2 { margin: 0 0 8px; font-size: 1.1rem; }
.debt-strategy-card .muted { margin: 0; font-size: 0.78rem; }
.debt-strategy-priority { margin: 15px 0 0; padding: 11px 12px; border-radius: 10px; background: rgba(89, 197, 157, 0.09); color: var(--green); font-size: 0.82rem; font-weight: 650; }

.repayment-capacity { margin: 0 0 18px; padding: 22px; border-color: rgba(89, 197, 157, 0.34); }
.repayment-capacity .section-heading { align-items: flex-start; margin-bottom: 14px; }
.repayment-capacity .section-heading h2 { font-size: 1.15rem; }
.repayment-capacity .section-heading .muted { text-align: right; }
.repayment-capacity-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(230px, 0.8fr); gap: 18px; }
.capacity-breakdown { display: grid; align-content: center; gap: 0; margin: 0; }
.capacity-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.capacity-line dt { color: var(--text); font-size: 0.85rem; font-weight: 650; }
.capacity-line dt small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.7rem; font-weight: 400; }
.capacity-line dd { flex: 0 0 auto; margin: 0; color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.capacity-result { display: flex; flex-direction: column; justify-content: center; padding: 18px; border: 1px solid var(--border); border-radius: 13px; background: rgba(23, 24, 36, 0.48); color: var(--muted); font-size: 0.76rem; }
.capacity-result > strong { margin-top: 3px; color: var(--text); font-size: clamp(1.35rem, 3vw, 1.9rem); font-variant-numeric: tabular-nums; }
.capacity-result > .capacity-weekly-value { margin-top: 8px; color: var(--green); font-size: clamp(1.65rem, 3.2vw, 2.2rem); }
.capacity-result.capacity-negative > .capacity-weekly-value,
.capacity-result.capacity-under-target > .capacity-weekly-value { color: var(--coral); }
.capacity-result > p { margin: 12px 0 0; color: var(--green); font-size: 0.77rem; font-weight: 650; }
.capacity-result.capacity-negative > p,
.capacity-result.capacity-under-target > p { color: var(--coral); }
.capacity-note { margin: 13px 0 0; font-size: 0.72rem; }

.simulator-card, .tax-projection-card { margin-bottom: 18px; padding: 22px; }
.simulator-card .section-heading, .tax-projection-card .section-heading { align-items: flex-start; }
.simulator-card .section-heading h2, .tax-projection-card .section-heading h2 { font-size: 1.15rem; }
.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.scenario-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: rgba(23, 24, 36, 0.46); }
.scenario-card h3 { margin: 0 0 5px; font-size: 0.88rem; }
.scenario-card .scenario-amount { display: block; color: var(--gold); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.scenario-card .muted { display: block; margin-top: 5px; font-size: 0.72rem; }
.scenario-card dl { display: grid; gap: 8px; margin: 15px 0 0; }
.scenario-card dl div { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 0.76rem; }
.scenario-card dt { color: var(--muted); }
.scenario-card dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.scenario-note, .tax-projection-note { margin: 13px 0 0; font-size: 0.73rem; }
.tax-projection-card .section-heading > .muted { max-width: 360px; text-align: right; font-size: 0.76rem; }
.tax-projection-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tax-projection-grid > div { display: grid; align-content: start; gap: 7px; min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: rgba(23, 24, 36, 0.38); }
.tax-projection-grid .muted { font-size: 0.72rem; }
.tax-projection-grid strong { font-size: clamp(1rem, 2vw, 1.4rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tax-projection-grid small { color: var(--muted); font-size: 0.68rem; }

.goal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(150deg, rgba(42, 45, 66, 0.96), rgba(34, 36, 53, 0.96));
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.12);
}

.goal-card, .metric-card, .period-card, .suggestion-grid article {
    transition: transform 300ms ease, box-shadow 300ms ease, border-color 300ms ease;
}
.goal-card { min-height: 218px; padding: 20px; animation: tile-enter 500ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.goal-card:nth-child(2) { animation-delay: 70ms; }
.goal-card:nth-child(3) { animation-delay: 140ms; }
.goal-card:nth-child(4) { animation-delay: 210ms; }
.goal-card:nth-child(5) { animation-delay: 280ms; }
.goal-card-gold { border-color: rgba(243, 199, 91, 0.56); background: linear-gradient(135deg, #2d2d44 0%, #3a2e1e 100%); }
.goal-card-green { border-top: 2px solid var(--green); }
.goal-card-blue { border-top: 2px solid var(--blue); }
.goal-card-content { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.goal-card-copy { min-width: 0; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.goal-icon { font-size: 1.35rem; }
.goal-card h2 { min-height: 2.7em; margin: 17px 0 10px; font-size: 1.04rem; line-height: 1.35; }
.goal-amount { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 0; font-variant-numeric: tabular-nums; }
.goal-amount strong { font-size: 1.55rem; letter-spacing: -0.03em; }
.goal-amount > span { color: var(--muted); font-size: 0.9rem; }
.goal-card-copy > .muted { display: block; margin: 9px 0 0; font-size: 0.76rem; }
.goal-cadence { display: flex; justify-content: space-between; gap: 8px; margin-top: 11px; color: var(--muted); font-size: 0.72rem; }
.goal-cadence strong { margin-left: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.goal-gauge { flex: 0 0 92px; width: 92px; height: 92px; }
.goal-gauge-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.goal-gauge-track, .goal-gauge-fill { fill: none; stroke-width: 8; }
.goal-gauge-track { stroke: #171a28; }
.goal-gauge-fill { stroke-linecap: round; stroke-dasharray: 289.03; stroke-dashoffset: 289.03; transform: rotate(-90deg); transform-origin: 60px 60px; transition: stroke-dashoffset 1s ease; }
.goal-gauge-fill.gold { stroke: var(--gold); }
.goal-gauge-fill.green { stroke: var(--green); }
.goal-gauge-fill.blue { stroke: var(--blue); }
.goal-gauge-label { fill: var(--text); font-family: "Space Mono", ui-monospace, monospace; font-size: 18px; font-weight: 700; }

@media (hover: hover) {
    .goal-card:hover, .metric-card:hover, .period-card:hover, .suggestion-grid article:hover {
        transform: translateY(-3px);
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
    }
}

@keyframes tile-enter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #171a28;
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width 800ms cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.gold { background: linear-gradient(90deg, #e6a848, var(--gold)); }
.progress-fill.green { background: linear-gradient(90deg, #38a87f, var(--green)); }
.progress-fill.blue { background: linear-gradient(90deg, #528fcd, var(--blue)); }

.metric-card {
    display: flex;
    min-height: 218px;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.metric-card .tag { min-height: 2.5em; color: var(--muted); line-height: 1.35; }
.metric-value { font-size: clamp(1.25rem, 2.2vw, 1.8rem); font-variant-numeric: tabular-nums; letter-spacing: -0.035em; }
.metric-card .muted { font-size: 0.78rem; }

.section-block { margin-top: 34px; }
.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.section-heading h2 { margin: 2px 0 0; font-size: 1.2rem; letter-spacing: -0.02em; }
.section-heading p { margin-bottom: 0; }
.section-heading .eyebrow { margin-bottom: 4px; }

.period-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.period-card { min-height: 174px; padding: 18px 20px; }
.period-card h2, .period-card h3 { margin: 0; font-size: 0.94rem; font-weight: 650; }
.period-icon { color: var(--blue); font-size: 1.3rem; }
.period-amount { display: block; margin: 16px 0 3px; font-size: 1.65rem; font-variant-numeric: tabular-nums; letter-spacing: -0.035em; }
.period-card .progress-track { margin-top: 13px; }
.period-card > .muted:last-child { display: block; margin-top: 8px; font-size: 0.76rem; }
.income-period .period-icon { color: var(--green); }

.annual-lower-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 16px; margin-top: 28px; }
.form-card, .chart-card, .category-card, .task-card { padding: 22px; }
.section-heading.compact { margin-bottom: 14px; }
.section-heading.compact h2 { font-size: 1.08rem; }
.inline-form { display: grid; grid-template-columns: 1.2fr 0.8fr 1fr auto; gap: 8px; }

input, select {
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #191b29;
    color: var(--text);
}
input::placeholder { color: #858aa1; }
input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

.button, .file-picker {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    font-size: 0.84rem;
    text-decoration: none;
}
.button-primary { border-color: transparent; background: var(--gold); color: #252435; }
.button-primary:hover { background: #ffdb7c; }
.button-secondary { background: var(--surface-raised); }
.form-status { min-height: 1.35em; margin: 8px 0 0; color: var(--muted); font-size: 0.8rem; }
.form-status.error { color: var(--coral); }
.form-status.success { color: var(--green); }
.form-status.warning { color: var(--gold); }

.activity-list, .task-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.activity-row, .task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(23, 24, 36, 0.48);
}
.activity-row-main { min-width: 0; }
.activity-row-main strong, .activity-row-main small { display: block; }
.activity-row-main strong { overflow: hidden; font-size: 0.84rem; text-overflow: ellipsis; white-space: nowrap; }
.activity-row-main small { margin-top: 2px; color: var(--muted); font-size: 0.73rem; }
.activity-row > strong { flex: 0 0 auto; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.delete-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.delete-button:hover { color: var(--coral); }

.upload-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.file-picker { border-color: var(--border); }
.file-name { flex: 1 1 100%; color: var(--muted); font-size: 0.76rem; }
.payslip-card > .muted { margin: 0; }
.paystub-fields { display: grid; gap: 10px; margin-top: 16px; }
.paystub-fields > label, .paystub-number-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 0.76rem; }
.paystub-number-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.review-notice { margin: 0; padding: 10px 12px; border-left: 3px solid var(--gold); border-radius: 5px; background: rgba(243, 199, 91, 0.08); color: var(--text); font-size: 0.78rem; }
.privacy-note { margin: 13px 0 0; font-size: 0.72rem; }

.spending-summary { margin-bottom: 18px; }
.spending-summary .period-card { min-height: 195px; }
.spending-summary .tag { color: var(--muted); font-size: 0.66rem; }
.spending-priority-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.debt-envelope-card, .overrun-card { min-width: 0; padding: 18px 20px; }
.debt-envelope-card h2, .overrun-card h2 { margin: 2px 0 0; font-size: 1rem; }
.debt-envelope-card .eyebrow, .overrun-card .eyebrow { margin: 0 0 3px; color: var(--gold); }
.debt-envelope-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.debt-envelope-values > div { display: grid; gap: 5px; min-width: 0; }
.debt-envelope-values .muted { font-size: 0.68rem; }
.debt-envelope-values strong { font-size: clamp(0.9rem, 1.7vw, 1.15rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.debt-envelope-card > p, .overrun-card > p { margin: 13px 0 0; color: var(--muted); font-size: 0.75rem; }
.overrun-list { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.overrun-list li { display: flex; justify-content: space-between; gap: 8px; padding-top: 7px; border-top: 1px solid var(--border); font-size: 0.73rem; }
.overrun-list strong { color: var(--coral); text-align: right; font-variant-numeric: tabular-nums; }
.category-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.category-actions .button { min-height: 38px; font-size: 0.76rem; }
.chart-card { margin-bottom: 18px; }
.chart-legend { display: flex; gap: 20px; margin: 0 0 8px; color: var(--muted); font-size: 0.78rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.income-dot { background: var(--green); }
.expense-dot { background: var(--coral); }
.chart-scroll { overflow-x: auto; }
#cashflowChart { display: block; width: 100%; min-width: 620px; height: auto; overflow: visible; }
.chart-gridline { stroke: #41445b; stroke-dasharray: 4 5; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-month-label { fill: var(--muted); font-size: 10px; }
.chart-income-bar { fill: var(--green); }
.chart-expense-bar { fill: var(--coral); }
.chart-empty { fill: var(--muted); font-size: 14px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.81rem; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-size: 0.7rem; font-weight: 650; }
th:first-child, td:first-child { text-align: left; }
tbody td:first-child { font-weight: 600; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tfoot td { border-bottom: 0; color: var(--gold); font-weight: 750; }
.table-note { margin: 13px 0 0; font-size: 0.75rem; }
.over-budget { color: var(--coral) !important; }

.week-picker-label { margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.task-card { max-width: 920px; margin: 0 auto; }
.weekly-streak { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; margin-bottom: 22px; padding: 15px 16px; border: 1px solid rgba(243, 199, 91, 0.3); border-radius: 12px; background: rgba(243, 199, 91, 0.06); }
.weekly-streak .eyebrow { margin: 0 0 2px; color: var(--gold); }
.weekly-streak h2 { margin: 0; font-size: 0.9rem; }
.weekly-streak > strong { grid-column: 2; grid-row: 1 / span 2; color: var(--gold); font-size: 1.4rem; white-space: nowrap; }
.weekly-streak > p { grid-column: 1; margin: 0; font-size: 0.7rem; }
.task-suggestions { margin-bottom: 24px; padding-bottom: 21px; border-bottom: 1px solid var(--border); }
.task-suggestions h2 { margin: 0 0 12px; font-size: 1rem; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.suggestion-grid article { display: grid; justify-items: start; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(23, 24, 36, 0.4); }
.suggestion-grid article > span { color: var(--muted); font-size: 0.75rem; }
.suggestion-grid article > strong { font-size: 1.15rem; }
.task-suggestions > .muted { margin: 11px 0 0; font-size: 0.73rem; }
.task-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.task-progress { display: grid; grid-template-columns: minmax(120px, 0.5fr) 1fr; align-items: center; gap: 16px; margin-top: 18px; color: var(--muted); font-size: 0.8rem; }
.task-check { width: 19px; min-width: 19px; height: 19px; min-height: 19px; accent-color: var(--green); }
.task-row label { display: flex; align-items: center; gap: 12px; min-width: 0; }
.task-title { overflow-wrap: anywhere; }
.task-source { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; background: rgba(243, 199, 91, 0.1); color: var(--gold); font-size: 0.64rem; }
.task-row.completed .task-title { color: var(--muted); text-decoration: line-through; }
.empty-state { padding: 30px 12px; color: var(--muted); text-align: center; }

.print-report { display: none; }
@media print {
    body.report-print { background: #fff !important; color: #171717 !important; }
    body.report-print .app-shell { display: none !important; }
    body.report-print #redemptionReport { display: block !important; max-width: none; padding: 0; color: #171717; font-family: Arial, sans-serif; }
    body.report-print #redemptionReport h1 { margin: 0 0 5px; font-size: 24pt; }
    body.report-print #redemptionReport h2 { margin: 20px 0 8px; font-size: 14pt; }
    body.report-print #redemptionReport p { margin: 4px 0; font-size: 10pt; }
    body.report-print #redemptionReport .report-meta { color: #555; }
    body.report-print #redemptionReport .report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
    body.report-print #redemptionReport .report-metric { padding: 10px; border: 1px solid #bbb; border-radius: 6px; }
    body.report-print #redemptionReport .report-metric strong { display: block; margin-top: 4px; font-size: 13pt; }
    body.report-print #redemptionReport ul { padding-left: 20px; }
    body.report-print #redemptionReport li { margin: 5px 0; font-size: 10pt; }
    body.report-print #redemptionReport .report-disclaimer { margin-top: 24px; padding-top: 10px; border-top: 1px solid #aaa; color: #444; font-size: 9pt; }
}

.settings-page { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.settings-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 0.8rem; }
.category-budget-heading { margin: 26px 0 12px; font-size: 1rem; }
.settings-note { margin: 16px 0; font-size: 0.8rem; }
.custom-goals-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 12px; }
.custom-goals-heading .category-budget-heading { margin: 0; }
.custom-goals-heading .settings-note { margin: 4px 0 0; }
.tile-setting-list { display: grid; gap: 10px; }
.tile-setting-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 0.6fr) auto; align-items: end; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(23, 24, 36, 0.35); }
.tile-setting-row-metric { grid-template-columns: minmax(0, 1fr) auto; }
.tile-setting-row label { display: grid; gap: 6px; color: var(--muted); font-size: 0.8rem; }
.custom-goal-settings { display: grid; gap: 10px; }
.custom-goal-setting-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 0.6fr) auto; align-items: end; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(23, 24, 36, 0.35); }
.custom-goal-setting-row label { display: grid; gap: 6px; color: var(--muted); font-size: 0.8rem; }
.custom-goal-remove { white-space: nowrap; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 15px; border-top: 1px solid var(--border); }
.settings-actions .form-status { margin: 0; }

.app-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding: 12px 4px; color: var(--muted); font-size: 0.72rem; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.auth-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35); }
.auth-card h1 { margin: 8px 0; font-size: 1.8rem; }
.auth-card > p:not(.eyebrow) { margin: 0 0 24px; color: var(--muted); }
.auth-card form { display: grid; gap: 10px; }
.auth-card label { color: var(--muted); font-size: 0.82rem; }
.auth-card input { min-height: 48px; }
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 58px; }
.auth-card .password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: grid;
    width: 40px;
    min-height: 40px;
    place-items: center;
    margin: 0;
    padding: 8px;
    transform: translateY(-50%);
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
}
.password-toggle-icon { display: block; width: 20px; height: 20px; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-card form > button[type="submit"] { min-height: 46px; margin-top: 5px; border: 0; border-radius: 10px; background: var(--gold); color: #252435; cursor: pointer; font-weight: 750; }
.auth-status { min-height: 1.4em; margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; }
.auth-status.error { color: var(--coral); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 1050px) {
    .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .debt-goal-layout { grid-template-columns: 1fr; }
    .tax-projection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .annual-lower-grid { grid-template-columns: 1fr; }
    .app-header { flex-wrap: wrap; }
    .primary-nav { order: 3; width: 100%; justify-content: flex-start; }
}

@media (max-width: 680px) {
    .app-shell { padding: max(12px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom)); }
    .app-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 24px; padding: 12px; }
    .brand { grid-column: 1; grid-row: 1; min-width: 0; }
    .brand-mark { width: 38px; height: 38px; }
    .brand strong { font-size: 0.9rem; }
    .brand small { display: none; }
    .primary-nav { order: 0; grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: auto; gap: 4px; overflow: visible; }
    .nav-tab { min-width: 0; padding: 0 6px; font-size: 0.74rem; white-space: nowrap; }
    .header-actions { grid-column: 2; grid-row: 1; gap: 6px; }
    .text-button { padding: 9px; font-size: 0.75rem; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 18px; }
    .sync-pill { max-width: 100%; }
    .redemption-countdown { gap: 13px; padding: 17px; }
    .redemption-countdown-heading, .redemption-countdown-details { align-items: flex-start; flex-direction: column; gap: 5px; }
    .debt-main-card, .debt-strategy-card { padding: 17px; }
    .repayment-capacity { padding: 17px; }
    .repayment-capacity .section-heading .muted { text-align: left; }
    .repayment-capacity-layout { grid-template-columns: 1fr; }
    .capacity-result { align-items: flex-start; }
    .debt-subtiles { grid-template-columns: 1fr; }
    .scenario-grid, .spending-priority-grid { grid-template-columns: 1fr; }
    .simulator-card, .tax-projection-card { padding: 17px; }
    .tax-projection-card .section-heading > .muted { max-width: none; text-align: left; }
    .tax-projection-grid { grid-template-columns: 1fr 1fr; }
    .debt-envelope-card, .overrun-card { padding: 16px; }
    .debt-envelope-values { grid-template-columns: 1fr; gap: 9px; }
    .goal-grid, .period-grid { grid-template-columns: 1fr; gap: 11px; }
    .goal-card, .metric-card { min-height: auto; }
    .goal-card { padding: 17px; }
    .goal-card h2 { min-height: auto; margin: 12px 0 8px; }
    .goal-gauge { flex-basis: 82px; width: 82px; height: 82px; }
    .metric-card { gap: 8px; padding: 17px; }
    .period-card { min-height: 155px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .form-card, .chart-card, .category-card, .task-card { padding: 16px; }
    .inline-form { grid-template-columns: 1fr 1fr; }
    .inline-form select { grid-column: 1 / -1; }
    .inline-form button { grid-column: 1 / -1; }
    .upload-row { align-items: stretch; flex-direction: column; }
    .upload-row > * { width: 100%; }
    .paystub-number-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .tile-setting-row, .tile-setting-row-metric { grid-template-columns: 1fr; }
    .custom-goals-heading { align-items: stretch; flex-direction: column; }
    .custom-goal-setting-row { grid-template-columns: 1fr; }
    .settings-actions { align-items: stretch; flex-direction: column; }
    .task-form { grid-template-columns: 1fr; }
    .suggestion-grid { grid-template-columns: 1fr; }
    .task-progress { grid-template-columns: 1fr; gap: 8px; }
    .category-actions { width: 100%; }
    .category-actions .button { flex: 1 1 100%; }
    .week-picker-label { margin: 0; }
    .app-footer { font-size: 0.66rem; }
}

@media (max-width: 360px) {
    .brand { gap: 6px; }
    .brand strong { font-size: 0.84rem; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
