:root {
    --bg: #f3f5f9;
    --bg-soft: #eef2f8;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: #ffffff;
    --ink: #12243b;
    --muted: #5f6f84;
    --primary: #0b5ed7;
    --primary-deep: #083b87;
    --accent: #d1a72c;
    --danger: #c0392b;
    --success: #157347;
    --line: rgba(18, 36, 59, 0.1);
    --shadow: 0 24px 60px rgba(17, 38, 68, 0.14);
    --field-bg: rgba(255, 255, 255, 0.92);
    --field-border: rgba(18, 36, 59, 0.14);
    --surface-soft: rgba(255, 255, 255, 0.72);
    --surface-hover: rgba(255, 255, 255, 0.46);
    --chip-bg: rgba(255, 255, 255, 0.74);
    --ribbon-overlay: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent);
    --top-link-bg: rgba(255, 255, 255, 0.86);
    --top-link-border: rgba(18, 36, 59, 0.08);
    --logout-bg: rgba(255, 255, 255, 0.94);
    --sidebar-card: rgba(255, 255, 255, 0.08);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-link-bg: rgba(255, 255, 255, 0.06);
    --sidebar-link-hover: rgba(255, 255, 255, 0.1);
    --login-form-bg: rgba(255, 255, 255, 0.96);
    --report-sheet-bg: rgba(255, 255, 255, 0.94);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

body[data-color-mode="dark"] {
    --bg: #0c1420;
    --bg-soft: #121d2b;
    --panel: rgba(14, 24, 38, 0.9);
    --panel-strong: #132134;
    --ink: #edf3ff;
    --muted: #9fb0c5;
    --line: rgba(159, 176, 197, 0.14);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
    --field-bg: rgba(10, 18, 29, 0.9);
    --field-border: rgba(159, 176, 197, 0.22);
    --surface-soft: rgba(15, 26, 41, 0.78);
    --surface-hover: rgba(20, 33, 51, 0.86);
    --chip-bg: rgba(19, 33, 52, 0.92);
    --ribbon-overlay: linear-gradient(180deg, rgba(11, 17, 26, 0.6), transparent);
    --top-link-bg: rgba(13, 22, 35, 0.9);
    --top-link-border: rgba(159, 176, 197, 0.12);
    --logout-bg: rgba(31, 18, 23, 0.95);
    --sidebar-card: rgba(7, 12, 20, 0.26);
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --sidebar-link-bg: rgba(255, 255, 255, 0.08);
    --sidebar-link-hover: rgba(255, 255, 255, 0.14);
    --login-form-bg: rgba(10, 18, 29, 0.96);
    --report-sheet-bg: rgba(12, 21, 33, 0.96);
}

.theme-red-gold {
    --primary: #b42318;
    --primary-deep: #7a1b13;
    --accent: #d4a017;
}

.theme-emerald-gold {
    --primary: #0f766e;
    --primary-deep: #115e59;
    --accent: #d4a017;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 12% 10%, rgba(209, 167, 44, 0.14), transparent 22%),
        radial-gradient(circle at 88% 12%, rgba(11, 94, 215, 0.14), transparent 25%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
    transition: background 0.25s ease, color 0.25s ease;
}

h1,
h2,
h3,
h4 {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    letter-spacing: -0.03em;
}

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

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--accent);
}

.hint,
.sidebar-user,
.sidebar-tagline,
.report-note,
.empty-state,
small {
    color: var(--muted);
}

input,
select,
textarea,
button,
.button-link {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--field-border);
    border-radius: 16px;
    padding: 13px 15px;
    background: var(--field-bg);
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(11, 94, 215, 0.45);
    box-shadow: 0 0 0 4px rgba(11, 94, 215, 0.08);
}

textarea {
    resize: vertical;
}

