/* --------------------------------------------------------------------------
   TAX AGENT - light editorial theme
   Paper-white surfaces, hairline borders, tabular figures, one red accent.
   -------------------------------------------------------------------------- */

:root {
    --bg-page: #f6f6f4;
    --bg-panel: #ffffff;
    --bg-subtle: #f1f1ee;
    --border: #e4e4df;
    --border-strong: #d2d2cb;

    --ink: #191917;
    --text-muted: #6e6e67;
    --text-soft: #43433e;

    --accent: #d5301e;          /* Swiss red - brand + emphasis only */
    --accent-soft: #fdeeec;
    --ink-btn: #21211e;         /* near-black primary buttons */
    --ink-btn-hover: #000000;

    --color-primary: #d5301e;
    --color-success: #1e7a4c;
    --color-success-soft: #e9f4ee;
    --color-info: #2b5e9e;
    --color-warning: #a8690a;

    --radius: 10px;
    --shadow-card: 0 1px 2px rgba(25, 25, 23, 0.05);
    --transition-smooth: all 0.18s ease;
    --sidebar-width: 264px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }

body {
    background-color: var(--bg-page);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
}
h1 { font-size: 24px; }
h3 { font-size: 16px; }

a { color: inherit; text-decoration: none; }

/* Numbers should line up like a bank statement */
.stat-value, .stat-value-sub, .breakdown-value, .ledger-item-amount,
.sug-savings-amt, .vault-table td, .progress-percent {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* Loading overlay */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(246, 246, 244, 0.82);
    backdrop-filter: blur(2px);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 9999;
    transition: var(--transition-smooth);
}
.loading-overlay p { color: var(--text-soft); font-size: 14px; font-weight: 500; }
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   AUTH
   -------------------------------------------------------------------------- */
.auth-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; padding: 24px;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 40px 36px;
}
.auth-header { text-align: left; margin-bottom: 28px; }
.auth-header h1 { font-size: 22px; margin: 14px 0 6px; }
.auth-header p { color: var(--text-muted); font-size: 14px; }

