/* ============================================
   Budget CashFlow - Style
   Premium Fintech Design
   ============================================ */

/* --- Custom Properties --- */
:root {
    --bg-primary: #f6f8fc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-header: #1e293b;
    --bg-input: #f1f4f9;
    --bg-hover: #e4e9f1;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-on-dark: #e2e8f0;
    --text-on-accent: #ffffff;

    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.07);
    --income: #10b981;
    --income-light: rgba(16, 185, 129, 0.08);
    --expense: #ef4444;
    --expense-light: rgba(239, 68, 68, 0.07);
    --warning: #f59e0b;
    --danger: #ef4444;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.03), 0 1px 6px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;

    --header-height: 60px;
    --sidebar-width: 260px;
    --bottom-nav-height: 64px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* --- Lock Screen --- */
.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(160deg, #0a0f1e 0%, #141c30 40%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.lock-screen.unlocked {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.lock-screen__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px;
    width: 100%;
    max-width: 320px;
}

.lock-logo {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 50%, #a78bfa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.35), 0 4px 12px rgba(99, 102, 241, 0.2);
}

.lock-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.03em;
    margin-top: -4px;
}

.lock-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    min-height: 20px;
    transition: color 0.25s;
}

.lock-subtitle.error {
    color: #ef4444;
}

.lock-dots {
    display: flex;
    gap: 18px;
    padding: 12px 0;
}

.lock-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(71, 85, 105, 0.6);
    background: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lock-dot.filled {
    background: #f8fafc;
    border-color: #f8fafc;
    box-shadow: 0 0 12px rgba(248, 250, 252, 0.3);
}

.lock-dot.error {
    border-color: #ef4444;
    background: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.lock-dots.shake {
    animation: lockShake 0.5s ease;
}

@keyframes lockShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-12px); }
    30% { transform: translateX(10px); }
    45% { transform: translateX(-8px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

.lock-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 264px;
    margin-top: 8px;
}

.lock-key {
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    color: #f8fafc;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    width: 76px;
    height: 76px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.lock-key span {
    font-size: 1.65rem;
    font-weight: 400;
    line-height: 1;
}

.lock-key small {
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: #64748b;
    margin-top: 2px;
}

.lock-key:active {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(0.94);
    border-color: rgba(255, 255, 255, 0.12);
}

.lock-key--empty {
    background: transparent;
    pointer-events: none;
    border-color: transparent;
}

.lock-key--delete {
    background: transparent;
    color: #94a3b8;
    border-color: transparent;
}

.lock-key--delete:active {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
}

/* --- Header --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--bg-header) 0%, #0f172a 100%);
    color: var(--text-on-dark);
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    max-width: 1400px;
    margin: 0 auto;
}

.app-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.menu-btn, .add-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-on-dark);
    transition: all var(--transition);
}

.menu-btn:hover, .add-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.add-btn {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.add-btn:hover {
    background: var(--accent-hover);
}

/* --- Sidebar --- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s, visibility 0.35s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100dvh;
    background: linear-gradient(180deg, #0f172a 0%, #1a2540 100%);
    color: var(--text-on-dark);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 28px 20px 24px;
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818cf8 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user__name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
}

.sidebar-user__plan {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 500;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 4px 20px;
}

.nav-list {
    padding: 8px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    transition: all var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.nav-link svg {
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.nav-link:hover svg {
    opacity: 1;
}

.nav-link.active {
    color: white;
    background: rgba(99, 102, 241, 0.18);
}

.nav-link.active svg {
    opacity: 1;
    color: #a5b4fc;
}

.sidebar-actions {
    padding: 4px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all var(--transition);
}

.sidebar-action-btn svg {
    flex-shrink: 0;
    opacity: 0.55;
}

.sidebar-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.sidebar-action-btn:hover svg {
    opacity: 1;
}

.sidebar-bottom {
    padding: 16px 20px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.68rem;
    color: #334155;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Bottom Navigation (mobile) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 90;
    padding: 6px 4px 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-icon {
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item.active .bottom-nav-icon {
    background: var(--accent-light);
    width: 56px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
}

.bottom-nav-item.active {
    color: var(--accent);
}

.bottom-nav-item.active svg {
    stroke-width: 2.2;
}

.bottom-nav-item:hover {
    color: var(--accent);
}

.bottom-nav-add {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35), 0 2px 6px rgba(99, 102, 241, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: -24px;
    flex-shrink: 0;
    flex: 0 0 52px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 2;
}

.bottom-nav-add:active {
    transform: scale(0.9);
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3);
}

/* --- Main Content --- */
.main-content {
    margin-top: var(--header-height);
    padding: 24px 16px;
    padding-bottom: calc(var(--bottom-nav-height) + 32px);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    min-height: calc(100dvh - var(--header-height));
}

/* --- Page Title --- */
.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.04em;
    color: var(--text-primary);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(226, 232, 240, 0.3);
}

.card-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* --- Balance Cards Grid --- */
.balance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.balance-card {
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.balance-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(226, 232, 240, 0.3);
    transform: translateY(-1px);
}

.balance-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 4px 4px 0;
}

