:root {
    color-scheme: light;
    --bg: #f5f3ff;
    --bg-strong: #ede9fe;
    --surface: #ffffff;
    --surface-tint: #faf5ff;
    --ink: #1e1b4b;
    --muted: #6366f1;
    --soft: #a5b4fc;
    --line: #e0e7ff;
    --line-strong: #c7d2fe;
    --blue: #6366f1;
    --blue-deep: #4f46e5;
    --cyan: #06b6d4;
    --mint: #10b981;
    --mint-soft: #d1fae5;
    --lime: #84cc16;
    --yellow: #f59e0b;
    --orange: #f97316;
    --rose: #ff4d4d;
    --rose-soft: #ffe4e6;
    --violet: #8b5cf6;
    --violet-soft: #f3e8ff;
    --shadow-sm: 0 4px 14px 0 rgba(99, 102, 241, 0.08);
    --shadow-md: 0 10px 25px -5px rgba(99, 102, 241, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    font-family: 'Plus Jakarta Sans', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, #f5f3ff 0%, #faf5ff 100%);
}

body::before {
    display: none;
}

body::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.account-list::-webkit-scrollbar,
.reminder-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.account-list::-webkit-scrollbar-track,
.reminder-list::-webkit-scrollbar-track {
    background: #ede9fe;
}

body::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.account-list::-webkit-scrollbar-thumb,
.reminder-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #c7d2fe;
}

button {
    font: inherit;
}

.lucide {
    width: 1em;
    height: 1em;
    stroke-width: 2.2;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 80px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(16px, 3vw, 40px);
    border-bottom: 1px solid #e0e7ff;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.brand-block {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
}

.brand-block > div {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
}

.brand-mark {
    position: relative;
    display: grid;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6 50%, #06b6d4);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.brand-mark::after {
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 18px;
    height: 18px;
    border: 3px solid #ffffff;
    border-radius: 8px;
    background: var(--yellow);
    content: "";
}

.brand-mark svg {
    width: 25px;
    height: 25px;
    fill: #ffffff;
}

