/*
 * BudgetSnapshot: the tool's own components, styled in the site's design language (6 Oct 2026, on the UltraCompress Pro
 * template, after SocialSizer). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus
 * rings) and /libs/shared-nav.css (the site's header and footer). This file holds only what the tool itself needs: the
 * toolbar with the month and year selects, the four dashboard tiles, the cards, the entry lists, the donut chart with its
 * legend and the top-three list, the category bars, the three-month comparison, the budget progress bars, the windows
 * (income, expense, settings, targets, edit, confirm, shortcuts), the forms, the toasts and the print view. Light is the
 * default; dark applies when <html> has no data-theme. Every class and id the script touches keeps its name, and the
 * original's variable names the script reads for the chart (--card-bg, --border-color, --text-primary, --text-secondary,
 * --success-color, --danger-color) are aliases of the site tokens.
 */

/* ----- Tokens the tool adds, and the original's names as aliases ----- */
:root {
    --surface: #ffffff;                 /* cards are true white in the light theme */
    --surface-2: #f3f4f8;               /* a quiet inset inside a card */
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --income: #16a34a;
    --expense: #dc2626;
    --card-bg: var(--surface);
    --border-color: var(--surface-border);
    --text-primary: var(--text-strong);
    --text-secondary: var(--text-2);
    --success-color: var(--success);
    --danger-color: var(--danger);
    --warning-color: var(--warning);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --income: #4ade80;
    --expense: #f87171;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container {
    max-width: calc(var(--app-max) + 2 * var(--content-gutter));
    margin-top: 16px;
}
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- Tools back link above the header, as on every other tool: the bar scrolls away under the sticky header ----- */
body { padding-top: 0; }
.back-bar { height: 48px; display: flex; align-items: center; padding: 0 var(--zdu-gutter, 24px); }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: calc(90px + var(--bar-offset, 48px)); }
@media (max-width: 768px) { .theme-toggle { top: calc(75px + var(--bar-offset, 48px)); } }

.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; }
.hidden-input { display: none; }