.logo-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    background: var(--accent);
    color: #fff; border-radius: 8px;
}
.logo-icon svg { width: 18px; height: 18px; }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12.5px; font-weight: 600;
    color: var(--text-soft); margin-bottom: 6px;
}
.input-wrapper { position: relative; }
.input-wrapper > i, .input-wrapper > svg {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.input-control {
    width: 100%;
    padding: 11px 14px 11px 40px;
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-family: inherit; font-size: 14.5px; color: var(--ink);
    transition: var(--transition-smooth);
}
.input-control::placeholder { color: #a3a39b; }
.input-control:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(25, 25, 23, 0.08);
}
.input-select { appearance: none; padding-left: 14px; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e67' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 11px 18px;
    border: none; border-radius: 8px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition-smooth);
    text-decoration: none;
}
.btn svg, .btn i { width: 16px; height: 16px; }
.btn-primary { background: var(--ink-btn); color: #ffffff; }
.btn-primary:hover { background: var(--ink-btn-hover); }
.btn-secondary {
    background: var(--bg-panel); color: var(--ink);
    border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-danger {
    background: var(--bg-panel); color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-danger:hover { background: var(--accent); color: #ffffff; }

.data-facts {
    margin: 0 0 20px; padding: 0 0 0 18px;
    font-size: 13.5px; line-height: 1.6; color: var(--text-muted);
}
.data-facts li { margin-bottom: 6px; }
.form-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--text-muted); }

.auth-footer {
    margin-top: 22px; padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 13.5px; color: var(--text-muted);
    display: flex; gap: 6px;
}
.auth-footer a { color: var(--accent); font-weight: 600; }
.auth-disclaimer {
    margin-top: 14px; font-size: 12px; color: var(--text-muted); line-height: 1.45;
}

/* --------------------------------------------------------------------------
   APP SHELL
   -------------------------------------------------------------------------- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 24px 16px;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 10px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.sidebar-brand h2 { font-size: 17px; letter-spacing: -0.01em; }

.sidebar-menu { list-style: none; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-item a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 7px;
    font-size: 14px; font-weight: 500; color: var(--text-soft);
    transition: var(--transition-smooth);
}
.sidebar-item a svg, .sidebar-item a i { width: 17px; height: 17px; color: var(--text-muted); }
.sidebar-item a:hover { background: var(--bg-subtle); color: var(--ink); }
.sidebar-item.active a {
    background: var(--bg-subtle); color: var(--ink); font-weight: 600;
}
.sidebar-item.active a svg, .sidebar-item.active a i { color: var(--accent); }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px; display: flex; flex-direction: column; gap: 12px;
}
.user-profile-badge { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--ink); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-email {
    font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Language picker: compact select reused in the sidebar footer and floated
   top-right on the auth/onboarding screens (both centered flex layouts, so
   it needs to sit outside their normal flow). */
.lang-picker { width: auto; }
.lang-picker .input-control {
    width: auto;
    padding: 8px 28px 8px 12px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 8px;
    background-size: 10px;
    background-position: right 10px center;
}
.auth-lang-picker {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 20;
}
.auth-lang-picker .input-control {
    background-color: var(--bg-panel);
    box-shadow: var(--shadow-card);
}

.main-wrapper {
    flex: 1; min-width: 0;
    padding: 36px 44px 64px;
    max-width: 1160px;
}

.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; margin-bottom: 28px;
}
.page-header p { margin-top: 4px; }

.ai-review-card {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
    margin-bottom: 20px; padding: 18px 20px;
    border: 1px solid #d9cfc8; border-radius: var(--radius);
    background: linear-gradient(135deg, #fff 0%, #fff8f5 100%);
    box-shadow: var(--shadow-card);
}
.ai-review-icon {
    width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: var(--accent-soft); color: var(--accent);
}
.ai-review-icon svg { width: 20px; height: 20px; }
.ai-review-card h3 { margin: 2px 0; }
.ai-review-card p { color: var(--text-muted); font-size: 12.5px; }
.ai-review-card .btn { width: auto; white-space: nowrap; }

/* --------------------------------------------------------------------------
   CARDS & DASHBOARD
   -------------------------------------------------------------------------- */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
}
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 svg, .card h3 i { width: 16px; height: 16px; color: var(--text-muted); }

.dashboard-grid {
    display: grid; grid-template-columns: 3fr 2fr;
    gap: 20px; margin-bottom: 20px;
}
.card-hero {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 24px;
}

.hero-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hero-cadence-box {
    flex: 0 0 auto;
    width: 280px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.hero-cadence-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.hero-cadence-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.hero-cadence-badge svg, .hero-cadence-badge i {
    width: 11px;
    height: 11px;
    color: var(--accent);
}

.hero-cadence-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hero-cadence-amount {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.hero-cadence-amount .stat-value {
    font-size: 24px;
    color: var(--color-success);
    line-height: 1.1;
    margin: 0;
}

.hero-cadence-frequency {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.hero-cadence-timing {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-muted);
}

.hero-cadence-timing svg, .hero-cadence-timing i {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--text-muted);
}

.hero-cadence-progress-section {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hero-cadence-meter {
    height: 5px;
    border-radius: 999px;
    background: var(--border-strong);
    overflow: hidden;
    position: relative;
    width: 100%;
}

.hero-cadence-meter-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.hero-cadence-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.hero-cadence-footer-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.widget-icon {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.widget-icon svg, .widget-icon i { width: 17px; height: 17px; }

.stat-label {
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--text-muted);
}
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 2px; }
.stat-value-sub { font-size: 13px; color: var(--text-muted); }

.hero-note {
    margin-top: 10px; font-size: 12.5px; color: var(--text-soft);
    background: var(--bg-subtle); border-radius: 6px; padding: 7px 10px;
    display: inline-block;
}

.dashboard-insights-card { margin-top: 20px; }
.dashboard-insights-card h3 {
    display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.dashboard-insights-card.is-loading h3 svg {
    animation: tips-pulse 1.2s ease-in-out infinite;
}
.dashboard-insights-loading {
    color: var(--text-muted); font-size: 13px; margin: 0 0 12px;
    animation: tips-pulse 1.2s ease-in-out infinite;
}
.dashboard-insights-list { display: flex; flex-direction: column; gap: 12px; }
.dashboard-insight {
    border-left: 3px solid var(--border-color, #d8d8d2);
    padding: 4px 0 4px 12px;
}
.dashboard-insight h4 { margin: 0 0 4px; font-size: 14px; }
.dashboard-insight p {
    margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted);
}
.dashboard-insight.tone-positive { border-left-color: var(--color-success); }
.dashboard-insight.tone-attention { border-left-color: var(--color-warning); }
.dashboard-insight.tone-info { border-left-color: #2f6fed; }

/* Shared indeterminate bar for any Gemini wait state */
.gemini-progress {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: var(--bg-subtle, #ecece8);
    overflow: hidden;
    width: 100%;
    max-width: 280px;
}
.gemini-progress-bar {
    position: absolute;
    top: 0; bottom: 0;
    left: 0;
    width: 40%;
    border-radius: 999px;
    background: var(--accent, #d5301e);
    animation: gemini-progress-slide 1.4s ease-in-out infinite;
}
.gemini-progress-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--text-soft, var(--text-muted));
}
@keyframes gemini-progress-slide {
    0% { left: -40%; width: 40%; }
    50% { left: 20%; width: 55%; }
    100% { left: 100%; width: 40%; }
}
.loading-overlay .gemini-progress {
    max-width: 220px;
    margin-top: 4px;
}
.loading-overlay .gemini-progress-hint {
    margin-top: 12px;
}
.chat-gemini-wait {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
}
.chat-gemini-wait-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}
.chat-gemini-wait .gemini-progress { max-width: 100%; }
.wizard-tips.is-loading .gemini-progress,
.wizard-info.is-loading .gemini-progress,
.wizard-loading .gemini-progress {
    max-width: 100%;
    margin-top: 4px;
}
.wizard-tips.is-loading .gemini-progress-hint,
.wizard-info.is-loading .gemini-progress-hint,
.wizard-loading .gemini-progress-hint {
    margin-top: 8px;
}
.gemini-refine-row {
    margin-top: 12px;
}
.gemini-refine-row .dashboard-insights-loading,
.gemini-refine-row .wizard-tips-loading-text {
    margin-bottom: 8px;
}
.dashboard-insights-card.is-refining .gemini-progress,
.wizard-tips.is-refining .gemini-progress {
    max-width: 100%;
}

/* progress ring */
.progress-circle-svg { transform: rotate(-90deg); }
.progress-circle-bg { fill: none; stroke: var(--bg-subtle); stroke-width: 10; }
.progress-circle-fill {
    fill: none; stroke: var(--color-success); stroke-width: 10;
    stroke-linecap: round; transition: stroke-dashoffset 0.6s ease;
}
.progress-text-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
.progress-percent { font-size: 22px; font-weight: 700; }
.savings-progress-details { flex: 1; min-width: 0; }
.source-tax-indicator {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin: 9px 0; padding: 7px 9px;
    border-radius: 7px; background: var(--color-success-soft);
    color: var(--color-success); font-size: 12.5px;
}
.source-tax-indicator span { display: flex; align-items: center; gap: 6px; }
.source-tax-indicator svg, .source-tax-indicator i { width: 14px; height: 14px; flex-shrink: 0; }
.source-tax-indicator strong { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* "Checked against the federal calculator on <date>" - a quiet reassurance
   under the estimate, not a badge competing with it. Deliberately understated:
   being right is the baseline, not an achievement to advertise. */
.verified-note {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: 8px;
    margin-top: -6px; padding: 8px 12px;
    border-radius: 8px; background: var(--color-success-soft);
    color: var(--color-success); font-size: 12.5px;
}
.verified-note svg, .verified-note i { width: 14px; height: 14px; flex-shrink: 0; }
.verified-note-warn {
    background: var(--color-warning-soft, #fef3c7);
    color: var(--color-warning, #b45309);
}

.dashboard-detail-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }

/* Suggestions */
.optimization-panel h3 { margin-bottom: 6px; }
.suggestion-list { display: flex; flex-direction: column; }
.suggestion-item {
    display: flex; justify-content: space-between; gap: 18px;
    padding: 16px 0; border-bottom: 1px solid var(--border);
}
.suggestion-item:last-child { border-bottom: none; padding-bottom: 4px; }
.sug-info h4 { font-size: 14.5px; margin-top: 7px; }
.sug-info p { font-size: 13.5px; color: var(--text-soft); margin-top: 4px; }
.sug-info p strong { color: var(--ink); }

.sug-badge {
    font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
    padding: 3px 8px; border-radius: 999px; text-transform: uppercase;
}
.sug-badge-active { background: var(--accent-soft); color: var(--accent); }
.sug-badge-maxed { background: var(--color-success-soft); color: var(--color-success); }

.sug-savings { text-align: right; flex-shrink: 0; min-width: 110px; }
.sug-savings-amt { font-size: 16px; font-weight: 700; color: var(--color-success); }
.sug-savings-label { font-size: 11px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   CALCULATOR
   -------------------------------------------------------------------------- */
.calculator-layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
.calc-section-title { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid-full { grid-column: 1 / -1; }
.form-grid .form-group { margin-bottom: 0; }

.form-section-divider {
    grid-column: 1 / -1;
    margin-top: 10px; padding-top: 16px;
    border-top: 1px solid var(--border);
}
.form-section-divider h4 { font-size: 13.5px; }
.form-section-divider p { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.form-help { margin-top: 5px; color: var(--text-muted); font-size: 11.5px; }

.carry-forward-notice {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 13px 14px; border: 1px solid #e5c17c; border-radius: 8px;
    background: #fff9ed;
}
.carry-forward-notice strong { font-size: 13px; color: var(--color-warning); }
.carry-forward-notice p { margin-top: 2px; color: var(--text-soft); font-size: 12px; }
.carry-forward-notice .btn { width: auto; flex-shrink: 0; font-size: 12px; }

.checkbox-control {
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
    padding: 12px 13px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-subtle);
}
.checkbox-control input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }
.checkbox-control span { display: flex; flex-direction: column; }
.checkbox-control strong { font-size: 13px; }
.checkbox-control small { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }

.currency-prefix {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    font-style: normal; font-weight: 600; font-size: 13px; color: var(--text-muted);
}

.breakdown-chart-box { display: flex; flex-direction: column; align-items: center; }

.breakdown-list { width: 100%; display: flex; flex-direction: column; }
.breakdown-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 2px; border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row.breakdown-total { border-top: 1px solid var(--border-strong); font-weight: 700; }
.breakdown-row.breakdown-credit .breakdown-value { color: var(--color-success); }
.breakdown-label { display: flex; align-items: center; gap: 8px; color: var(--text-soft); }
.breakdown-value { font-weight: 600; }
.color-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.deduction-summary-note {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    margin-bottom: 8px; padding: 9px 10px; border-radius: 7px;
    background: var(--color-success-soft); color: var(--color-success); font-size: 12px;
}
.deduction-summary-note span { display: flex; align-items: center; gap: 6px; }
.deduction-summary-note svg { width: 14px; height: 14px; }
.deduction-summary-note strong { text-align: right; }

/* --------------------------------------------------------------------------
   VAULT
   -------------------------------------------------------------------------- */
.vault-dropzone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-panel);
    padding: 24px;
    display: flex; align-items: center; justify-content: center; gap: 16px;
    text-align: left; cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 10px;
}
.vault-dropzone:hover, .vault-dropzone.dragover {
    border-color: var(--accent);
    background: #fffdfc;
}
.vault-dropzone svg, .vault-dropzone > i { width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }
.vault-dropzone h3 { margin-bottom: 3px; font-size: 15.5px; }
.vault-dropzone p { font-size: 13px; color: var(--text-muted); }
.file-input { display: none; }
.vault-upload-actions {
    display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 20px;
}
.vault-upload-actions .btn { width: auto; font-size: 12.5px; }
.vault-proposals {
    margin-bottom: 20px; padding: 18px;
    border: 1px solid #e5c17c; border-radius: var(--radius);
    background: #fff9ed;
}
.vault-proposals-header {
    display: flex; justify-content: space-between; align-items: center; gap: 18px;
    margin-bottom: 12px;
}
.vault-proposals-header p { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.vault-proposals-header .btn { width: auto; flex-shrink: 0; font-size: 12px; }
.vault-proposals .review-proposal { width: 100%; margin-top: 10px; }

.page-description { color: var(--text-muted); font-size: 14px; max-width: 780px; }

.vault-overview {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}
.vault-overview-item {
    display: flex; flex-direction: column;
    padding: 14px 18px; border-right: 1px solid var(--border);
}
.vault-overview-item:last-child { border-right: none; }
.vault-overview-value { font-size: 20px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.vault-overview-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.vault-overview-item.has-warning .vault-overview-value { color: var(--color-warning); }

.vault-list { display: flex; flex-direction: column; gap: 12px; }
.vault-year-group {
    overflow: hidden; background: var(--bg-panel);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.vault-year-header {
    min-height: 58px; padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    cursor: pointer; list-style: none; user-select: none;
}
.vault-year-header::-webkit-details-marker { display: none; }
.vault-year-header:hover { background: var(--bg-subtle); }
.vault-year-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vault-year-chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.18s ease; }
.vault-year-group[open] .vault-year-chevron { transform: rotate(90deg); }
.vault-year-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.vault-current-badge {
    display: inline-block; margin-left: 8px; padding: 2px 7px;
    border-radius: 999px; background: var(--accent-soft); color: var(--accent);
    font-size: 10.5px; font-weight: 650; vertical-align: 2px;
}
.vault-year-count { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.vault-table-wrap { border-top: 1px solid var(--border); overflow-x: auto; }

.vault-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.vault-table th {
    text-align: left; font-size: 11px; font-weight: 600;
    letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted);
    padding: 9px 12px; border-bottom: 1px solid var(--border);
    background: #fafaf8;
}
.vault-table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.vault-table tr:last-child td { border-bottom: none; }
.vault-table tbody tr:hover { background: #fdfdfb; }
.doc-name { display: flex; align-items: center; gap: 8px; min-width: 180px; font-weight: 500; overflow-wrap: anywhere; }
.doc-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.doc-summary { color: var(--text-soft); max-width: 540px; }
.doc-amount { display: inline-block; margin-left: 4px; font-weight: 650; color: var(--ink); white-space: nowrap; }
.doc-warning { display: flex; align-items: flex-start; gap: 5px; color: var(--color-warning); font-size: 12.5px; margin-top: 5px; }
.doc-warning svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; }
.doc-upload-date { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.doc-actions { width: 48px; text-align: right !important; }
.vault-year-note {
    display: flex; align-items: center; gap: 7px;
    color: var(--text-muted); font-size: 12.5px; padding: 0 6px 4px;
}
.vault-year-note svg { width: 14px; height: 14px; flex-shrink: 0; }
.vault-empty { text-align: center; padding: 44px 24px; color: var(--text-muted); }
.vault-empty > svg { width: 28px; height: 28px; margin-bottom: 10px; }
.vault-empty h3 { margin-bottom: 4px; }
.vault-empty p { font-size: 13px; }

.badge-doc-type {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 3px 8px; border-radius: 999px;
    background: var(--bg-subtle); color: var(--text-soft);
    text-transform: capitalize; white-space: nowrap;
}
.badge-doc-type.payslip, .badge-doc-type.salary_certificate { background: #eaf1f8; color: var(--color-info); }
.badge-doc-type.pillar_3a { background: var(--color-success-soft); color: var(--color-success); }
.badge-doc-type.medical_bill, .badge-doc-type.health_insurance { background: #fdf3e6; color: var(--color-warning); }
.badge-doc-type.bank_statement { background: #f0ecf8; color: #5b4a9e; }
.badge-doc-type.tax_return { background: var(--accent-soft); color: var(--accent); }
.badge-doc-type.blank_tax_form { background: #eceef2; color: #445; }

.btn-delete {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 6px; border-radius: 6px;
    transition: var(--transition-smooth);
}
.btn-delete svg, .btn-delete i { width: 17px; height: 17px; }
.btn-delete:hover { color: var(--accent); background: var(--accent-soft); }

/* --------------------------------------------------------------------------
   SAVINGS LEDGER
   -------------------------------------------------------------------------- */
.ledger-layout { display: grid; grid-template-columns: 1fr 1.6fr; gap: 20px; align-items: start; }
.ledger-list { display: flex; flex-direction: column; }
.ledger-item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 0; border-bottom: 1px solid var(--border);
}
.ledger-item:last-child { border-bottom: none; }
.ledger-item-icon {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    background: var(--color-success-soft); color: var(--color-success);
    display: flex; align-items: center; justify-content: center;
}
.ledger-item-icon svg, .ledger-item-icon i { width: 15px; height: 15px; }
.ledger-item-icon.withdrawal { background: var(--accent-soft); color: var(--accent); }
.ledger-item-details { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ledger-item-title { font-size: 13.5px; font-weight: 500; }
.ledger-item-date { font-size: 12px; color: var(--text-muted); }
.ledger-item-amount { font-size: 14px; font-weight: 700; color: var(--color-success); }
.ledger-item-amount.withdrawal { color: var(--accent); }
.savings-type-toggle {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px;
    padding: 4px; border-radius: 10px; background: var(--bg-subtle);
}
.savings-type-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 10px; border: 0; border-radius: 7px; cursor: pointer;
    background: transparent; color: var(--text-muted);
    font-family: inherit; font-size: 13px; font-weight: 600;
    transition: var(--transition-smooth);
}
.savings-type-btn svg, .savings-type-btn i { width: 15px; height: 15px; }
.savings-type-btn.active { background: var(--bg-panel); color: var(--ink); box-shadow: var(--shadow-card); }
.savings-summary {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px;
    padding-top: 16px; border-top: 1px solid var(--border);
}
.savings-summary span { display: block; margin-bottom: 3px; color: var(--text-muted); font-size: 11px; }
.savings-summary strong { font-size: 15px; }

/* --------------------------------------------------------------------------
   DEDUCTION REVIEW WIZARD
   -------------------------------------------------------------------------- */
.formatted-heading {
    display: block; margin: 10px 0 3px;
    color: var(--ink); font-size: 14px; font-weight: 700;
}
.formatted-heading:first-child { margin-top: 0; }
.wizard-cancel { width: auto; }
.wizard-progress {
    display: grid; grid-template-columns: repeat(5, 1fr);
    margin-bottom: 26px;
}
.wizard-progress > div {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
    min-width: 0; color: var(--text-muted); text-align: center;
}
.wizard-progress > div::after {
    content: ""; position: absolute; height: 2px; top: 14px;
    left: calc(50% + 19px); right: calc(-50% + 19px);
    background: var(--border); z-index: 0;
}
.wizard-progress > div:last-child::after { display: none; }
.wizard-progress span {
    position: relative; z-index: 1; width: 30px; height: 30px; flex: 0 0 30px;
    display: grid; place-items: center; border-radius: 50%;
    border: 1.5px solid var(--border-strong); background: var(--bg-panel);
    font-size: 12px; font-weight: 700;
    transition: var(--transition-smooth);
}
.wizard-progress small {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.wizard-progress .active, .wizard-progress .complete { color: var(--accent); }
.wizard-progress .active span, .wizard-progress .complete span {
    color: #fff; border-color: var(--accent); background: var(--accent);
}
.wizard-progress .active span { box-shadow: 0 0 0 4px var(--accent-soft); }
.wizard-progress .complete::after { background: var(--accent); }
.wizard-progress span svg, .wizard-progress span i { width: 15px; height: 15px; }
.deduction-wizard { max-width: 860px; margin: 0 auto; }
.wizard-heading { padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.wizard-heading h2 { margin: 4px 0 5px; font-size: 22px; }
.wizard-heading p { color: var(--text-muted); font-size: 13.5px; }
.wizard-fields { display: grid; grid-template-columns: 1fr; gap: 18px; padding: 22px 0; }
.wizard-fields.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wizard-full { grid-column: 1 / -1; }
.wizard-field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 600; }
.wizard-evidence {
    display: flex; align-items: center; gap: 5px; margin-top: 6px;
    color: var(--color-success); font-size: 11.5px;
}
.wizard-evidence svg { width: 13px; height: 13px; }
.wizard-source-card, .wizard-info {
    display: flex; align-items: center; gap: 12px; margin-top: 20px;
    padding: 13px 14px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--bg-subtle);
}
.wizard-source-card > svg, .wizard-info > svg {
    width: 20px; height: 20px; flex: 0 0 20px; color: var(--accent);
}
.wizard-source-card > div { flex: 1; min-width: 0; }
.wizard-source-card p, .wizard-info p {
    margin-top: 2px; color: var(--text-muted); font-size: 12px; line-height: 1.45;
}
.wizard-source-card .btn { width: auto; flex: 0 0 auto; font-size: 12px; }
.wizard-source-card.muted svg { color: var(--text-muted); }
.multiplier-legend {
    display: flex; gap: 8px; align-items: flex-start;
    margin-top: 16px; padding: 10px 12px; border-radius: 8px;
    background: var(--bg-subtle); border: 1px solid var(--border);
    font-size: 11.5px; line-height: 1.5; color: var(--text-muted);
}
.multiplier-legend svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; color: var(--accent); }
.multiplier-legend strong { color: var(--text-primary); }

.wizard-tips {
    margin: 20px 0 4px; padding: 14px 16px; border-radius: 10px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--bg-subtle), rgba(220, 38, 38, 0.035));
}
.wizard-tips-header {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.wizard-tips-header svg { width: 14px; height: 14px; }
.wizard-tip { padding: 7px 0; }
.wizard-tip + .wizard-tip { border-top: 1px dashed var(--border); }
.wizard-tip strong { display: block; font-size: 12.5px; margin-bottom: 2px; }
.wizard-tip p { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.wizard-tips.is-loading .wizard-tips-header svg { animation: tips-pulse 1.2s ease-in-out infinite; }
.wizard-tips-loading-text {
    color: var(--text-muted); font-size: 12px;
    animation: tips-pulse 1.2s ease-in-out infinite;
}
@keyframes tips-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.wizard-actions {
    display: flex; align-items: center; gap: 9px;
    padding-top: 18px; border-top: 1px solid var(--border);
}
.wizard-actions .btn { width: auto; }
.wizard-actions .btn:last-child { margin-left: auto; }
.wizard-loading {
    min-height: 260px; display: grid; place-items: center; align-content: center;
    gap: 12px; color: var(--text-muted);
}
.wizard-loading svg, .wizard-info .lucide-loader-circle {
    animation: wizard-spin 1s linear infinite;
}
@keyframes wizard-spin { to { transform: rotate(360deg); } }
.wizard-summary { padding: 22px 0; }
.wizard-summary-impact {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px;
}
.wizard-summary-impact > div {
    padding: 14px; border-radius: 9px; background: var(--color-success-soft);
}
.wizard-summary-impact span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 11px; }
.wizard-summary-impact strong { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.wizard-summary-impact svg { width: 13px; height: 13px; }
.wizard-review-list { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.wizard-review-list > div {
    display: flex; justify-content: space-between; gap: 15px;
    padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.wizard-review-list > div:last-child { border-bottom: 0; }
.wizard-review-list span { color: var(--text-muted); }
.wizard-disclaimer { margin-top: 12px; color: var(--text-muted); font-size: 11.5px; }

/* --------------------------------------------------------------------------
   TAX ASSISTANT (READ-ONLY CHAT)
   -------------------------------------------------------------------------- */
.chat-card {
    display: flex; flex-direction: column;
    height: calc(100vh - 220px); min-height: 420px;
    padding: 0; overflow: hidden;
}
.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 24px;
    display: flex; flex-direction: column; gap: 12px;
}
.chat-bubble {
    max-width: 78%;
    padding: 11px 15px;
    border-radius: 12px;
    font-size: 14px; line-height: 1.55;
    white-space: normal; overflow-wrap: break-word;
}
.chat-message { display: flex; flex-direction: column; max-width: 82%; }
.chat-message.user { align-self: flex-end; align-items: flex-end; }
.chat-message.model { align-self: flex-start; align-items: flex-start; }
.chat-message .chat-bubble { max-width: 100%; }
.chat-bubble.user {
    align-self: flex-end;
    background: var(--ink-btn); color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble.model {
    align-self: flex-start;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.chat-bubble .formatted-heading { color: inherit; }
.chat-reset-btn { width: auto; flex-shrink: 0; font-size: 12.5px; }
.chat-empty {
    margin: auto; text-align: center; color: var(--text-muted); font-size: 14px;
}
.chat-chips {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px;
    max-width: 480px;
}
.chat-chip {
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 8px 14px;
    font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-soft);
    cursor: pointer; transition: var(--transition-smooth);
}
.chat-chip:hover { border-color: var(--ink); color: var(--ink); }
.chat-typing { display: flex; gap: 5px; padding: 15px 17px; }
.chat-typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-muted);
    animation: typing-bounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}
.chat-input-row {
    display: flex; gap: 10px;
    padding: 14px 16px 6px;
    border-top: 1px solid var(--border);
}
.chat-disclaimer {
    font-size: 11.5px; color: var(--text-muted);
    text-align: center; padding: 6px 16px 12px;
}

/* Confirmation cards shared by the Vault and deduction review. */
.review-proposal {
    width: min(520px, 100%); margin-top: 8px; padding: 14px;
    border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--bg-panel); box-shadow: var(--shadow-card);
}
.review-proposal.resolved { opacity: 0.72; }
.proposal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 8px; font-size: 12px; font-weight: 700;
}
.proposal-header > span:first-child { display: flex; align-items: center; gap: 6px; }
.proposal-header svg { width: 15px; height: 15px; color: var(--accent); }
.proposal-status {
    padding: 2px 7px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    font-size: 10px; text-transform: capitalize;
}
.review-proposal > p { color: var(--text-soft); font-size: 12.5px; margin-bottom: 10px; }
.proposal-changes, .proposal-impact { display: flex; flex-direction: column; }
.proposal-changes > div, .proposal-impact > div {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.proposal-changes span, .proposal-impact span { color: var(--text-muted); }
.proposal-impact { margin-top: 8px; padding: 7px 9px; border-radius: 7px; background: var(--color-success-soft); }
.proposal-impact > div:last-child, .proposal-changes > div:last-child { border-bottom: none; }
/* The superseded figure, muted so the new one still reads as the answer.
   Inside <strong>, so weight is reset as well as colour. */
.proposal-changes .patch-before {
    color: var(--text-muted);
    font-weight: 400;
    text-decoration: line-through;
}
.proposal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.proposal-actions .btn { font-size: 12px; }

/* --------------------------------------------------------------------------
   TOASTS
   -------------------------------------------------------------------------- */
.notification-container {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 10px; max-width: 380px;
}
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--ink); color: #fff;
    border-radius: 8px; padding: 12px 16px;
    font-size: 13.5px; box-shadow: 0 6px 24px rgba(25, 25, 23, 0.18);
    transition: var(--transition-smooth);
}
.toast svg, .toast i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.toast.success svg, .toast.success i { color: #6fcf97; }
.toast.error svg, .toast.error i { color: #ff8a80; }

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 1000px) {
    .dashboard-grid, .dashboard-detail-grid, .calculator-layout, .ledger-layout {
        grid-template-columns: 1fr;
    }
    .main-wrapper { padding: 24px 20px 48px; }
}
@media (max-width: 760px) {
    .app-layout { display: block; min-height: 100dvh; }
    .sidebar {
        width: 100%; height: 58px; position: sticky; top: 0; z-index: 100;
        flex-direction: row; align-items: center; justify-content: space-between;
        padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
        border-right: 0; border-bottom: 1px solid var(--border);
    }
    .sidebar-brand {
        padding: 0; margin: 0; border: 0;
    }
    .sidebar-brand h2 { font-size: 15px; }
    .sidebar-menu {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
        height: calc(62px + env(safe-area-inset-bottom));
        display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
        padding: 5px 3px env(safe-area-inset-bottom);
        background: rgba(255,255,255,.96); border-top: 1px solid var(--border);
        backdrop-filter: blur(12px);
    }
    .sidebar-item a {
        height: 52px; flex-direction: column; justify-content: center; gap: 2px;
        padding: 4px 1px; font-size: 9.5px; border-radius: 7px;
    }
    .sidebar-item a svg, .sidebar-item a i { width: 19px; height: 19px; }
    .sidebar-item.active a { box-shadow: none; color: var(--accent); }
    .sidebar-footer { padding: 0; border: 0; flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .user-profile-badge { display: none; }
    .sidebar-footer .btn { width: 38px; height: 38px; padding: 0; }
    .sidebar-footer .btn span { display: none; }
    .lang-picker { order: -1; flex: 1 1 100%; }
    .main-wrapper {
        width: 100%; padding: 22px 14px calc(82px + env(safe-area-inset-bottom));
    }
    .page-header { margin-bottom: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .card-hero { flex-direction: column; }
    .hero-cadence-box { width: 100%; }
    .ai-review-card { grid-template-columns: auto 1fr; padding: 16px; }
    .ai-review-card .btn { grid-column: 1 / -1; width: 100%; }
    .chat-reset-btn { padding-inline: 12px; }
    .chat-card { height: calc(100dvh - 196px); min-height: 430px; }
    .chat-messages { padding: 14px; }
    .chat-message { max-width: 94%; }
    .wizard-progress { margin-bottom: 20px; }
    .wizard-progress small { display: none; }
    .deduction-wizard { padding: 18px 15px; }
    .wizard-fields.two-column, .wizard-summary-impact { grid-template-columns: 1fr; }
    .wizard-source-card { align-items: flex-start; flex-wrap: wrap; }
    .wizard-source-card .btn { width: 100%; }
    .wizard-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .wizard-actions .btn { width: 100%; margin: 0; }
    .wizard-actions .btn:last-child { grid-column: 1 / -1; margin: 0; }
    .wizard-review-list > div { align-items: flex-start; flex-direction: column; gap: 3px; }
    .review-proposal { width: 100%; }
    .carry-forward-notice { align-items: stretch; flex-direction: column; }
    .carry-forward-notice .btn { width: 100%; }
    .vault-dropzone { justify-content: flex-start; padding: 20px; }
    .vault-upload-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .vault-upload-actions .btn { width: 100%; }
    .vault-proposals-header { align-items: stretch; flex-direction: column; }
    .vault-proposals-header .btn { width: 100%; }
    .vault-overview-item { padding: 12px; }
    .vault-year-header { padding: 13px 14px; }
    .vault-current-badge { display: block; width: fit-content; margin: 3px 0 0; }

    .vault-table, .vault-table tbody, .vault-table tr, .vault-table td { display: block; width: 100%; }
    .vault-table thead { display: none; }
    .vault-table tr { position: relative; padding: 14px 48px 14px 14px; border-bottom: 1px solid var(--border); }
    .vault-table tr:last-child { border-bottom: none; }
    .vault-table td {
        display: grid; grid-template-columns: 76px minmax(0, 1fr);
        gap: 8px; padding: 5px 0; border: none;
    }
    .vault-table td::before {
        content: attr(data-label); color: var(--text-muted);
        font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    }
    .vault-table .doc-name { display: grid; min-width: 0; }
    .vault-table .doc-name .doc-icon { display: none; }
    .vault-table .doc-actions {
        position: absolute; top: 9px; right: 8px;
        display: block; width: auto; padding: 0;
    }
    .doc-summary { max-width: none; }
    .notification-container {
        left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top));
        max-width: none;
    }
}

/* ------------------------------------------------------------------ */
/* ONBOARDING WIZARD                                                   */
/* ------------------------------------------------------------------ */
.onboarding-shell {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px calc(40px + env(safe-area-inset-bottom));
    background: var(--bg-body);
}
.onboarding-card { width: 100%; max-width: 720px; }
.onboarding-brand { text-align: center; margin-bottom: 26px; }
.onboarding-brand .logo-icon {
    display: inline-grid; place-items: center; width: 44px; height: 44px;
    border-radius: 12px; background: var(--accent); color: #fff; margin-bottom: 10px;
}
.onboarding-brand h2 { font-size: 21px; }
.onboarding-brand p { margin-top: 4px; color: var(--text-muted); font-size: 13.5px; }
#onboarding-step h2 { font-size: 19px; margin-bottom: 6px; }
.onboarding-lead { color: var(--text-muted); font-size: 13.5px; line-height: 1.55; margin-bottom: 20px; }
#onboarding-step { padding-bottom: 22px; }
.residence-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.residence-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
    padding: 16px; border: 1.5px solid var(--border); border-radius: 12px;
    background: var(--bg-panel); text-align: left; cursor: pointer;
    transition: var(--transition-smooth); font-family: inherit;
}
.residence-card:hover { border-color: var(--accent); }
.residence-card-wide { grid-column: 1 / -1; }
.residence-card.selected {
    border-color: var(--accent); background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.residence-card svg { width: 22px; height: 22px; color: var(--accent); }
.residence-card strong { font-size: 14px; }
.residence-card small { color: var(--text-muted); font-size: 12px; line-height: 1.45; }
@media (max-width: 640px) {
    .residence-options { grid-template-columns: 1fr; }
    .onboarding-shell { padding-top: 16px; }
}

/* Payday plan - one row per salary payday, so a passed payday is visible as an
   event rather than showing up only as a bigger number somewhere else. */
.payday-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.payday-row {
    display: grid; grid-template-columns: 22px 1fr auto auto; align-items: center;
    gap: 10px; padding: 7px 8px; border-radius: 7px; font-size: 13.5px;
}
.payday-row + .payday-row { border-top: 1px solid var(--border-subtle, #f0f0f1); }
.payday-mark { display: flex; align-items: center; justify-content: center; }
.payday-mark svg, .payday-mark i { width: 14px; height: 14px; }
.payday-date { font-weight: 600; }
.payday-status { color: var(--text-muted); font-size: 12.5px; }
.payday-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.payday-saved { color: var(--color-success); background: var(--color-success-soft); }
.payday-missed { color: var(--color-warning, #b45309); background: var(--color-warning-soft, #fef3c7); }
.payday-due { outline: 1.5px solid var(--color-success); }
.payday-before_plan { color: var(--text-muted); opacity: 0.65; }
.payday-note { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); }
.payday-lump { display: block; font-size: 11.5px; opacity: 0.85; margin-top: 1px; }
.payday-note-warn { color: var(--color-warning, #b45309); }

/* Income composition: what the bill is built from, and what sits outside it. */
.income-row {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 10px 0; border-bottom: 1px solid var(--border-color);
}
.income-row:last-child { border-bottom: none; }
.income-row span { color: var(--text-primary); }
.income-row em { color: var(--text-muted); font-style: normal; font-size: 13px; }
.income-row--excluded span, .income-row--excluded strong { color: var(--text-muted); }
.income-row--total { border-top: 2px solid var(--border-color); font-weight: 600; }

/* Why the estimate is on the conservative basis, and what to do about it. */
.income-note {
    display: flex; gap: 10px; align-items: flex-start;
    margin-top: 12px; padding: 12px;
    border-radius: 8px;
    background: var(--bg-subtle, rgba(0, 0, 0, 0.03));
    color: var(--text-muted); font-size: 13px; line-height: 1.5;
}
.income-note i { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; }

/* The month-by-month arithmetic behind the salary figure. */
.salary-math { margin-top: 12px; }
.salary-math summary {
    cursor: pointer; color: var(--text-muted); font-size: 13px;
    user-select: none;
}
.salary-math table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.salary-math td { padding: 5px 0; border-bottom: 1px solid var(--border-color); }
.salary-math td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.salary-math em { color: var(--text-muted); font-style: normal; font-size: 12px; margin-left: 6px; }
.math-row--projected td { color: var(--text-muted); }
.math-row--total td { font-weight: 600; border-top: 2px solid var(--border-color); border-bottom: none; }