button,
.button-link {
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
    padding: 13px 18px;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(11, 94, 215, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
.button-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 34px rgba(11, 94, 215, 0.24);
}

.ghost-button {
    background: color-mix(in srgb, var(--panel-strong) 55%, transparent);
    color: var(--primary);
    border: 1px solid rgba(11, 94, 215, 0.18);
    box-shadow: none;
}

.danger-button {
    color: var(--danger);
    border-color: rgba(192, 57, 43, 0.24);
}

label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-panel {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    border-radius: 36px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-deep), var(--primary));
    box-shadow: 0 40px 90px rgba(10, 25, 49, 0.22);
    position: relative;
    isolation: isolate;
}

.login-copy,
.login-form {
    padding: 52px;
}

.login-copy {
    color: #fffdf8;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    overflow: hidden;
}

.login-mode-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
}

.login-copy h1 {
    margin: 0;
    font-size: clamp(2.6rem, 5vw, 4.8rem);
    line-height: 0.95;
}

.login-copy p:not(.eyebrow) {
    max-width: 560px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(255, 250, 240, 0.88);
}

.login-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.login-feature-list span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.92rem;
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(8px);
    opacity: 0.65;
    z-index: -1;
}

.login-orb-one {
    width: 240px;
    height: 240px;
    background: rgba(209, 167, 44, 0.38);
    top: -40px;
    right: 80px;
}

.login-orb-two {
    width: 220px;
    height: 220px;
    background: rgba(255, 255, 255, 0.12);
    bottom: -50px;
    left: -40px;
}

.login-form {
    background: var(--login-form-bg);
    display: grid;
    gap: 16px;
    align-content: center;
    position: relative;
}

.login-form::before {
    content: "";
    position: absolute;
    inset: 18px 18px auto auto;
    width: 82px;
    height: 82px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(209, 167, 44, 0.38), rgba(11, 94, 215, 0.14));
    opacity: 0.55;
}

.login-form h2 {
    margin: 0 0 6px;
    font-size: 2rem;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 30px 24px;
    color: #fff;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.14), transparent 24%),
        linear-gradient(180deg, var(--primary-deep), var(--primary));
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 22px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: grid;
    gap: 10px;
    padding: 20px;
    border-radius: 26px;
    background: var(--sidebar-card);
    border: 1px solid var(--sidebar-border);
}

.sidebar h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
}

.sidebar-user {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
}

.sidebar-tagline {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.6;
}

.nav-links {
    display: grid;
    gap: 10px;
}

.nav-links a {
    display: block;
    padding: 13px 15px;
    border-radius: 16px;
    background: var(--sidebar-link-bg);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: transform 0.2s ease, background 0.2s ease;
}

.nav-links a:hover {
    transform: translateX(2px);
    background: var(--sidebar-link-hover);
}

.nav-links a.active {
    background: linear-gradient(135deg, rgba(209, 167, 44, 0.94), rgba(236, 199, 80, 0.82));
    color: #1d1b15;
    font-weight: 800;
}

.content {
    position: relative;
    padding: 30px;
    display: grid;
    gap: 22px;
}

.top-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.sidebar-toggle {
    display: none;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 18px;
    background: var(--top-link-bg);
    border: 1px solid var(--top-link-border);
    box-shadow: 0 14px 28px rgba(17, 38, 68, 0.08);
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: var(--ink);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: rgba(8, 15, 24, 0.46);
    box-shadow: none;
    z-index: 20;
}

.top-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--top-link-bg);
    color: var(--primary-deep);
    border: 1px solid var(--top-link-border);
    box-shadow: 0 14px 28px rgba(17, 38, 68, 0.08);
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.top-action-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(17, 38, 68, 0.12);
}

.top-action-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
}

.logout-action {
    background: var(--logout-bg);
    color: var(--danger);
}

.mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid var(--top-link-border);
    background: var(--top-link-bg);
    color: var(--ink);
    box-shadow: 0 14px 28px rgba(17, 38, 68, 0.08);
}

.mode-toggle-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--panel-strong) 65%, var(--primary)));
    color: #1d1b15;
    font-size: 0.95rem;
}

.mode-toggle-label {
    font-weight: 800;
}

.page-ribbon {
    position: absolute;
    inset: 0 0 auto 0;
    height: 170px;
    background:
        radial-gradient(circle at 10% 0%, rgba(209, 167, 44, 0.16), transparent 26%),
        var(--ribbon-overlay);
    pointer-events: none;
}