/* ----- Hero: brand row, headline, tagline ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-strong);
}
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Buttons: the site's pills in the tool's sizes ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 9999px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    padding: 12px 24px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }

/* ----- The app: the toolbar above the cards ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin: 0 0 1.25rem; }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.month-selector {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 14px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 9999px;
    box-shadow: var(--surface-shadow);
}
.month-selector-icon { font-size: 1.05rem; line-height: 1; }
.pill-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 7px 30px 7px 12px;
    border: 1px solid transparent;
    border-radius: 9999px;
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-strong);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.pill-select:hover { border-color: var(--brand); }
.pill-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.pill-select option { color: #0a0a14; background: #fff; }

/* ----- Dashboard: four tiles, two by two on phones ----- */
.dashboard { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0 0 20px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--surface-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.stat-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.stat-card-label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.stat-card-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
}
.stat-card-icon.income { background: linear-gradient(135deg, #22c55e, #0d9488); }
.stat-card-icon.expense { background: linear-gradient(135deg, #f97316, #ef4444); }
.stat-card-icon.balance { background: var(--gradient-brand); }
.stat-card-icon.savings { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.stat-card-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.75rem; font-weight: 700; color: var(--text-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card-change { min-height: 1.3em; margin-top: 6px; font-size: 0.85rem; color: var(--text-3); }
.stat-card-change.positive { color: var(--income); }
.stat-card-change.negative { color: var(--expense); }

/* ----- Cards ----- */
.main-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0 0 20px; align-items: start; }
.card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--surface-shadow);
    overflow: hidden;
}
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; }

/* ----- Entry lists ----- */
.entry-list { display: flex; flex-direction: column; gap: 8px; }
.entry-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.entry-item:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.entry-item--budget { flex-wrap: wrap; }
.entry-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.entry-color { width: 12px; height: 12px; flex-shrink: 0; border-radius: 50%; }
.entry-name { font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.entry-category { font-size: 0.78rem; color: var(--text-3); }
.entry-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-amount.income { color: var(--income); }
.entry-amount.expense { color: var(--expense); }
.entry-actions { display: flex; gap: 4px; flex-shrink: 0; }
.entry-actions button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.entry-actions button svg { width: 15px; height: 15px; }
.entry-actions button:hover { border-color: var(--brand); color: var(--link); }
.entry-actions button.danger:hover { border-color: var(--danger); color: var(--danger); }
.budget-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(220, 38, 38, 0.08);
    color: var(--expense);
    font-size: 0.85rem;
    font-weight: 600;
}
.entry-item--budget .budget-warning { width: 100%; }
.empty-state { text-align: center; padding: 28px 16px; color: var(--text-3); }
.empty-state-icon { font-size: 2.2rem; line-height: 1; margin-bottom: 10px; }
.empty-state-text { font-weight: 600; color: var(--text-2); }
.empty-state-subtext { font-size: 0.85rem; margin-top: 4px; }

/* ----- Donut chart, legend, top three ----- */
.chart-container { display: flex; justify-content: center; padding: 8px 0 12px; }
.pie-chart { display: block; max-width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin-bottom: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-2); }
.legend-color { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.top-spending { margin-top: 12px; }
.top-spending h4 { margin: 0 0 10px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.top-spending-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--surface-border); margin-bottom: 8px; }
.top-spending-item.highlight { background: var(--tint-brand); border-color: var(--tint-brand-border); }
.top-spending-rank {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.top-spending-info { flex: 1; min-width: 0; }
.top-spending-name { font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.top-spending-percent { font-size: 0.78rem; color: var(--text-3); }
.top-spending-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ----- Category bars ----- */
.bar-chart { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.bar-item { display: grid; grid-template-columns: minmax(0, 110px) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.bar-label { font-size: 0.85rem; color: var(--text-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 26px; background: var(--surface-2); border-radius: var(--radius-sm); overflow: hidden; }
.bar-fill {
    height: 100%;
    min-width: 2px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    transition: width 0.4s ease;
}
.bar-value { font-size: 0.8rem; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 0; }

/* ----- Three-month comparison ----- */
.comparison-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.comparison-item { padding: 14px 12px; border: 1px solid var(--surface-border); border-radius: 12px; text-align: center; background: var(--surface); }
.comparison-item.current { background: var(--tint-brand); border-color: var(--tint-brand-border); }
.comparison-month { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.comparison-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.15rem; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.comparison-change { margin-top: 6px; font-size: 0.8rem; font-weight: 600; }
.comparison-change.positive { color: var(--income); }
.comparison-change.negative { color: var(--expense); }

/* ----- Budget targets ----- */
.budget-progress { flex: 1 1 200px; min-width: 0; }
.progress-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.progress-fill.good { background: linear-gradient(90deg, #22c55e, #0d9488); }
.progress-fill.warning { background: linear-gradient(90deg, #f59e0b, #f97316); }
.progress-fill.danger { background: linear-gradient(90deg, #ef4444, #dc2626); }
.budget-text { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 0.78rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.budget-add-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; }

/* ----- Forms ----- */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-strong); }
.form-input {
    width: 100%;
    min-width: 0;
    padding: 10px 14px;
    background: var(--field);
    border: 1px solid var(--field-border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-input::placeholder { color: var(--placeholder); }
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.form-input.input-error { border-color: var(--danger); animation: shake 0.4s ease; }
.form-input--auto { width: auto; }
select.form-input option { color: #0a0a14; background: #fff; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.form-error { min-height: 1.2em; margin-top: 4px; font-size: 0.8rem; color: var(--danger); }
.form-error:empty { display: none; }
.form-hint { font-size: 0.78rem; color: var(--text-3); margin: 0; }
.presets-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-btn {
    padding: 6px 12px;
    border: 1px solid var(--chip-border);
    border-radius: 9999px;
    background: var(--chip);
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.preset-btn:hover { border-color: var(--brand); color: var(--link); }
.preset-btn.active { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-option:hover { transform: scale(1.1); }
.color-option.selected { border-color: var(--text-strong); box-shadow: 0 0 0 3px var(--ring); }
.color-option:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Settings rows */
.settings-section { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--surface-border); }
.settings-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.settings-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 0.95rem; color: var(--text); }
.settings-row + .form-hint { margin-top: 6px; }
.settings-row label { font: inherit; color: inherit; }
.settings-row .target-amount { color: var(--text-2); font-variant-numeric: tabular-nums; }
.manager-empty { margin: 0; font-size: 0.9rem; color: var(--text-3); }

/* ----- Windows ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(12px);
    transition: transform 0.25s ease;
}
.modal--narrow { max-width: 420px; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { margin: 0; font-size: 1.15rem; }
.modal-close {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-strong);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.modal-close:hover { border-color: var(--brand); color: var(--link); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-hint { margin-top: 14px; }
.confirm-message { margin: 0; color: var(--text); }
.shortcuts-list { display: grid; gap: 10px; }
.shortcut-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shortcut-keys { display: flex; gap: 4px; }
.shortcut-key {
    background: var(--surface-2);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 600;
    color: var(--text-2);
}
.shortcut-description { font-size: 0.875rem; color: var(--text-2); }

/* ----- Toasts ----- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast {
    background: #0a0a14;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 4px solid var(--brand);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    min-width: 260px;
    max-width: 400px;
    font-size: 0.875rem;
    font-weight: 500;
    overflow-wrap: anywhere;
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-icon { font-size: 1.1rem; line-height: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left-color: #4ade80; }
.toast.error { border-left-color: #f87171; }
.toast.warning { border-left-color: #fbbf24; }
.toast.info { border-left-color: #38bdf8; }
.hidden { display: none !important; }

/* ----- Information sections below the tool ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section > p { max-width: 70ch; }
/* Three columns on desktops, two on tablets, one on phones: six cards fill two rows without a gap. */
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.info-section article:not(.info-card) p { color: var(--text-2); max-width: 70ch; }
.step-card { position: relative; padding-top: 24px; }
.step-num {
    position: absolute;
    top: -16px;
    left: 20px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary {
    cursor: pointer;
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-strong);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .info-section .info-grid, .info-three { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 899px) {
    .main-content { grid-template-columns: 1fr; }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .month-selector { width: 100%; justify-content: center; }
    .pill-select { flex: 1; min-width: 0; }
    .app-actions { width: 100%; }
    .app-actions .btn { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; }
    .dashboard { gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-card-value { font-size: 1.4rem; }
    .card-header { padding-left: 16px; padding-right: 16px; }
    .card-body { padding: 14px 16px 16px; }
    .bar-item { grid-template-columns: minmax(0, 80px) minmax(0, 1fr) auto; gap: 8px; }
    .comparison-grid { gap: 8px; }
    .comparison-item { padding: 12px 8px; }
    .comparison-value { font-size: 1rem; }
    .budget-add-row { grid-template-columns: 1fr; }
    .modal-overlay { padding: 8px; }
    .modal-body, .modal-header, .modal-footer { padding-left: 16px; padding-right: 16px; }
    .toast-container { bottom: 16px; right: 16px; left: 16px; align-items: flex-end; }
    .toast { min-width: 0; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .stat-card, .entry-item, .info-card, .modal, .toast, .bar-fill, .progress-fill, .color-option { transition: none; animation: none; }
}

/* ----- Print: the month on paper, nothing else ----- */
@media print {
    body { background: #fff !important; color: #000; }
    .back-bar, body > header, .theme-toggle, .app-hero, .app-toolbar, .info-section, footer, .modal-overlay, .toast-container, .entry-actions, .card-header .btn, #zdu-cookie-banner { display: none !important; }
    .container.app-container { max-width: none; margin: 0; padding: 0; }
    .app-shell { margin: 0; }
    .dashboard { grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
    .main-content { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 10px; }
    .stat-card, .card, .entry-item, .comparison-item, .top-spending-item { break-inside: avoid; box-shadow: none !important; border: 1px solid #ccc; background: #fff; transform: none !important; }
    .stat-card-value, .card-title, .entry-name, .comparison-value, .top-spending-name { color: #000; }
    .bar-fill, .progress-fill, .stat-card-icon, .top-spending-rank { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
}