.balance-card--personal::before { background: linear-gradient(180deg, var(--accent) 0%, #818cf8 100%); }
.balance-card--business::before { background: linear-gradient(180deg, var(--warning) 0%, #fbbf24 100%); }
.balance-card--total::before { background: linear-gradient(180deg, var(--income) 0%, #34d399 100%); }

.balance-card__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.balance-card__amount {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.balance-card__amount--positive { color: var(--income); }
.balance-card__amount--negative { color: var(--expense); }
.balance-card__amount--zero { color: var(--text-muted); }

.balance-card__detail {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.balance-card__income { color: var(--income); font-weight: 600; }
.balance-card__expense { color: var(--expense); font-weight: 600; }

/* --- Dashboard Filter --- */
.dash-filter {
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dash-filter__tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 3px;
}

.dash-filter__tab {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dash-filter__tab.active {
    background: var(--bg-secondary);
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dash-filter__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.dash-filter__nav button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    color: var(--text-secondary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.dash-filter__nav button:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.dash-filter__label {
    font-size: 0.95rem;
    font-weight: 700;
    min-width: 140px;
    text-align: center;
    color: var(--text-primary);
}

.dash-filter__date {
    padding: 8px 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 10px;
    background: var(--bg-input);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.dash-filter__date:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dash-filter__range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 8px;
}

.dash-filter__range-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dash-filter__range-field label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.dash-filter__range-field .dash-filter__date {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    font-size: 0.82rem;
}

.dash-filter__range-sep {
    padding-bottom: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Dashboard Tasks --- */
.dash-tasks-box {
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
}

.dash-tasks-section {
    padding: 0;
}

.dash-tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dash-tasks-count {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--accent-light);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 99px;
}

.dash-tasks-count--red {
    background: var(--expense-light);
    color: var(--expense);
}

.dash-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
    gap: 12px;
    transition: background 0.2s;
}

.dash-task-item--overdue {
    background: rgba(239, 68, 68, 0.03);
}

.dash-task-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-task-item--overdue .dash-task-title {
    color: var(--expense);
}

.dash-task-date {
    font-size: 0.75rem;
    color: var(--expense);
    font-weight: 600;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.dash-task-done {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--income-light);
    color: var(--income);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

.dash-task-done:active {
    background: var(--income);
    color: white;
    transform: scale(0.88);
}

/* --- Summary previste inline --- */
.summary-previste-list {
    margin-top: 8px;
    border-top: 1px solid var(--bg-hover);
}

.summary-prevista-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-hover);
}

.summary-prevista-row:last-child {
    border-bottom: none;
}

.summary-prevista-desc {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-prevista-amt {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--warning);
    white-space: nowrap;
    flex-shrink: 0;
}

.summary-prevista-ok {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--income-light);
    color: var(--income);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.summary-prevista-ok:active {
    background: var(--income);
    color: white;
}

.summary-prevista-fail {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--expense-light);
    color: var(--expense);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.summary-prevista-fail:active {
    background: var(--expense);
    color: white;
}

.previsti-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

/* --- Soldi Previsti Box --- */
.previsti-box {
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
    transition: box-shadow var(--transition);
}

.previsti-box:hover {
    box-shadow: var(--shadow-sm);
}

.previsti-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 4px 4px 0;
}

.previsti-box--in::before { background: linear-gradient(180deg, var(--income) 0%, #34d399 100%); }
.previsti-box--out::before { background: linear-gradient(180deg, var(--expense) 0%, #f87171 100%); }

.previsti-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.previsti-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.previsti-title > span:first-child {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.previsti-total {
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.previsti-total--pos { color: var(--income); }
.previsti-total--neg { color: var(--expense); }

.previsti-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.previsti-list {
    max-height: 300px;
    overflow-y: auto;
}

.previsti-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.4);
    transition: background 0.18s ease;
}

.previsti-item:last-child {
    border-bottom: none;
}

.previsti-item:active {
    background: var(--bg-input);
}

.previsti-item__info {
    flex: 1;
    min-width: 0;
}

.previsti-item__desc {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.previsti-item__meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.previsti-item__amount {
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.previsti-item__amount--in { color: var(--income); }
.previsti-item__amount--out { color: var(--text-primary); }

.previsti-item__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.previsti-confirm-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--income-light);
    color: var(--income);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.previsti-confirm-btn:active {
    background: var(--income);
    color: white;
    transform: scale(0.9);
}

.previsti-fail-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--expense-light);
    color: var(--expense);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.previsti-fail-btn:active {
    background: var(--expense);
    color: white;
    transform: scale(0.9);
}

.previsti-empty {
    padding: 28px 16px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Transaction delete button --- */
.tx-delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    opacity: 0.5;
}

.tx-delete-btn:active {
    background: var(--expense-light);
    color: var(--expense);
    opacity: 1;
}

@media (hover: hover) {
    .tx-delete-btn { opacity: 0; }
    .tx-item:hover .tx-delete-btn { opacity: 1; }
}

/* --- Calendar --- */
.cal {
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 24px;
}

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cal-month {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.cal-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.cal-nav:hover {
    background: var(--bg-input);
    color: var(--accent);
}

.cal-nav svg,
.cal-header button svg {
    pointer-events: none;
}

.cal-month-totals {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 14px;
}

.cal-month-total {
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cal-month-total--in { color: var(--income); }
.cal-month-total--out { color: var(--expense); }

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

.cal-weekdays span {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 0;
}

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

.cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 2px;
    min-height: 48px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.cal-cell--empty {
    cursor: default;
}

.cal-day {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.cal-cell:hover:not(.cal-cell--empty) {
    background: var(--bg-input);
}

.cal-cell--today {
    background: rgba(99, 102, 241, 0.06);
}

.cal-cell--today .cal-day {
    color: var(--accent);
    font-weight: 800;
}

.cal-cell--selected {
    background: var(--accent);
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.3);
}

.cal-cell--selected .cal-day {
    color: white;
    font-weight: 700;
}

.cal-cell--selected:hover {
    background: var(--accent-hover);
}

.cal-cell--selected .cal-dot {
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.cal-dots {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transition: transform 0.15s;
}

.cal-dot--in { background: var(--income); }
.cal-dot--out { background: var(--expense); }
.cal-dot--prev { background: var(--warning); }

/* Selected day section */
.cal-day-section {
    margin-bottom: 24px;
}

.cal-day-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-left: 4px;
}

.cal-day-empty {
    text-align: center;
    padding: 28px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Transactions Page (app-style) --- */
.tx-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tx-page-totals {
    display: flex;
    gap: 14px;
}

.tx-page-total {
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tx-page-total--in { color: var(--income); }
.tx-page-total--out { color: var(--expense); }

.tx-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.tx-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.tx-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.tx-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.tx-search input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: inherit;
}

.tx-search input::placeholder {
    color: var(--text-muted);
}

.tx-filters {
    display: flex;
    gap: 0;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 3px;
}

.tx-filter-pill {
    flex: 1;
    padding: 8px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tx-filter-pill.active {
    background: var(--bg-secondary);
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tx-date-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 16px 4px 8px;
}

/* --- Transaction Item (app-style) --- */
.tx-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tx-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--bg-card);
}

.tx-item:last-child {
    border-bottom: none;
}

.tx-item:active {
    background: var(--bg-input);
    transform: scale(0.99);
}

.tx-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tx-icon--income { background: var(--income-light); color: var(--income); }
.tx-icon--expense { background: var(--expense-light); color: var(--expense); }

.tx-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tx-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tx-desc {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tx-badge-prev {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 99px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
    color: var(--warning);
    font-size: 0.58rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tx-amt {
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.tx-amt--income { color: var(--income); }
.tx-amt--expense { color: var(--text-primary); }

.tx-row-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.tx-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.4;
    flex-shrink: 0;
}

.tx-tag {
    font-weight: 600;
}

.tx-tag--personale { color: var(--accent); }
.tx-tag--societario { color: var(--warning); }

.tx-count {
    text-align: center;
    padding: 24px 0 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Confirmed income item */
.tx-item--income {
    background: rgba(16, 185, 129, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.12);
}

/* Confirmed expense item */
.tx-item--expense {
    background: rgba(239, 68, 68, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.1);
}

/* Prevista item */
.tx-item--prevista {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(99, 102, 241, 0.03) 100%);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.tx-item--prevista::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--warning) 0%, var(--accent) 100%);
    border-radius: 3px 0 0 3px;
}

.tx-amt--prevista {
    color: var(--warning);
    font-style: italic;
}

.tx-item--prevista .tx-desc {
    color: var(--text-secondary);
}

.tx-item--prevista .tx-row-bottom {
    color: var(--text-muted);
}

/* --- Action Sheet --- */
.action-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 350;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.action-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.action-sheet {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 400px;
    padding: 8px 16px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.1);
}

.action-sheet::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--bg-hover);
    border-radius: 99px;
    margin: 8px auto 16px;
}

.action-sheet-overlay.active .action-sheet {
    transform: translateY(0);
}

.action-sheet__title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.action-sheet__btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.18s;
    -webkit-tap-highlight-color: transparent;
}

.action-sheet__btn:active {
    background: var(--bg-input);
}

.action-sheet__icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-sheet__icon--tx {
    background: var(--income-light);
    color: var(--income);
}

.action-sheet__icon--task {
    background: var(--accent-light);
    color: var(--accent);
}

.action-sheet__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.action-sheet__label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.action-sheet__sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.action-sheet__cancel {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    background: var(--bg-input);
    transition: background 0.18s;
}

.action-sheet__cancel:active {
    background: var(--bg-hover);
}

@media (min-width: 900px) {
    .action-sheet {
        border-radius: var(--radius-xl);
        align-self: center;
        margin-bottom: 0;
    }
}

/* --- Tasks --- */
.task-add {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.task-add__input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.task-add__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.task-add__input::placeholder {
    color: var(--text-muted);
}

.task-add__btn {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.task-add__btn:active {
    background: var(--accent-hover);
    transform: scale(0.94);
}

.task-add-options {
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.task-option-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 0;
    gap: 6px;
}

.task-option-row label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.task-option-row input[type="date"] {
    padding: 7px 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 10px;
    background: var(--bg-input);
    font-size: 0.85rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

.task-option-row input[type="date"]:focus {
    border-color: var(--accent);
}

.task-priority-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 3px;
}

.task-pri-pill {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-type-pill {
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.task-type-pill.active {
    background: var(--bg-secondary);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.task-pri-pill.active {
    background: var(--bg-secondary);
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.task-section {
    margin-bottom: 24px;
}

.task-section__title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 14px 4px 10px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-item:active {
    background: var(--bg-input);
}

.task-item--done {
    opacity: 0.45;
}

.task-item--done .task-title {
    text-decoration: line-through;
}

.task-item--overdue {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.03);
}

.task-type-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.task-item--done .task-type-icon {
    opacity: 0.4;
}

.task-check {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color var(--transition), transform var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.task-check:active {
    transform: scale(0.9);
}

.task-item--done .task-check {
    color: var(--income);
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.task-pri-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-due {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.task-due--late {
    color: var(--expense);
}

.task-source {
    font-style: italic;
    color: var(--accent);
}

.task-delete {
    color: var(--text-muted);
    opacity: 0;
    transition: all var(--transition);
    flex-shrink: 0;
}

.task-item:hover .task-delete {
    opacity: 1;
}

@media (hover: none) {
    .task-delete { opacity: 0.5; }
}

.task-empty {
    text-align: center;
    padding: 48px 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Account Filter Tabs --- */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 9px 18px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--bg-input);
    color: var(--text-secondary);
    transition: all var(--transition);
    border: 2px solid transparent;
}

.filter-tab:hover {
    background: var(--bg-hover);
}

.filter-tab.active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Transaction List --- */
.tx-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tx-group-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 14px 0 6px;
}

.tx-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tx-icon--income { background: var(--income-light); color: var(--income); }
.tx-icon--expense { background: var(--expense-light); color: var(--expense); }


/* --- Charts --- */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 22px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: box-shadow var(--transition);
}

.chart-container:hover {
    box-shadow: var(--shadow-md);
}

/* Chart tooltip */
.chart-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.6;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.chart-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.chart-tooltip strong {
    display: block;
    font-size: 0.82rem;
    margin-bottom: 4px;
    color: #e2e8f0;
}

.chart-container canvas {
    display: block;
    width: 100%;
    height: auto;
}

.chart-container {
    overflow: visible;
}

.chart-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 18px;
}

/* --- Summary --- */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.summary-month-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 0 20px;
}

.summary-month-selector button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    transition: all var(--transition);
    position: relative;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.summary-month-selector button:hover,
.summary-month-selector button:active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.summary-month-selector button svg {
    pointer-events: none;
}

.summary-month-label {
    font-size: 1.15rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
    letter-spacing: -0.01em;
}

.summary-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.summary-stat:last-child { border-bottom: none; }

.summary-stat__label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-stat__value {
    font-weight: 700;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.category-bar {
    margin-top: 8px;
}

.category-bar__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.category-bar__label {
    font-size: 0.85rem;
    width: 100px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.category-bar__track {
    flex: 1;
    height: 8px;
    background: var(--bg-hover);
    border-radius: 99px;
    overflow: hidden;
}

.category-bar__fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-bar__amount {
    font-size: 0.82rem;
    font-weight: 600;
    width: 80px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    overflow-y: auto;
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-sm {
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -20px -16px 20px;
    position: sticky;
    top: -20px;
    background: var(--bg-secondary);
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    z-index: 2;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    flex: 1;
    text-align: center;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all var(--transition);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-save-btn {
    padding: 8px 18px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--accent);
    color: white;
    transition: all var(--transition);
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

.modal-save-btn:hover {
    background: var(--accent-hover);
}

.modal-body-text {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.65;
}

/* --- Form: Type Toggle --- */
.form-type-toggle {
    display: flex;
    gap: 0;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
}

.form-type-toggle--sm {
    margin-bottom: 0;
}

.type-pill {
    flex: 1;
    padding: 11px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.type-pill.active[data-type="uscita"] {
    background: var(--expense);
    color: white;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

.type-pill.active[data-type="entrata"] {
    background: var(--income);
    color: white;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

.type-pill--status.active[data-status="confermata"] {
    background: var(--income);
    color: white;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

.type-pill--status.active[data-status="prevista"] {
    background: var(--warning);
    color: white;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
}

/* --- Form: Hero Amount --- */
.form-amount-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0 24px;
}

.form-amount-hero__currency {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-muted);
}

.form-amount-hero input {
    background: none;
    border: none;
    outline: none;
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-primary);
    width: 180px;
    text-align: left;
    letter-spacing: -0.03em;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.form-amount-hero input::placeholder {
    color: var(--bg-hover);
}

.form-amount-hero input::-webkit-outer-spin-button,
.form-amount-hero input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* --- Form: Card sections --- */
.form-card {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 4px 0;
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    gap: 12px;
}

.form-row--last {
    border-bottom: none;
}

.form-row label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
    min-width: 80px;
}

.form-row input,
.form-row select {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    outline: none;
    font-family: inherit;
}

.form-row input::placeholder {
    color: var(--text-muted);
}

.form-row select {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    direction: rtl;
}

.form-row--split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.form-row__half {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    gap: 8px;
}

.form-row__half:first-child {
    border-right: 1px solid rgba(226, 232, 240, 0.6);
}

.form-row__half label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
}

.form-row__half select {
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    direction: rtl;
}

.form-row__with-add {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.form-row__with-add select {
    flex: 1;
    min-width: 0;
}

.form-add-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

.form-add-btn:hover {
    background: var(--accent);
    color: white;
}

.form-row--inline-add {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    align-items: center;
}

.form-row--inline-add input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 10px;
    background: var(--bg-secondary);
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-row--inline-add input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.form-inline-save {
    padding: 7px 14px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    transition: background var(--transition);
}

.form-inline-save:hover {
    background: var(--accent-hover);
}

.form-inline-cancel {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color var(--transition);
}

.form-inline-cancel:hover {
    color: var(--expense);
}

/* --- Form: Switch row --- */
.form-row--switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* --- Form: Rate list (multi-pay) --- */
.rate-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rata-row {
    display: grid;
    grid-template-columns: 28px 1fr 32px;
    grid-template-rows: auto auto;
    gap: 8px 10px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.rata-row__num {
    grid-row: 1 / 3;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-light);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.rata-row .rata-date {
    grid-column: 2;
    grid-row: 1;
}

.rata-row .rata-amount {
    grid-column: 2;
    grid-row: 2;
}

.rata-row__remove {
    grid-row: 1 / 3;
    grid-column: 3;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: all var(--transition);
    align-self: center;
}

.rata-row__remove:hover {
    background: var(--expense-light);
    color: var(--expense);
}

.rata-row input[type="date"],
.rata-row input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 10px;
    background: var(--bg-secondary);
    font-size: 0.88rem;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.rata-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.rate-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    transition: background var(--transition);
}

.rate-add-btn:hover {
    background: var(--accent-light);
}

.rate-total {
    padding: 14px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
}

.rate-total strong {
    font-weight: 800;
    color: var(--accent);
}

/* --- Buttons --- */
.btn {
    flex: 1;
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
    background: var(--expense);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 13px 26px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 400;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.35;
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.empty-state .btn {
    display: inline-flex;
    flex: none;
}

/* --- Search Bar --- */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.search-bar svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* --- Section heading --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    transition: opacity var(--transition);
}

.section-link:hover {
    opacity: 0.8;
}

/* --- Responsive --- */
@media (min-width: 600px) {
    .balance-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

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

@media (min-width: 900px) {
    .menu-btn { display: none; }

    .sidebar {
        transform: translateX(0);
        top: var(--header-height);
        height: calc(100dvh - var(--header-height));
    }

    .sidebar-overlay { display: none; }

    .main-content {
        margin-left: var(--sidebar-width);
        padding: 32px 36px;
        padding-bottom: 48px;
    }

    .bottom-nav { display: none; }

    .modal {
        border-radius: var(--radius-xl);
        align-self: center;
        max-width: 480px;
        height: auto;
        max-height: 90dvh;
    }

    .toast {
        bottom: 24px;
    }

    .tx-actions {
        opacity: 0;
    }

}


@media (min-width: 1200px) {
    .balance-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.45); }

/* --- Account badge --- */
.account-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.account-badge--personale {
    background: var(--accent-light);
    color: var(--accent);
}

.account-badge--societario {
    background: rgba(244, 162, 97, 0.12);
    color: var(--warning);
}

/* --- Prevista (future/expected) --- */
.tx-item--prevista {
    border: 1.5px dashed rgba(148, 163, 184, 0.4);
    opacity: 0.85;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, rgba(99, 102, 241, 0.02) 100%);
}

.tx-item--prevista:hover {
    opacity: 1;
}

.status-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge--prevista {
    background: rgba(244, 162, 97, 0.12);
    color: var(--warning);
}

.status-badge--confermata {
    background: var(--income-light);
    color: var(--income);
}

/* --- Switch --- */
.switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.switch-label input { display: none; }

.switch-track {
    width: 46px;
    height: 27px;
    background: var(--bg-hover);
    border-radius: 99px;
    position: relative;
    flex-shrink: 0;
    transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 21px;
    height: 21px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-label input:checked + .switch-track {
    background: var(--accent);
}

.switch-label input:checked + .switch-track .switch-thumb {
    transform: translateX(19px);
}

/* --- Orphan rule fix --- */
.rata-row input[type="date"],
.rata-row input[type="text"] {
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 10px;
    background: var(--bg-secondary);
    font-size: 0.88rem;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
}


/* Balance card expected row */
.balance-card__expected {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--warning);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.balance-card__expected::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 2px dashed var(--warning);
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Bank label --- */
.tx-bank {
    font-weight: 600;
    color: var(--text-secondary);
}

/* --- Mobile touch targets --- */
@media (hover: none) {
    .tx-actions {
        opacity: 1;
    }
}