.hero-card,
.panel,
.stat-card,
.alert-card {
    background: var(--panel);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero-card::before,
.panel::before,
.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(209, 167, 44, 0.12), transparent 68%);
    pointer-events: none;
}

.hero-card,
.panel {
    padding: 24px;
}

.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 22px;
}

.hero-card h2 {
    margin: 10px 0;
    font-size: clamp(2rem, 3.2vw, 3rem);
}

.hero-card p:not(.eyebrow) {
    margin: 0;
    max-width: 720px;
    color: var(--muted);
    line-height: 1.7;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.hero-meta span {
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--chip-bg);
    border: 1px solid var(--top-link-border);
    font-size: 0.92rem;
    font-weight: 700;
}

.stats-grid,
.dashboard-grid {
    display: grid;
    gap: 20px;
}

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

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

.stat-card {
    padding: 24px;
    min-height: 146px;
}

.stat-card span {
    display: block;
    margin-bottom: 12px;
    color: var(--muted);
    font-weight: 700;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1.1;
}

.income strong { color: var(--success); }
.expense strong { color: var(--danger); }
.savings strong,
.goal strong { color: var(--primary); }

.panel-head,
.progress-label,
.button-row,
.actions,
.legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-head h3 {
    margin: 0;
    font-size: 1.35rem;
}

.stack-form,
.inline-form {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: end;
}

.stack-form {
    display: grid;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.quick-actions a {
    padding: 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, transparent), color-mix(in srgb, var(--accent) 20%, transparent));
    border: 1px solid var(--top-link-border);
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-actions a:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 28px rgba(17, 38, 68, 0.08);
}

.progress-block {
    display: grid;
    gap: 10px;
}

.progress-bar {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(11, 94, 215, 0.08);
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--primary));
}

.savings-health-panel {
    padding: 28px;
}

.savings-health-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    align-items: center;
}

.savings-health-kicker {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 800;
}

.savings-health-title {
    display: block;
    margin-bottom: 8px;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    line-height: 1.1;
}

.savings-health-text {
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.7;
}

.savings-health-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.savings-health-meta span {
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--chip-bg);
    border: 1px solid var(--top-link-border);
    font-size: 0.9rem;
    font-weight: 700;
}

.savings-health-chart {
    display: grid;
    gap: 18px;
}

.mini-goal-chart {
    display: grid;
    place-items: center;
}

.mini-goal-ring {
    --ring-color: var(--danger);
    width: 190px;
    height: 190px;
    padding: 16px;
    border-radius: 50%;
    background: conic-gradient(var(--ring-color) 0 calc(var(--progress) * 1%), rgba(18, 36, 59, 0.1) calc(var(--progress) * 1%) 100%);
    display: grid;
    place-items: center;
}

.mini-goal-ring > div {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--panel-strong);
    display: grid;
    place-items: center;
    text-align: center;
    box-shadow: inset 0 0 0 1px var(--top-link-border);
}

.mini-goal-ring strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
}

.mini-goal-ring span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.status-good {
    color: var(--success);
}

.status-mid {
    color: #b7791f;
}

.status-low {
    color: var(--danger);
}

.mini-goal-ring.status-good {
    --ring-color: var(--success);
}

.mini-goal-ring.status-mid {
    --ring-color: #d1a72c;
}

.mini-goal-ring.status-low {
    --ring-color: var(--danger);
}

.savings-health-bar.status-good span {
    background: linear-gradient(135deg, var(--success), #2fa36b);
}

.savings-health-bar.status-mid span {
    background: linear-gradient(135deg, #d1a72c, #b7791f);
}

.savings-health-bar.status-low span {
    background: linear-gradient(135deg, #e55645, var(--danger));
}

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

.monthly-savings-card {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel-strong) 92%, transparent), color-mix(in srgb, var(--bg-soft) 92%, transparent));
    border: 1px solid var(--top-link-border);
}

.monthly-savings-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.monthly-savings-head strong {
    font-size: 1.05rem;
}