.brand-kicker {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid rgb(8 119 238 / 14%);
    border-radius: 999px;
    background: #edf7ff;
    color: var(--blue);
    font-size: 0.68rem;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand {
    margin: 5px 0 0;
    color: var(--ink);
    font-size: 1.48rem;
    font-weight: 950;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.brand-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.badge-streak {
    display: inline-block;
    background: #fee2e2;
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.badge-streak {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fffbeb;
    color: #b45309;
    font-size: 0.8em;
    font-weight: 700;
    margin-left: 8px;
}

.system-status {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border: 1px solid rgb(203 217 236 / 88%);
    border-radius: 999px;
    background: #ffffff;
    color: var(--muted);
    box-shadow: var(--shadow-sm);
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1.3;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--soft);
}

.system-status.is-loading .status-dot {
    background: var(--blue);
    animation: pulse 1s ease-in-out infinite;
}

.system-status.is-success .status-dot {
    background: var(--mint);
}

.system-status.is-error .status-dot {
    background: var(--rose);
}

.app-nav {
    position: sticky;
    top: 80px;
    z-index: 19;
    display: flex;
    gap: 8px;
    padding: 10px clamp(16px, 3vw, 40px);
    overflow-x: auto;
    border-bottom: 1px solid #e0e7ff;
    background: rgba(245, 243, 255, 0.94);
    backdrop-filter: blur(12px);
}

.nav-button {
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border: 1px solid #e0e7ff;
    border-radius: 999px;
    background: #ffffff;
    color: #4338ca;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    transition: all 160ms ease;
}

.nav-button span {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 999px;
    background: #ede9fe;
    color: #6366f1;
    font-size: 0.8rem;
    line-height: 1;
}

.nav-button svg {
    width: 14px;
    height: 14px;
}

.nav-button:hover,
.nav-button:focus-visible {
    border-color: #c7d2fe;
    background: #ede9fe;
    color: #3730a3;
}

.nav-button.is-active {
    border-color: transparent;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.nav-button.is-active span {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.nav-button.is-active span {
    background: rgb(255 255 255 / 22%);
    color: #ffffff;
}

.error-banner {
    width: min(calc(100% - 36px), 1640px);
    margin: 18px auto 0;
    padding: 14px 16px;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    background: #fff1f2;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.error-banner strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.92rem;
}

.error-banner p {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.dashboard {
    width: min(100%, 1660px);
    margin: 0 auto;
    padding: 26px clamp(18px, 3vw, 42px) 38px;
}

.dashboard,
.page-view,
.overview-board,
.overview-board > *,
.report-hero,
.report-hero > *,
.report-grid,
.summary-grid,
.summary-card,
.report-score-card,
.report-panel,
.panel {
    min-width: 0;
}

.page-view {
    display: none;
}

.page-view.is-active {
    display: block;
}

.overview-board,
.report-hero {
    display: grid;
    grid-template-columns: minmax(390px, 1.25fr) minmax(540px, 1.9fr);
    gap: 18px;
    margin-bottom: 18px;
}

.report-hero {
    grid-template-columns: minmax(360px, 0.82fr) minmax(520px, 1.18fr);
    align-items: stretch;
}

.overview-preview-grid,
.report-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
    gap: 18px;
}

.report-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.net-worth-card,
.summary-card,
.panel,
.list-row,
.budget-item,
.goal-card,
.reminder-card,
.report-score-card,
.report-metric,
.report-bar-row {
    border-radius: 8px;
}

.net-worth-card {
    position: relative;
    min-height: 214px;
    overflow: hidden;
    padding: 24px;
    color: #ffffff;
    background:
        linear-gradient(135deg, rgb(24 32 51 / 16%) 0 50%, transparent 50% 100%),
        linear-gradient(135deg, #0d9488 0%, #0877ee 48%, #7c3aed 100%);
    box-shadow: var(--shadow-md);
}

.report-net-worth {
    min-height: 258px;
}

.net-worth-card::before {
    position: absolute;
    inset: auto 22px 22px auto;
    width: 190px;
    height: 16px;
    border-radius: 999px;
    background: rgb(255 255 255 / 26%);
    content: "";
}

.net-worth-card::after {
    position: absolute;
    right: 22px;
    bottom: 22px;
    width: 86px;
    height: 16px;
    border-radius: 999px;
    background: var(--lime);
    content: "";
}

.card-topline {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mood-chip {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid rgb(255 255 255 / 26%);
    border-radius: 999px;
    background: rgb(255 255 255 / 16%);
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 950;
    white-space: nowrap;
}

.summary-label,
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.net-worth-card .summary-label {
    color: rgb(255 255 255 / 78%);
}

.summary-label svg,
.section-kicker svg {
    width: 14px;
    height: 14px;
}

.net-worth-card strong {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 18px;
    color: #ffffff;
    font-size: 3rem;
    font-weight: 950;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.net-worth-card p {
    position: relative;
    z-index: 1;
    max-width: 470px;
    margin: 16px 0 0;
    color: rgb(255 255 255 / 82%);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
}

.report-hero-metrics {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.report-hero-metrics span {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 4px 8px;
    min-width: 0;
    align-items: center;
    padding: 11px;
    border: 1px solid rgb(255 255 255 / 22%);
    border-radius: 8px;
    background: rgb(255 255 255 / 14%);
    color: rgb(255 255 255 / 72%);
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1.25;
    text-transform: uppercase;
}

.report-hero-metrics svg {
    grid-row: span 2;
    width: 24px;
    height: 24px;
    padding: 5px;
    border-radius: 8px;
    background: rgb(255 255 255 / 18%);
    color: #ffffff;
}

.report-hero-metrics b {
    color: #ffffff;
    font-size: 1.08rem;
    font-weight: 950;
    overflow-wrap: normal;
    text-transform: none;
}

.report-score-card {
    display: grid;
    align-content: space-between;
    gap: 18px;
    min-height: 258px;
    padding: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.report-score-wide {
    min-height: 300px;
}

.report-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.report-score-card .mood-chip {
    border-color: rgb(8 119 238 / 16%);
    background: #edf7ff;
    color: var(--blue);
}

.score-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

.score-row strong {
    color: var(--ink);
    font-size: 5rem;
    font-weight: 950;
    line-height: 0.95;
    overflow-wrap: anywhere;
}

.score-row span {
    max-width: 150px;
    color: var(--blue);
    font-size: 1rem;
    font-weight: 950;
    line-height: 1.2;
    text-align: right;
}

.score-meter {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #dce8f6;
}

.score-meter span {
    display: block;
    width: var(--score, 0%);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--rose), var(--yellow), var(--mint), var(--blue));
}

.report-score-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 750;
    line-height: 1.45;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.summary-card,
.panel {
    border: 1px solid rgb(221 231 244 / 92%);
    background: rgb(255 255 255 / 92%);
    box-shadow: var(--shadow-sm);
}

.summary-card {
    position: relative;
    container-type: inline-size;
    min-height: 214px;
    overflow: hidden;
    padding: 18px;
}

.summary-card::after {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 78px;
    height: 10px;
    border-radius: 999px;
    opacity: 0.85;
    content: "";
}

.summary-icon {
    display: grid;
    width: 32px;
    height: 32px;
    margin-bottom: 14px;
    place-items: center;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 950;
}

.summary-positive {
    background:
        linear-gradient(135deg, #ecfdf5 0, #ffffff 66%),
        #ffffff;
}

.summary-positive .summary-icon,
.summary-positive::after {
    background: linear-gradient(135deg, var(--mint), var(--lime));
}

.summary-debt {
    background:
        linear-gradient(135deg, #fff1f2 0, #ffffff 66%),
        #ffffff;
}

.summary-debt .summary-icon,
.summary-debt::after {
    background: linear-gradient(135deg, var(--rose), var(--orange));
}

.summary-count {
    background:
        linear-gradient(135deg, #f4f1ff 0, #ffffff 66%),
        #ffffff;
}

.summary-count .summary-icon,
.summary-count::after {
    background: linear-gradient(135deg, var(--violet), var(--blue));
}

.summary-card strong {
    display: block;
    margin-top: 14px;
    color: var(--ink);
    font-size: 1.76rem;
    font-weight: 950;
    line-height: 1.06;
    overflow-wrap: normal;
    word-break: normal;
}

.panel {
    min-width: 0;
    padding: 20px;
    border-radius: 16px;
}

.report-panel {
    min-height: 290px;
    background:
        linear-gradient(180deg, rgb(255 255 255 / 94%), rgb(255 255 255 / 86%)),
        #ffffff;
}

.report-cashflow-panel {
    min-height: 300px;
}

.cashflow-chart {
    display: grid;
    gap: 14px;
}

.cashflow-filter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.cashflow-filter-chip {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #dde7f4;
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}

.cashflow-filter-chip.is-income {
    border-color: #b8f2cd;
    background: linear-gradient(135deg, #f0fff6, #ffffff);
}

.cashflow-filter-chip.is-expense,
.cashflow-filter-chip.is-negative {
    border-color: #ffc7cf;
    background: linear-gradient(135deg, #fff2f4, #ffffff);
}

.cashflow-filter-chip.is-positive {
    border-color: #b9dafd;
    background: linear-gradient(135deg, #edf7ff, #ffffff);
}

.cashflow-filter-head {
    display: grid;
    gap: 5px;
}

.cashflow-filter-head span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 950;
    text-transform: uppercase;
}

.cashflow-filter-head .report-metric-marker {
    width: 26px;
    height: 26px;
}

.cashflow-filter-head .report-metric-marker svg {
    width: 14px;
    height: 14px;
}

.cashflow-filter-head strong {
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 950;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.cashflow-filter-chip small {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 850;
}

.monthly-cashflow-plot {
    position: relative;
    min-width: 0;
    max-width: 100%;
}

/* Custom styles for Debt cards */
.debt-empty-message {
    color: #64748b;
    font-style: italic;
}

.debt-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    transition: transform 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Default shadow */
}

.debt-card--negative-shadow {
    box-shadow: 0 4px 12px -2px rgba(239, 68, 68, 0.15);
    border-color: #fca5a5;
}

.debt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.debt-card-name {
    color: #1e293b;
    font-size: 1.1em;
}

.debt-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.debt-badge--positive {
    background: #ecfdf5;
    color: #10b981;
}

.debt-badge--negative {
    background: #fef2f2;
    color: #ef4444;
}

.debt-amount {
    font-size: 1.6em;
    font-weight: bold;
    margin-bottom: 8px;
}

.debt-amount--positive {
    color: #10b981;
}

.debt-amount--negative {
    color: #ef4444;
}

.debt-all-cleared-message {
    background: #ecfdf5;
    padding: 20px;
    border-radius: 16px;
    border: 1px dashed #10b981;
    color: #047857;
    text-align: center;
}

/* Custom styles for History Filter Notice */
.history-filter-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eff6ff;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
}

.history-filter-text {
    color: #1e3a8a;
    font-size: 0.9em;
}

.btn-clear-history-filter {
    background: #dbeafe;
    border: none;
    color: #1d4ed8;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
}


.monthly-cashflow-plot {
    position: relative;
    width: 100%;
    margin-top: 12px;
    margin-bottom: 12px;
}

.monthly-cashflow-tooltip {
    position: absolute;
    top: 12px;
    transform: translateX(-50%) translateY(-6px);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1), transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    min-width: 180px;
}

.monthly-cashflow-tooltip.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #e2e8f0;
}

.tooltip-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
}

.tooltip-badge.is-pos {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.tooltip-badge.is-neg {
    background: rgba(244, 63, 94, 0.2);
    color: #fb7185;
    border: 1px solid rgba(251, 113, 133, 0.3);
}

.tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
}

.tooltip-row span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
}

.tooltip-row .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.dot-inc { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
.dot-exp { background: #f43f5e; box-shadow: 0 0 6px rgba(244, 63, 94, 0.6); }
.dot-act { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.6); }

.monthly-cashflow-chart {
    position: relative;
    display: grid;
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 6px;
    min-height: 230px;
    padding: 22px 14px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(241, 245, 249, 0.6) 0%, rgba(255, 255, 255, 0.95) 100%),
        repeating-linear-gradient(0deg, #f1f5f9, #f1f5f9 1px, transparent 1px, transparent 48px),
        #ffffff;
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.monthly-cashflow-group {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    height: 100%;
    padding: 6px 2px 2px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 2;
}

.monthly-cashflow-hover-bg {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: transparent;
    transition: background-color 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.monthly-cashflow-group:hover .monthly-cashflow-hover-bg,
.monthly-cashflow-group.is-hovered .monthly-cashflow-hover-bg {
    background: rgba(59, 130, 246, 0.06);
}

.monthly-cashflow-group.is-active-month .monthly-cashflow-hover-bg {
    background: rgba(59, 130, 246, 0.03);
}

.monthly-cashflow-bars {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 135px;
    width: 100%;
    z-index: 2;
}

.monthly-cashflow-bar {
    align-self: flex-end;
    width: 100%;
    max-width: 14px;
    height: var(--height, 0%);
    min-height: 4px;
    border-radius: 5px 5px 2px 2px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease, opacity 0.2s ease;
}

.monthly-cashflow-bar.is-income {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 6px -1px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.monthly-cashflow-bar.is-expense {
    background: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%);
    box-shadow: 0 2px 6px -1px rgba(244, 63, 94, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.monthly-cashflow-group:hover .monthly-cashflow-bar,
.monthly-cashflow-group.is-hovered .monthly-cashflow-bar {
    transform: translateY(-3px) scaleY(1.02);
    filter: brightness(1.12);
}

.monthly-cashflow-label {
    position: relative;
    margin-top: 10px;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    z-index: 2;
    transition: all 0.2s ease;
}

.monthly-cashflow-label.is-current {
    color: #2563eb;
    font-weight: 800;
    background: #eff6ff;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
}

.monthly-cashflow-group:hover .monthly-cashflow-label {
    color: #0f172a;
    font-weight: 800;
}

.monthly-actual-wrap {
    position: absolute;
    inset: 22px 14px 44px;
    width: calc(100% - 28px);
    height: calc(100% - 66px);
    overflow: visible;
    pointer-events: none;
    z-index: 4;
}

.monthly-actual-line {
    width: 100%;
    height: 100%;
    overflow: visible;
    display: block;
}

.chart-point-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border: 1.8px solid #2563eb;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 6;
    transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.cashflow-chart-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 700;
}

.cashflow-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.cashflow-chart-legend span::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    content: "";
}

.cashflow-chart-legend .is-income::before {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.cashflow-chart-legend .is-expense::before {
    background: #f43f5e;
    box-shadow: 0 0 6px rgba(244, 63, 94, 0.6);
}

.cashflow-chart-legend .is-actual::before {
    background: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
}

.cashflow-chart-bars {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.cashflow-bar-card,
.cashflow-net-card {
    position: relative;
    display: grid;
    gap: 10px;
    overflow: hidden;
    padding: 14px;
    border: 1px solid #dde7f4;
    border-radius: 8px;
    background: #ffffff;
}

.cashflow-bar-card::before,
.cashflow-net-card::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--blue);
    content: "";
}

.cashflow-bar-card.is-income::before,
.cashflow-net-card.is-positive::before {
    background: var(--mint);
}

.cashflow-bar-card.is-expense::before,
.cashflow-net-card.is-negative::before {
    background: var(--rose);
}

.cashflow-bar-head {
    display: grid;
    gap: 6px;
}

.cashflow-bar-head span,
.cashflow-net-card span {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 950;
    text-transform: uppercase;
}

.cashflow-bar-head .report-metric-marker,
.cashflow-net-card .report-metric-marker {
    width: 28px;
    height: 28px;
}

.cashflow-bar-head .report-metric-marker svg,
.cashflow-net-card .report-metric-marker svg {
    width: 15px;
    height: 15px;
}

.cashflow-bar-head strong,
.cashflow-net-card strong {
    color: var(--ink);
    font-size: 1.34rem;
    font-weight: 950;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.cashflow-bar-track {
    height: 16px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4edf8;
}

.cashflow-bar-fill {
    display: block;
    width: var(--progress, 0%);
    height: 100%;
    min-width: 10px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.cashflow-bar-card.is-income .cashflow-bar-fill {
    background: linear-gradient(90deg, var(--mint), var(--lime));
}

.cashflow-bar-card.is-expense .cashflow-bar-fill {
    background: linear-gradient(90deg, var(--rose), var(--orange));
}

.cashflow-bar-card small,
.cashflow-net-card small {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.cashflow-net-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.cashflow-net-card span,
.cashflow-net-card small {
    grid-column: 1;
}

.cashflow-net-card strong {
    grid-row: 1 / span 2;
    grid-column: 2;
    text-align: right;
}

.report-metric-list {
    display: grid;
    gap: 10px;
}

.report-metric,
.report-bar-row {
    position: relative;
    overflow: hidden;
    padding: 14px;
    border: 1px solid #dde7f4;
    background: #ffffff;
}

.report-metric::before,
.report-bar-row::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--blue);
    content: "";
}

.report-metric {
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-metric-content {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
    gap: 3px;
}

.report-metric-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 950;
    text-transform: uppercase;
}

.report-metric-value {
    color: var(--ink);
    font-size: 1.45rem;
    font-weight: 950;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.report-metric-detail {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 750;
    line-height: 1.35;
}

.report-metric-marker {
    display: grid;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, #dff0ff, #ffffff);
    color: var(--blue);
}

.report-metric-marker svg {
    width: 21px;
    height: 21px;
}

.report-metric.is-positive::before,
.report-bar-row.is-positive::before {
    background: var(--mint);
}

.report-metric.is-negative::before,
.report-bar-row.is-negative::before {
    background: var(--rose);
}

.report-metric.is-warning::before,
.report-bar-row.is-warning::before {
    background: var(--yellow);
}

.report-metric.is-saving::before,
.report-bar-row.is-saving::before {
    background: var(--violet);
}

.report-metric.is-positive .report-metric-marker {
    background: linear-gradient(135deg, #dcfce7, #ffffff);
    color: var(--mint);
}

.report-metric.is-negative .report-metric-marker {
    background: linear-gradient(135deg, #ffe4e9, #ffffff);
    color: var(--rose);
}

.report-metric.is-warning .report-metric-marker {
    background: linear-gradient(135deg, #fff2bd, #ffffff);
    color: #d97706;
}

.report-metric.is-saving .report-metric-marker {
    background: linear-gradient(135deg, #f0e7ff, #ffffff);
    color: var(--violet);
}

.report-bar-row {
    display: grid;
    gap: 10px;
}

.report-bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.report-bar-label {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.report-bar-label .report-metric-marker {
    width: 28px;
    height: 28px;
}

.report-bar-label .report-metric-marker svg {
    width: 15px;
    height: 15px;
}

.report-bar-head strong {
    color: var(--ink);
    text-align: right;
    white-space: nowrap;
}

.report-bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4edf8;
}

.report-bar-track span {
    display: block;
    width: var(--progress, 0%);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.report-bar-row.is-positive .report-bar-track span {
    background: linear-gradient(90deg, var(--mint), var(--lime));
}

.report-bar-row.is-negative .report-bar-track span {
    background: linear-gradient(90deg, var(--rose), var(--orange));
}

.report-bar-row.is-saving .report-bar-track span {
    background: linear-gradient(90deg, var(--violet), var(--blue));
}

[data-overview-target] {
    cursor: pointer;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

[data-overview-target]:hover,
[data-overview-target]:focus-visible {
    border-color: rgb(8 119 238 / 42%);
    box-shadow: 0 14px 32px rgb(8 119 238 / 14%);
    transform: translateY(-1px);
}

[data-overview-target]:focus-visible {
    outline: 3px solid rgb(8 119 238 / 18%);
    outline-offset: 2px;
}

.is-focus-highlight {
    outline: 3px solid rgb(8 119 238 / 32%);
    outline-offset: 3px;
    animation: focusFlash 1.8s ease;
}

.full-page-panel {
    min-height: calc(100vh - 232px);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.section-title h2 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 1.24rem;
    font-weight: 950;
    line-height: 1.18;
}

.history-filter-notice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px 5px 10px;
    border: 1px solid #c8ddf7;
    border-radius: 999px;
    background: #edf7ff;
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 950;
}

.history-filter-notice[hidden] {
    display: none;
}

.history-filter-notice button {
    min-height: 26px;
    padding: 3px 9px;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 950;
}

.history-filter-notice button:hover,
.history-filter-notice button:focus-visible {
    color: var(--blue);
}

.history-summary-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #d7e6f8;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fcff 0%, #ffffff 58%, #fff8ec 100%);
}

.history-summary-panel[hidden] {
    display: none;
}

.history-summary-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.history-summary-head > div {
    display: grid;
    gap: 3px;
}

.history-summary-head span,
.history-detail-heading span {
    color: var(--soft);
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.history-summary-head strong {
    color: var(--ink);
    font-size: 1.7rem;
    font-weight: 950;
    line-height: 1.05;
}

.history-summary-head small,
.history-detail-heading small {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 850;
}

.history-category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.history-category-card {
    display: grid;
    gap: 8px;
    min-height: 104px;
    padding: 13px;
    border: 1px solid #dbe7f5;
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    box-shadow: 0 10px 22px rgb(24 32 51 / 5%);
}

.history-category-card:hover,
.history-category-card:focus-visible,
.history-category-card.is-active {
    border-color: #8cc8ff;
    background: #f5fbff;
    outline: none;
}

.history-category-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.history-category-head strong {
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 950;
    line-height: 1.2;
}

.history-category-head small {
    flex: 0 0 auto;
    color: var(--soft);
    font-size: 0.72rem;
    font-weight: 900;
    white-space: nowrap;
}

.history-category-value {
    color: var(--blue);
    font-size: 1.08rem;
    font-weight: 950;
}

.history-category-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eef9;
}

.history-category-progress::before {
    display: block;
    width: var(--progress);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--mint), var(--blue));
    content: "";
}

.history-detail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 2px;
}

.history-detail-heading[hidden] {
    display: none;
}

.section-kicker {
    color: #69768b;
}

.list-stack {
    display: grid;
    gap: 10px;
}

.account-list {
    max-height: 690px;
    overflow-y: auto;
    padding-right: 4px;
}

.account-list-page {
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid #d8e4f3;
    background: #ffffff;
    color: var(--muted);
    font-size: 0.88rem;
}

.list-row.is-positive {
    border-color: #b8f2cd;
    background: linear-gradient(135deg, #effdf5, #ffffff);
}

.list-row.is-negative {
    border-color: #ffc7cf;
    background: linear-gradient(135deg, #fff2f4, #ffffff);
}

.row-title {
    min-width: 0;
    color: var(--ink);
    font-weight: 900;
    line-height: 1.28;
    overflow-wrap: anywhere;
}

.row-meta {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.row-value {
    color: var(--ink);
    font-weight: 950;
    text-align: right;
    white-space: nowrap;
}

.list-row.is-positive .row-value,
.amount-positive {
    color: #059669;
}

.list-row.is-negative .row-value,
.amount-negative {
    color: #e44755;
}

.tabs {
    display: inline-flex;
    gap: 6px;
    margin-bottom: 16px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #eef6ff;
}

.tab-button {
    min-height: 38px;
    padding: 8px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 950;
}

.tab-button:hover,
.tab-button:focus-visible {
    color: var(--ink);
}

.tab-button:focus-visible {
    outline: 3px solid rgb(8 119 238 / 22%);
    outline-offset: 2px;
}

.tab-button.is-active {
    background: #ffffff;
    color: var(--blue);
    box-shadow: 0 8px 18px rgb(8 119 238 / 12%);
}

.tab-content.hidden {
    display: none;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 0.9rem;
}

.history-table,
.savings-table {
    table-layout: fixed;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) {
    width: 88px;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
    width: 96px;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) {
    width: 156px;
}

.history-table td:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.savings-table {
    min-width: 740px;
}

.savings-table th:nth-child(1),
.savings-table td:nth-child(1) {
    width: 37%;
}

.savings-table th:nth-child(2),
.savings-table td:nth-child(2) {
    width: 21%;
}

.savings-table th:nth-child(3),
.savings-table td:nth-child(3),
.savings-table th:nth-child(4),
.savings-table td:nth-child(4) {
    width: 13%;
}

.savings-table th:nth-child(5),
.savings-table td:nth-child(5) {
    width: 16%;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--soft);
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

td {
    border-top: 1px solid #e5edf8;
    border-bottom: 1px solid #e5edf8;
    background: #ffffff;
    color: var(--muted);
    font-weight: 800;
}

td:first-child {
    border-left: 1px solid #e5edf8;
    border-radius: 8px 0 0 8px;
}

td:last-child {
    border-right: 1px solid #e5edf8;
    border-radius: 0 8px 8px 0;
}

tbody tr:hover td {
    border-color: #b8d8ff;
    background: #f7fbff;
}

.align-right {
    text-align: right;
}

.amount-positive,
.amount-negative {
    font-weight: 950;
    white-space: nowrap;
}

.transaction-pill {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--violet-soft);
    color: var(--violet);
    font-size: 0.75rem;
    font-weight: 950;
    text-transform: lowercase;
    white-space: nowrap;
}

.transaction-pill.is-expense {
    background: var(--rose-soft);
    color: #e44755;
}

.transaction-pill.is-income {
    background: var(--mint-soft);
    color: #059669;
}

.budget-grid {
    display: grid;
    gap: 12px;
}

.budget-grid-page {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.budget-item {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid #b9dafd;
    background:
        linear-gradient(135deg, #eef7ff, #ffffff 64%),
        #ffffff;
}

.budget-heading {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--ink);
    font-size: 0.96rem;
    font-weight: 950;
}

.budget-heading span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.budget-percent {
    flex: 0 0 auto;
    color: var(--blue);
}

.progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #d9eaff;
}

.progress-bar {
    width: var(--progress, 0%);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--cyan), var(--lime));
}

.budget-item.is-warning {
    border-color: #ffe29b;
    background: linear-gradient(135deg, #fff8dc, #ffffff 64%);
}

.budget-item.is-warning .progress-bar {
    background: linear-gradient(90deg, var(--yellow), var(--orange));
}

.budget-item.is-danger {
    border-color: #ffc3cc;
    background: linear-gradient(135deg, #fff0f3, #ffffff 64%);
}

.budget-item.is-danger .progress-bar {
    background: linear-gradient(90deg, var(--rose), var(--orange));
}

.budget-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 850;
}

.goal-grid {
    display: grid;
    gap: 14px;
}

.goal-grid-page {
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.goal-card {
    display: grid;
    gap: 14px;
    padding: 17px;
    border: 1px solid #cdd7ff;
    background:
        linear-gradient(135deg, #f5f3ff, #ffffff 58%),
        #ffffff;
    box-shadow: 0 10px 24px rgb(124 58 237 / 8%);
}

.goal-card.is-complete {
    border-color: #a7f3d0;
    background: linear-gradient(135deg, #ecfdf5, #ffffff 58%);
}

.goal-card.is-urgent {
    border-color: #fed7aa;
    background: linear-gradient(135deg, #fff7ed, #ffffff 58%);
}

.goal-head,
.goal-amount-row,
.goal-meta,
.goal-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.goal-title {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.goal-title h3 {
    min-width: 0;
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 950;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.goal-title .report-metric-marker {
    flex: 0 0 auto;
    background: linear-gradient(135deg, #f0e7ff, #ffffff);
    color: var(--violet);
}

.goal-date {
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eaf4ff;
    color: var(--blue);
    font-size: 0.72rem;
    font-weight: 950;
    white-space: nowrap;
}

.goal-card.is-urgent .goal-date {
    background: #fff0c7;
    color: #c2410c;
}

.goal-amount-row strong {
    color: var(--ink);
    font-size: 1.28rem;
    font-weight: 950;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.goal-amount-row span,
.goal-meta,
.goal-detail {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.goal-progress .progress-bar {
    background: linear-gradient(90deg, var(--violet), var(--blue), var(--cyan));
}

.goal-meta span:first-child {
    color: var(--violet);
    font-weight: 950;
}

.goal-detail {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.goal-detail span {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef6ff;
    color: #4d5b70;
}

.reminder-list {
    display: grid;
    gap: 12px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

.reminder-list-page {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.reminder-list-compact {
    max-height: 382px;
}

.reminder-card {
    display: grid;
    gap: 10px;
    padding: 15px;
    border: 1px solid #d5c9ff;
    background:
        linear-gradient(135deg, #f7f2ff, #ffffff 66%),
        #ffffff;
}

.reminder-card:nth-child(3n + 2) {
    border-color: #bcebd8;
    background: linear-gradient(135deg, #edfff6, #ffffff 66%);
}

.reminder-card:nth-child(3n + 3) {
    border-color: #ffe0a6;
    background: linear-gradient(135deg, #fff8e6, #ffffff 66%);
}

.reminder-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.reminder-head h3 {
    min-width: 0;
    margin: 0;
    color: var(--ink);
    font-size: 0.98rem;
    font-weight: 950;
    line-height: 1.28;
    overflow-wrap: anywhere;
}

.reminder-date {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    background: #dff0ff;
    color: var(--blue);
    font-size: 0.72rem;
    font-weight: 950;
    white-space: nowrap;
}

.reminder-content {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 750;
    line-height: 1.5;
}

.reminder-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reminder-amount,
.reminder-status {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: #fff0c7;
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 950;
}

.empty-state,
.empty-cell {
    margin: 0;
    color: var(--soft);
    font-size: 0.88rem;
    font-weight: 800;
}

.empty-cell {
    padding: 28px 8px;
    text-align: center;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.35;
        transform: scale(0.85);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes focusFlash {
    0% {
        box-shadow: 0 0 0 0 rgb(8 119 238 / 32%);
    }

    45% {
        box-shadow: 0 0 0 12px rgb(8 119 238 / 0%);
    }

    100% {
        box-shadow: var(--shadow-sm);
    }
}

/* CSS chia cột cho màn hình Desktop/Tablet */
.report-hero-grid {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Cột trái nhỏ, cột phải to */
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 768px) {
    .report-hero-grid {
        grid-template-columns: 1fr; /* Mobile thì xếp dọc lại */
    }
    .simple-finance-board {
        grid-template-columns: 1fr !important; /* Biến thành 1 cột xếp dọc trên điện thoại */
    }
}
.asset-split-box {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    border-left: 4px solid #0f766e;
}
.asset-split-box.locked {
    border-left-color: #64748b;
}

@media (max-width: 1280px) {
    .overview-board,
    .overview-preview-grid,
    .report-hero {
        grid-template-columns: 1fr;
    }

    .report-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .app-header,
    .brand-block {
        align-items: flex-start;
    }

    .app-header {
        flex-direction: column;
        min-height: 132px;
        align-items: stretch;
    }

    .brand-block {
        width: 100%;
        max-width: 100%;
    }

    .brand-block > div {
        max-width: calc(100% - 62px);
    }

    .brand {
        font-size: 1.22rem;
    }

    .system-status {
        white-space: normal;
    }

    .app-nav {
        top: 132px;
    }

    .summary-grid,
    .overview-preview-grid,
    .report-grid,
    .cashflow-filter-row,
    .cashflow-chart-bars,
    .account-list-page,
    .budget-grid-page,
    .goal-grid-page,
    .reminder-list-page {
        grid-template-columns: 1fr;
    }

    .overview-board,
    .report-hero {
        display: block;
    }

    .overview-board > * + *,
    .report-hero > * + * {
        margin-top: 14px;
    }

    .account-list,
    .reminder-list {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    .panel,
    .summary-card,
    .net-worth-card {
        padding: 16px;
    }

    .summary-card,
    .net-worth-card {
        min-height: 178px;
    }

    .net-worth-card strong {
        font-size: 2.28rem;
    }

    .net-worth-card,
    .summary-card,
    .panel,
    .report-score-card {
        width: 100%;
        max-width: 100%;
    }

    .net-worth-card p {
        max-width: 100%;
    }

    .net-worth-card::before {
        width: 46%;
    }

    .net-worth-card::after {
        width: 22%;
    }

    .summary-card strong {
        font-size: 1.82rem;
    }

    .tabs {
        max-width: 100%;
        overflow-x: auto;
    }

    .tab-button {
        flex: 0 0 auto;
    }

    .history-table,
    .savings-table {
        min-width: 650px;
    }

    .history-summary-head,
    .history-detail-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .monthly-cashflow-chart {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 6px;
        min-height: 200px;
        padding: 16px 10px 10px;
    }

    .monthly-cashflow-bars {
        gap: 3px;
        height: 110px;
    }

    .monthly-cashflow-label {
        font-size: 0.68rem;
    }

    .monthly-actual-wrap {
        inset: 16px 10px 38px;
        width: calc(100% - 20px);
        height: calc(100% - 54px);
    }
}

@media (max-width: 560px) {
    .dashboard {
        padding-right: 14px;
        padding-left: 14px;
    }

    .app-header,
    .app-nav {
        padding-right: 14px;
        padding-left: 14px;
    }

    .brand-block {
        gap: 10px;
    }

    .brand-mark {
        width: 46px;
        height: 46px;
    }

    .net-worth-card strong {
        font-size: 1.9rem;
    }

    .report-hero-metrics {
        grid-template-columns: 1fr;
    }

    .score-row strong {
        font-size: 3.1rem;
    }

    .history-category-list {
        grid-template-columns: 1fr;
    }

    .report-cashflow-panel {
        overflow: hidden;
    }

    .cashflow-chart-legend {
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .monthly-cashflow-chart {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 4px;
        min-height: 185px;
        padding: 12px 6px 8px;
    }

    .monthly-cashflow-bars {
        gap: 2px;
        height: 95px;
    }

    .monthly-cashflow-bar {
        max-width: 10px;
        border-radius: 4px 4px 2px 2px;
    }

    .monthly-cashflow-label {
        font-size: 0.62rem;
        margin-top: 6px;
    }

    .monthly-actual-wrap {
        inset: 12px 6px 32px;
        width: calc(100% - 12px);
        height: calc(100% - 44px);
    }

    .chart-point-dot {
        width: 5px;
        height: 5px;
        border-width: 1.2px;
    }
}

/* Tạo thanh cuộn mượt mà cho hộp Báo động thanh khoản */
.smart-alert-feed {
    max-height: 350px; /* Giới hạn chiều cao */
    overflow-y: auto;  /* Tự động hiện thanh cuộn nếu dài quá */
    padding-right: 8px; /* Cắt lề tí cho khỏi dính chữ vào thanh cuộn */
}

/* Trang trí thanh cuộn cho nó 'Gen Z', tàng hình đi một tí cho đẹp */
.smart-alert-feed::-webkit-scrollbar {
    width: 6px;
}
.smart-alert-feed::-webkit-scrollbar-track {
    background: transparent;
}
.smart-alert-feed::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

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

.account-group-title {
    margin: 0 0 12px;
    color: #1e293b;
    font-size: 1.05rem;
}

.account-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.account-card-grid-spaced {
    margin-bottom: 32px;
}

.account-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    color: #1e293b;
    text-align: left;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.account-card:hover,
.account-card:focus-visible {
    transform: translateY(-2px);
    border-color: #7dd3fc;
    box-shadow: 0 10px 18px -8px rgba(14, 116, 144, 0.28);
    outline: none;
}

.account-card-name {
    overflow-wrap: anywhere;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 650;
}

.account-card-value {
    font-size: 1.2rem;
}

.account-card-positive .account-card-value,
.transaction-amount.is-income {
    color: #059669;
}

.account-card-negative .account-card-value,
.transaction-amount.is-expense {
    color: #dc2626;
}

.dong-giao-dich {
    cursor: pointer;
    transition: background-color 160ms ease;
}

.dong-giao-dich:hover {
    background: #f1f5f9;
}

.transaction-type-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: capitalize;
}

.transaction-type-badge.is-income {
    background: #ecfdf5;
    color: #059669;
}

.transaction-type-badge.is-expense {
    background: #fef2f2;
    color: #dc2626;
}

.transaction-amount {
    font-weight: 750;
}

.ai-msg-success,
.ai-msg-error {
    display: block;
    margin: 8px 0 0 24px;
    padding: 10px 12px;
    border-radius: 12px 12px 0 12px;
    font-size: 0.88rem;
}

.ai-msg-success {
    background: #dcfce7;
    color: #166534;
}

.ai-msg-error {
    background: #fee2e2;
    color: #991b1b;
}

.reminder-delete-button {
    flex: 1;
    padding: 8px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff5f5;
    color: #dc2626;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
}

.reminder-delete-button:hover,
.reminder-delete-button:focus-visible {
    background: #dc2626;
    color: #fff;
    outline: none;
}

.budget-card-button {
    display: block;
    width: 100%;
    margin: 0 0 16px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.budget-card-button:hover,
.budget-card-button:focus-visible {
    transform: translateY(-2px);
    border-color: #38bdf8;
    box-shadow: 0 10px 20px -12px rgba(2, 132, 199, 0.45);
    outline: none;
}

/* --- PHẦN BỔ SUNG GIAO DIỆN HỆ THỐNG THAO TÁC TRỰC TIẾP (CRUD) --- */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-quick-add {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.btn-quick-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.section-title-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.btn-action-add {
    background: #ede9fe;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 160ms ease;
}

.btn-action-add:hover {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.card-action-bar {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.card-btn {
    flex: 1;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    transition: all 150ms ease;
}

.card-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}

.card-btn-danger {
    border-color: #fecaca;
    color: #dc2626;
    background: #fff5f5;
}

.card-btn-danger:hover {
    background: #dc2626;
    color: #ffffff;
}

.card-btn-primary {
    border-color: #6366f1;
    color: #4338ca;
    background: #ede9fe;
}

.card-btn-primary:hover {
    background: #6366f1;
    color: #ffffff;
}

/* --- BENTO GRID LAYOUT (OPTION 3 BENTO CONCEPT) --- */
.bento-grid-row-1 {
    display: grid;
    grid-template-columns: 1.2fr 1.3fr 0.9fr;
    gap: 20px;
    margin-bottom: 24px;
}

.bento-grid-row-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.bento-grid-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .bento-grid-row-1,
    .bento-grid-row-2,
    .bento-grid-row-3 {
        grid-template-columns: 1fr;
    }
}

.bento-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.08);
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
    border: 2px solid #e0e7ff;
    position: relative;
    overflow: hidden;
}

.bento-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px -8px rgba(99, 102, 241, 0.15);
}

.bento-card-purple { border-color: #c7d2fe; }
.bento-card-mint { border-color: #a7f3d0; }
.bento-card-orange { border-color: #fed7aa; }
.bento-card-ai { border-color: #bbf7d0; background: #f0fdf4; }
.bento-card-yellow { border-color: #fef08a; }
.bento-card-blue { border-color: #bae6fd; }
.bento-card-pink { border-color: #fbcfe8; }
.bento-card-red { border-color: #fecaca; }

.bento-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.bento-kicker {
    font-size: 0.85rem;
    font-weight: 800;
    color: #4338ca;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bento-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.bento-badge-success { background: #d1fae5; color: #065f46; }

.bento-main-number {
    font-size: 2rem;
    font-weight: 800;
    color: #1e1b4b;
    margin: 8px 0 12px;
}

.bento-sub-info {
    font-size: 0.85rem;
    color: #6366f1;
}

.bento-dual-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 12px 0 16px;
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    color: #6366f1;
    margin-bottom: 4px;
}

.metric-val-income {
    font-size: 1.3rem;
    color: #10b981;
}

.metric-val-expense {
    font-size: 1.3rem;
    color: #ff4d4d;
}

.bento-net-bar {
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: #6366f1;
}

.bento-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bento-btn {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #c2410c;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 150ms ease;
    text-align: center;
}

.bento-btn:hover {
    background: #ff8000;
    color: #ffffff;
    border-color: #ff8000;
}

.bento-ai-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bento-ai-avatar {
    font-size: 2.4rem;
    background: #d1fae5;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.bento-ai-head h3 {
    margin: 0 0 6px 0;
    color: #065f46;
    font-size: 1.1rem;
}

.bento-ai-head p {
    margin: 0;
    color: #047857;
    font-size: 0.92rem;
    font-style: italic;
    line-height: 1.5;
}

.bento-score-display {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 12px 0 16px;
}

.bento-score-display strong {
    font-size: 3.2rem;
    color: #1e1b4b;
    line-height: 1;
}

.bento-link-arrow {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6366f1;
}

/* ==================================================
   BENTO ROW 4: CALENDAR HEATMAP & SANKEY FLOW
   ================================================== */
.bento-grid-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 1024px) {
    .bento-grid-row-4 {
        grid-template-columns: 1fr;
    }
}

.bento-card-heatmap {
    border-color: #fed7aa;
    background: #ffffff;
}

.bento-card-sankey {
    border-color: #c7d2fe;
    background: #ffffff;
}

.bento-select {
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid #c7d2fe;
    background: #f8fafc;
    color: #4338ca;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
    transition: all 150ms ease;
}

.bento-select:hover, .bento-select:focus {
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.heatmap-mode-toggle {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 12px;
    gap: 3px;
}

.heatmap-toggle-btn {
    padding: 4px 10px;
    border-radius: 9px;
    border: none;
    background: transparent;
    font-size: 0.76rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 150ms ease;
}

.heatmap-toggle-btn:hover {
    color: #334155;
}

.heatmap-toggle-btn.active {
    background: #ffffff;
    color: #4338ca;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.heatmap-stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 12px 0 16px;
}

@media (max-width: 580px) {
    .heatmap-stats-bar {
        grid-template-columns: 1fr;
    }
}

.heatmap-stat-item {
    padding: 10px 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.heatmap-stat-item .stat-icon {
    font-size: 1.4rem;
}

.heatmap-stat-item strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
}

.heatmap-stat-item small {
    font-size: 0.72rem;
    opacity: 0.85;
    font-weight: 600;
}

.heatmap-stat-item.is-nospend,
.heatmap-stat-item.is-income-count,
.heatmap-stat-item.is-income-total {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.heatmap-stat-item.is-peak,
.heatmap-stat-item.is-expense-total {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.heatmap-stat-item.is-avg,
.heatmap-stat-item.is-net-surplus {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.calendar-heatmap-container {
    background: #f8fafc;
    border-radius: 18px;
    padding: 14px;
    border: 1px solid #f1f5f9;
}

.heatmap-weekdays-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    text-align: center;
    margin-bottom: 8px;
}

.heatmap-weekday-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.heatmap-day-cell {
    aspect-ratio: 1;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.heatmap-day-cell:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.heatmap-day-number {
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
}

.heatmap-day-badge {
    font-size: 0.58rem;
    font-weight: 700;
    margin-top: 2px;
    line-height: 1.1;
    text-align: center;
}

.heatmap-day-cell.is-empty-day {
    background: transparent;
    cursor: default;
    border: none;
}

/* EXPENSE LEVELS */
.heatmap-day-cell.level-0 {
    background: #dcfce7;
    border: 1.5px solid #86efac;
    color: #15803d;
}

.heatmap-day-cell.level-1 {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.heatmap-day-cell.level-2 {
    background: #fefce8;
    border: 1px solid #fde047;
    color: #854d0e;
}

.heatmap-day-cell.level-3 {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.heatmap-day-cell.level-4 {
    background: #fee2e2;
    border: 1.5px solid #fca5a5;
    color: #991b1b;
}

/* INCOME LEVELS */
.heatmap-day-cell.inc-level-0 {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
}

.heatmap-day-cell.inc-level-1 {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.heatmap-day-cell.inc-level-2 {
    background: #d1fae5;
    border: 1.5px solid #6ee7b7;
    color: #047857;
}

.heatmap-day-cell.inc-level-3 {
    background: #a7f3d0;
    border: 1.5px solid #34d399;
    color: #064e3b;
}

.heatmap-day-cell.inc-level-4 {
    background: #6ee7b7;
    border: 2px solid #10b981;
    color: #022c22;
}

/* ALL NET FLOW LEVELS */
.heatmap-day-cell.all-net-pos {
    background: #ecfdf5;
    border: 1.5px solid #86efac;
    color: #065f46;
}

.heatmap-day-cell.all-net-neg {
    background: #fff1f2;
    border: 1.5px solid #fca5a5;
    color: #991b1b;
}

.heatmap-day-cell.all-net-zero {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

.heatmap-day-cell.is-today {
    box-shadow: 0 0 0 2px #6366f1;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    flex-wrap: wrap;
}

.legend-box {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}

.legend-box.level-0 { background: #dcfce7; border: 1px solid #86efac; }
.legend-box.level-1 { background: #f0fdf4; border: 1px solid #bbf7d0; }
.legend-box.level-2 { background: #fefce8; border: 1px solid #fde047; }
.legend-box.level-3 { background: #fff7ed; border: 1px solid #fdba74; }
.legend-box.level-4 { background: #fee2e2; border: 1px solid #fca5a5; }

/* SANKEY FLOW DIAGRAM STYLES */
.sankey-guide-text {
    font-size: 0.82rem;
    color: #64748b;
    margin: 4px 0 14px 0;
    line-height: 1.4;
}

.sankey-guide-text strong {
    color: #4338ca;
}

.sankey-diagram-container {
    background: #f8fafc;
    border-radius: 18px;
    padding: 16px;
    border: 1px solid #f1f5f9;
    min-height: 310px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sankey-svg {
    width: 100%;
    height: auto;
    max-height: 380px;
    overflow: visible;
}

.sankey-link {
    fill-opacity: 0.45;
    transition: fill-opacity 200ms ease, stroke 200ms ease;
    cursor: pointer;
}

.sankey-link:hover {
    fill-opacity: 0.8;
}

.sankey-node rect {
    cursor: pointer;
    transition: transform 150ms ease, filter 150ms ease;
}

.sankey-node:hover rect {
    filter: brightness(1.08);
}

.sankey-node text {
    font-family: inherit;
    user-select: none;
    pointer-events: none;
}