.mini-progress-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(18, 36, 59, 0.08);
    margin-bottom: 14px;
}

.mini-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.mini-progress-fill.status-good {
    background: linear-gradient(135deg, var(--success), #2fa36b);
}

.mini-progress-fill.status-mid {
    background: linear-gradient(135deg, #d1a72c, #b7791f);
}

.mini-progress-fill.status-low {
    background: linear-gradient(135deg, #e55645, var(--danger));
}

.monthly-savings-meta {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

.chart-boxes {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: center;
}

.pie-card {
    display: grid;
    place-items: center;
    gap: 14px;
}

.pie-chart {
    width: 172px;
    height: 172px;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.2);
}

.pie-chart::after {
    content: "";
    position: absolute;
    inset: 34px;
    border-radius: 50%;
    background: var(--panel-strong);
    box-shadow: inset 0 0 0 1px var(--top-link-border);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.dot-expense,
.expense-bar {
    background: var(--accent);
}

.dot-savings {
    background: var(--primary);
}

.bar-chart {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 28px;
    min-height: 220px;
    padding: 18px 0;
}

.bar-chart div {
    width: 84px;
    display: grid;
    justify-items: center;
    gap: 10px;
}

.bar-chart label {
    font-size: 0.9rem;
}

.bar-chart span {
    display: block;
    width: 100%;
    min-height: 18px;
    border-radius: 24px 24px 8px 8px;
    background: linear-gradient(180deg, rgba(11, 94, 215, 0.84), var(--primary-deep));
}

.breakdown-list,
.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.breakdown-list li,
.import-history article {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--top-link-border);
}

.import-history {
    display: grid;
    gap: 12px;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
}

.data-table th {
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

.compact-table th,
.compact-table td {
    padding: 10px 8px;
}

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

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

.panel-section h4 {
    margin: 0 0 6px;
    font-size: 1.08rem;
}

.panel-section p {
    margin: 0;
}

.flash,
.alert-card {
    padding: 14px 16px;
}

.flash {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.flash-success {
    background: rgba(21, 115, 71, 0.12);
    color: var(--success);
}

.flash-error,
.danger {
    background: rgba(192, 57, 43, 0.12);
    color: var(--danger);
}

.report-sheet {
    background: var(--report-sheet-bg);
    border-radius: 30px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.report-cover {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 30px;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--primary-deep), rgba(209, 167, 44, 0.75));
    color: #fff;
}

.cover-meta {
    text-align: right;
    display: grid;
    gap: 6px;
}

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

.report-summary article {
    padding: 20px;
    border-radius: 22px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel-strong) 92%, transparent), color-mix(in srgb, var(--bg-soft) 92%, transparent));
    border: 1px solid var(--top-link-border);
}

.report-summary strong {
    display: block;
    margin-top: 8px;
    font-size: 1.6rem;
}

.report-grid .print-panel {
    box-shadow: none;
    border: 1px solid var(--line);
}

.report-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-top: 24px;
    color: var(--muted);
}

.transaction-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    border: 1px solid currentColor;
}

.transaction-income {
    color: var(--success);
}

.transaction-expense {
    color: var(--danger);
}

.transaction-pill.transaction-income {
    background: rgba(21, 115, 71, 0.12);
}

.transaction-pill.transaction-expense {
    background: rgba(192, 57, 43, 0.12);
}

.summary-print-body {
    min-height: 100vh;
    padding: 28px;
}

.summary-print-shell {
    width: min(1280px, 100%);
    margin: 0 auto;
}

.summary-print-card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 30px;
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(18, 36, 59, 0.06);
}

.summary-print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.summary-print-header h1 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 3vw, 2.8rem);
}

.summary-print-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

.summary-print-actions {
    display: grid;
    gap: 12px;
    justify-items: end;
}

.all-months-stack {
    display: grid;
    gap: 24px;
}

.month-sheet {
    padding: 22px;
    border-radius: 28px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel-strong) 94%, transparent), color-mix(in srgb, var(--bg-soft) 88%, transparent));
    border: 1px solid var(--top-link-border);
}

.month-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.month-sheet-header h2 {
    margin: 0 0 6px;
    font-size: 1.8rem;
}

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

.summary-total-card {
    padding: 16px 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel-strong) 92%, transparent), color-mix(in srgb, var(--bg-soft) 92%, transparent));
    border: 1px solid var(--top-link-border);
}

.summary-total-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.summary-total-card strong {
    display: block;
    font-size: 1.45rem;
    line-height: 1.1;
}

.summary-print-table th,
.summary-print-table td {
    padding: 18px 16px;
}

.summary-print-table th {
    font-size: 0.88rem;
    letter-spacing: 0.12em;
}

.summary-print-table td {
    font-size: 1.02rem;
}

body[data-color-mode="dark"] .summary-print-card {
    background: rgba(12, 21, 33, 0.98);
    border-color: rgba(159, 176, 197, 0.12);
}

body[data-color-mode="dark"] .month-sheet {
    background: rgba(15, 26, 41, 0.78);
}

@media (max-width: 1200px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(320px, 84vw);
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 26px 60px rgba(0, 0, 0, 0.24);
    }

    .sidebar-toggle {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }
}

@media (max-width: 1100px) {
    .login-panel,
    .stats-grid,
    .dashboard-grid,
    .monthly-savings-grid,
    .report-summary,
    .savings-health-grid,
    .summary-totals,
    .mapping-grid,
    .settings-grid,
    .chart-boxes {
        grid-template-columns: 1fr;
    }

    .hero-card,
    .report-cover {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 760px) {
    .content,
    .sidebar,
    .login-copy,
    .login-form {
        padding: 20px;
    }

    .hero-card,
    .panel,
    .stat-card,
    .report-sheet {
        border-radius: 22px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .top-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .sidebar-toggle,
    .top-action-link {
        flex: 1 1 160px;
    }

    .mode-toggle {
        flex: 1 1 160px;
    }

    .login-mode-toggle {
        position: static;
        justify-self: start;
        margin-bottom: 12px;
    }

    .summary-print-body {
        padding: 16px;
    }

    .summary-print-header {
        flex-direction: column;
    }

    .summary-print-actions {
        width: 100%;
        justify-items: stretch;
    }

    .month-sheet {
        padding: 16px;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    body {
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .summary-print-body {
        padding: 0;
        background: #fff;
    }

    .summary-print-card {
        padding: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: #fff;
    }

    .summary-print-actions {
        display: none !important;
    }

    .summary-print-header {
        margin-bottom: 10px;
    }

    .summary-print-header h1 {
        margin: 4px 0 6px;
        font-size: 1.8rem;
    }

    .summary-print-subtitle {
        font-size: 0.92rem;
    }

    .summary-totals {
        gap: 10px;
        margin: 0 0 10px;
    }

    .all-months-stack {
        gap: 0;
    }

    .month-sheet {
        padding: 0;
        border: none;
        border-radius: 0;
        background: #fff;
        page-break-after: always;
        break-after: page;
    }

    .month-sheet:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    .month-sheet-header {
        margin-bottom: 8px;
    }

    .month-sheet-header h2 {
        margin: 0 0 4px;
        font-size: 1.45rem;
    }

    .summary-total-card {
        padding: 10px 12px;
        border-radius: 14px;
        break-inside: avoid;
    }

    .summary-total-card span {
        margin-bottom: 6px;
        font-size: 0.7rem;
    }

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

    .summary-print-table th,
    .summary-print-table td {
        padding: 10px 10px;
    }

    .summary-print-table th {
        font-size: 0.72rem;
        letter-spacing: 0.09em;
    }

    .summary-print-table td {
        font-size: 0.88rem;
    }

    .transaction-pill {
        min-width: 74px;
        padding: 5px 10px;
        font-size: 0.72rem;
    }

    .sidebar,
    .hero-card .button-row,
    .hero-card form,
    .flash,
    .page-ribbon {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content,
    .report-sheet {
        padding: 0;
        box-shadow: none;
    }

    .panel,
    .hero-card,
    .report-sheet {
        border: none;
        background: #fff;
        box-shadow: none;
    }
}
