/* ═══════════════════════════════════════════════════════════════════════════
   BUDGETAPP — Revolut-inspired dark theme
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
    --bg:            #0D0D0D;
    --surface:       #161616;
    --surface-2:     #1E1E1E;
    --border:        rgba(255,255,255,0.07);
    --border-strong: rgba(255,255,255,0.13);
    --text:          #FFFFFF;
    --text-muted:    #888888;
    --text-dim:      #3C3C3C;
    --accent-1:      #6C63FF;
    --accent-2:      #4FACFE;
    --gradient:      linear-gradient(135deg, #6C63FF 0%, #4FACFE 100%);
    --gradient-r:    linear-gradient(135deg, #4FACFE 0%, #6C63FF 100%);
    --income:        #00D67F;
    --income-bg:     rgba(0, 214, 127, 0.12);
    --expense:       #FF4757;
    --expense-bg:    rgba(255, 71, 87, 0.12);
    --warn:          #FFB946;
    --warn-bg:       rgba(255, 185, 70, 0.12);
    --radius:        20px;
    --radius-sm:     14px;
    --radius-xs:     8px;
    --nav-height:    68px;
    --safe-top:      env(safe-area-inset-top, 0px);
    --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

/* ── Keyframes ────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes orbPulse {
    0%, 100% { transform: scale(1);   opacity: 0.55; }
    50%       { transform: scale(1.15); opacity: 0.75; }
}
@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

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

html, body {
    height: 100%;
    height: 100dvh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
}

#app { height: 100%; height: 100dvh; }

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

/* ── Splash screen ────────────────────────────────────────────────────────── */
.splash-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg);
    gap: 10px;
    animation: fadeIn 0.4s ease;
}
.splash-logo  { font-size: 3rem; }
.splash-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.splash-spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-top: 12px;
}

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.app-content::-webkit-scrollbar { display: none; }

/* ── Bottom navigation ────────────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(13,13,13,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 100;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
    padding: 0;
    text-decoration: none;
}
.bottom-nav-item i {
    font-size: 1.4rem;
    line-height: 1;
    transition: transform 0.2s;
}
.bottom-nav-item.active {
    color: transparent;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.bottom-nav-item.active i {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: scale(1.1);
}
.bottom-nav-item:active i { transform: scale(0.9); }
.bottom-nav-btn { cursor: pointer; }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
    padding: calc(var(--safe-top) + 16px) 20px 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(13,13,13,0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}
.page-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.page-greeting {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.page-subtitle {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* Month nav pill */
.month-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 6px 10px;
}
.month-btn {
    background: none; border: none;
    color: var(--text-muted);
    padding: 0 2px; cursor: pointer;
    display: flex; align-items: center;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}
.month-btn:hover { color: var(--text); }
.month-btn i { font-size: 0.8rem; }
.month-label {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    min-width: 110px;
    text-align: center;
}

/* ── Page body ────────────────────────────────────────────────────────────── */
.page-body {
    padding: 16px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Dashboard hero (frosted glass) ──────────────────────────────────────── */
.dash-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    animation: fadeUp 0.5s ease both;
}

/* Decorative gradient orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    pointer-events: none;
    animation: orbPulse 6s ease-in-out infinite;
}
.glow-orb-1 {
    width: 220px; height: 220px;
    background: radial-gradient(ellipse, rgba(108,99,255,0.6), transparent 70%);
    top: -60px; right: -40px;
    animation-delay: 0s;
}
.glow-orb-2 {
    width: 180px; height: 180px;
    background: radial-gradient(ellipse, rgba(79,172,254,0.5), transparent 70%);
    bottom: -50px; left: -30px;
    animation-delay: 3s;
}

/* Frosted glass balance card */
.glass-card {
    position: relative;
    z-index: 1;
    background: rgba(22,22,22,0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 24px 20px 20px;
    overflow: hidden;
}
/* Shimmer sweep across the card */
.glass-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255,255,255,0.04) 50%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: shimmer 4s ease-in-out infinite;
    pointer-events: none;
    border-radius: inherit;
}
.balance-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.balance-amount {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 24px;
}
.balance-amount.positive { color: var(--text); }
.balance-amount.negative {
    background: linear-gradient(135deg, #FF4757, #FF8A94);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Income / expense stat pills */
.balance-row {
    display: flex;
    gap: 10px;
}
.stat-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.stat-pill-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.stat-pill-icon.income  { background: var(--income-bg);  color: var(--income); }
.stat-pill-icon.expense { background: var(--expense-bg); color: var(--expense); }
.stat-pill-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    line-height: 1;
    margin-bottom: 3px;
}
.stat-pill-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ── Dark section cards ───────────────────────────────────────────────────── */
.dark-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    animation: fadeUp 0.5s ease both;
}
.dark-card:nth-child(2)  { animation-delay: 0.05s; }
.dark-card:nth-child(3)  { animation-delay: 0.10s; }
.dark-card:nth-child(4)  { animation-delay: 0.15s; }
.dark-card:nth-child(5)  { animation-delay: 0.20s; }

.dark-card.warn-card {
    border-color: rgba(255,185,70,0.25);
    background: linear-gradient(135deg, rgba(255,185,70,0.05), var(--surface));
}
.dark-card.danger-card {
    border-color: rgba(255,71,87,0.25);
    background: linear-gradient(135deg, rgba(255,71,87,0.05), var(--surface));
}

/* Section header inside card */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.section-link {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.01em;
}

/* ── Budget rows ──────────────────────────────────────────────────────────── */
.budget-row { margin-bottom: 14px; }
.budget-row:last-child { margin-bottom: 0; }
.budget-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}
.budget-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}
.budget-amounts {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.budget-amounts.over { color: var(--expense); }

.progress-track {
    height: 5px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.progress-fill.over-budget {
    background: linear-gradient(90deg, var(--expense), #FF8A94);
}

/* ── Bill rows ────────────────────────────────────────────────────────────── */
.bill-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.bill-row:last-child { border-bottom: none; }

.bill-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--surface-2);
    color: var(--text-muted);
}
.bill-info { flex: 1; min-width: 0; }
.bill-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bill-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 500;
}
.bill-amount {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}
.bill-amount.overdue { color: var(--expense); }
.bill-meta.warn { color: var(--warn); }

/* ── Spending rows ────────────────────────────────────────────────────────── */
.spending-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.spending-row:last-child { border-bottom: none; }
.spending-left  { display: flex; align-items: center; gap: 10px; }
.spending-name  { font-size: 0.87rem; font-weight: 600; color: var(--text); }
.spending-right { display: flex; align-items: center; gap: 10px; }
.spending-amount { font-size: 0.87rem; font-weight: 700; color: var(--text); }
.spending-pct {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

.category-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Status tags ────────────────────────────────────────────────────────���─── */
.income-text  { color: var(--income); }
.expense-text { color: var(--expense); }
.warn-text    { color: var(--warn); }

/* ── Empty / loading states ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 56px 20px;
    animation: fadeIn 0.4s ease;
}
.empty-icon  { display: flex; justify-content: center; margin-bottom: 14px; }
.empty-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.empty-body  { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

.loading-state {
    display: flex; justify-content: center; padding: 64px 0;
}
/* Override Bootstrap spinner color */
.spinner-border { border-color: var(--border-strong); border-right-color: var(--accent-1); }

/* ── Profile page ─────────────────────────────────────────────────────────── */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 24px;
    animation: fadeUp 0.4s ease;
}
.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--border-strong);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    position: relative;
}
.profile-avatar::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--gradient);
    z-index: -1;
    opacity: 0.5;
}
.profile-name {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 4px;
}
.profile-email {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.profile-row:last-child { border-bottom: none; }
.profile-row-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-xs);
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    color: var(--accent-1);
    flex-shrink: 0;
}
.profile-row-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.profile-row-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 40px);
    margin: 8px 20px 24px;
    padding: 14px;
    background: rgba(255,71,87,0.1);
    border: 1px solid rgba(255,71,87,0.2);
    border-radius: var(--radius-sm);
    color: var(--expense);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.logout-btn:hover  { background: rgba(255,71,87,0.16); }
.logout-btn:active { transform: scale(0.98); }

/* ── Alert / error inline ─────────────────────────────────────────────────── */
.inline-error {
    background: var(--expense-bg);
    border: 1px solid rgba(255,71,87,0.25);
    color: var(--expense);
    border-radius: var(--radius-xs);
    padding: 10px 14px;
    font-size: 0.83rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeUp 0.3s ease;
}

/* ── Auth shell ───────────────────────────────────────────────────────────── */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
}
/* Decorative background orbs on auth pages */
.auth-shell::before,
.auth-shell::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    animation: orbPulse 8s ease-in-out infinite;
}
.auth-shell::before {
    width: 350px; height: 350px;
    background: radial-gradient(ellipse, rgba(108,99,255,0.25), transparent 70%);
    top: -80px; right: -80px;
}
.auth-shell::after {
    width: 280px; height: 280px;
    background: radial-gradient(ellipse, rgba(79,172,254,0.2), transparent 70%);
    bottom: -60px; left: -60px;
    animation-delay: 4s;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 32px 24px 28px;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    animation: fadeUp 0.5s ease;
}

.auth-header  { text-align: center; margin-bottom: 32px; }
.auth-logo    { font-size: 2.8rem; line-height: 1; margin-bottom: 10px; }
.auth-title   {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    margin: 0;
}
.auth-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.auth-footer a {
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; width: 100%; overflow: hidden; }
.form-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}
.form-control, .form-control:focus {
    width: 100% !important;
    min-width: 0;
    display: block;
    box-sizing: border-box;
    background: var(--surface-2) !important;
    border: 1.5px solid var(--border-strong) !important;
    border-radius: var(--radius-xs) !important;
    color: var(--text) !important;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 13px 14px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="date"].form-control,
input[type="date"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    -webkit-appearance: none;
    appearance: none;
}
.form-control::placeholder { color: var(--text-dim) !important; }
.form-control:focus {
    border-color: var(--accent-1) !important;
    box-shadow: 0 0 0 3px rgba(108,99,255,0.15) !important;
    outline: none;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-xs);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Utility spacing (Bootstrap compat) */
.me-1 { margin-right: 4px !important; }
.me-2 { margin-right: 8px !important; }
.ms-1 { margin-left: 4px !important; }
.ms-2 { margin-left: 8px !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }

/* spinner-border (Bootstrap compat) */
.spinner-border {
    display: inline-block;
    width: 2rem; height: 2rem;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
.spinner-border-sm { width: 1rem; height: 1rem; border-width: 0.2em; }

.btn-primary, .btn-primary:hover, .btn-primary:focus {
    background: var(--gradient) !important;
    border: none !important;
    color: white !important;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    border-radius: var(--radius-xs) !important;
    box-shadow: 0 4px 20px rgba(108,99,255,0.35) !important;
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: -0.01em;
}
.btn-primary:active { transform: scale(0.98) !important; }
.btn-full { width: 100%; padding: 14px !important; font-size: 0.95rem !important; margin-top: 8px; }
.btn-text {
    background: none; border: none; padding: 0;
    font-weight: 600; font-size: inherit;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
}

/* ── Validation ───────────────────────────────────────────────────────────── */
.validation-message { color: var(--expense); font-size: 0.76rem; margin-top: 4px; font-weight: 500; }
.valid.modified:not([type=checkbox]) { border-color: var(--income) !important; }
.invalid { border-color: var(--expense) !important; }

/* ── Shared / Personal toggle pill ───────────────────────────────────────── */
.toggle-pill-wrap {
    padding: 12px 20px 4px;
}
.toggle-pill {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 3px;
}
.toggle-pill-btn {
    padding: 6px 18px;
    border-radius: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
}
.toggle-pill-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ── Transaction list ─────────────────────────────────────────────────────── */
.tx-group { padding: 0 16px; margin-bottom: 4px; }
.tx-group-date {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 14px 4px 8px;
}
.tx-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }
.tx-icon {
    width: 42px; height: 42px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.tx-info {
    flex: 1;
    min-width: 0;
}
.tx-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}
.tx-dot { color: var(--text-dim); }
.tx-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.tx-amount {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.tx-amount.income  { color: var(--income); }
.tx-amount.expense { color: var(--text); }
.tx-delete-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px 0;
    font-size: 0.75rem;
    line-height: 1;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.tx-delete-btn:hover { color: var(--expense); }

/* ── Floating action button ───────────────────────────────────────────────── */
.fab {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    right: max(16px, calc(50vw - 240px + 16px));
    width: 56px; height: 56px;
    border-radius: 18px;
    background: var(--gradient);
    border: none;
    color: white;
    font-size: 1.4rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 24px rgba(108,99,255,0.45);
    cursor: pointer;
    z-index: 50;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.fab:hover  { transform: scale(1.06); box-shadow: 0 8px 28px rgba(108,99,255,0.55); }
.fab:active { transform: scale(0.95); }

/* ── Bottom sheet ─────────────────────────────────────────────────────────── */
.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    animation: fadeIn 0.2s ease;
}
.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.sheet {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    border-top: 1px solid var(--border-strong);
    padding: 12px 0 0;
    z-index: 1;
    height: 75vh;
    height: 75dvh;
    max-height: 75vh;
    max-height: 75dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sheetSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
@keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.sheet-body {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    flex: 1;
    min-height: 0;
    padding: 0 20px calc(var(--nav-height) + var(--safe-bottom) + 24px);
    scrollbar-width: none;
}
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-handle {
    width: 36px; height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 0 auto 20px;
}
.sheet-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 20px;
}

/* Income / Expense type toggle */
.type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.type-btn {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    -webkit-tap-highlight-color: transparent;
}
.type-btn.active.expense-active {
    background: rgba(255,71,87,0.12);
    border-color: var(--expense);
    color: var(--expense);
}
.type-btn.active.income-active {
    background: rgba(0,214,127,0.12);
    border-color: var(--income);
    color: var(--income);
}

/* Large amount input */
.amount-field-wrap {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}
.amount-field-wrap:focus-within { border-color: var(--accent-1); }
.amount-currency {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
    margin-right: 4px;
    padding-top: 2px;
}
.amount-field {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.04em;
    padding: 14px 0;
    width: 100%;
}
.amount-field::placeholder { color: var(--text-dim); }
/* Hide number spinners */
.amount-field::-webkit-inner-spin-button,
.amount-field::-webkit-outer-spin-button { -webkit-appearance: none; }
.amount-field[type=number] { -moz-appearance: textfield; }

/* ── Budgets page ─────────────────────────────────────────────────────────── */
.budget-summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 12px 16px 4px;
    padding: 18px 16px 14px;
    animation: fadeUp 0.4s ease;
}
.budget-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.budget-summary-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.budget-summary-spent {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.budget-summary-of {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.budget-summary-pct {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    padding-top: 18px;
}
.budget-summary-track {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.budget-summary-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.budgets-list { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.budget-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    animation: fadeUp 0.4s ease both;
}
.budgets-list .budget-card:nth-child(2) { animation-delay: 0.05s; }
.budgets-list .budget-card:nth-child(3) { animation-delay: 0.10s; }
.budgets-list .budget-card:nth-child(4) { animation-delay: 0.15s; }
.budgets-list .budget-card:nth-child(5) { animation-delay: 0.20s; }
.budgets-list .budget-card:nth-child(6) { animation-delay: 0.25s; }

.budget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.budget-card-left { display: flex; align-items: center; gap: 8px; }
.budget-cat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.budget-cat-name { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.budget-shared-badge { font-size: 0.7rem; color: var(--text-muted); margin-left: 2px; }
.budget-delete-btn {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; padding: 2px 4px; font-size: 0.78rem;
    transition: color 0.15s; -webkit-tap-highlight-color: transparent;
}
.budget-delete-btn:hover { color: var(--expense); }

.budget-card-amounts { margin-bottom: 8px; }
.budget-spent { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.03em; }
.budget-limit { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }

.budget-progress-track {
    height: 5px; background: var(--surface-2);
    border-radius: 3px; overflow: hidden; margin-bottom: 8px;
}
.budget-progress-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.budget-progress-fill.over { animation: pulse-red 1.5s ease-in-out infinite; }
@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

.budget-card-footer { display: flex; justify-content: space-between; align-items: center; }
.budget-remaining { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.budget-remaining.over-text { color: var(--expense); }
.budget-pct-label { font-size: 0.75rem; font-weight: 700; }

/* ── Bills page ───────────────────────────────────────────────────────────── */
.bills-summary {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 12px 16px 4px;
    padding: 16px 0;
    animation: fadeUp 0.4s ease;
}
.bills-stat { flex: 1; text-align: center; }
.bills-stat-value {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}
.bills-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 3px;
}
.bills-stat-divider { width: 1px; height: 32px; background: var(--border); }

.bills-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 14px 20px 6px;
}
.bills-section-label.danger-label { color: var(--expense); }
.bills-section-label.muted-label  { color: var(--text-dim); }

.bill-entry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    animation: fadeUp 0.35s ease both;
    gap: 12px;
}
.bill-entry-row:last-of-type { border-bottom: none; }
.bill-entry-row.cleared-row  { opacity: 0.55; }

.bill-entry-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.bill-entry-icon {
    width: 42px; height: 42px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.bill-entry-info { min-width: 0; }
.bill-entry-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bill-entry-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}
.bill-entry-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}
.bill-entry-amount {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Status pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 20px;
    border: none;
    font-family: 'Inter', sans-serif;
    cursor: default;
    white-space: nowrap;
}
button.status-pill {
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}
button.status-pill:active { transform: scale(0.95); }
.pill-pending { background: rgba(255,255,255,0.07); color: var(--text-muted); }
button.pill-pending:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.pill-cleared { background: var(--income-bg); color: var(--income); }
.pill-overdue { background: var(--expense-bg); color: var(--expense); }
button.pill-overdue:hover { opacity: 0.8; }
.pill-skipped { background: rgba(255,255,255,0.05); color: var(--text-dim); }

/* ── Profile page ─────────────────────────────────────────────────────────── */

/* Hero */
.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: calc(var(--safe-top) + 28px) 20px 24px;
    background: linear-gradient(180deg, rgba(108,99,255,0.12) 0%, transparent 100%);
}
.profile-avatar-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 3px;
    background: var(--gradient);
    margin-bottom: 14px;
}
.profile-avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.03em;
}
.profile-hero-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.profile-hero-email {
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* Section label */
.profile-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 20px;
    margin: 20px 0 8px;
}

/* Card */
.profile-card {
    margin: 0 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.profile-divider {
    height: 1px;
    background: var(--border);
    margin: 0 16px;
}

/* Card row */
.profile-card-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}
.profile-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.profile-row-body {
    flex: 1;
    min-width: 0;
}
.profile-row-label {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text);
}
.profile-row-value {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Members */
.profile-members-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 16px 6px;
}
.profile-member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
}
.profile-member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.profile-member-info { flex: 1; min-width: 0; }
.profile-member-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-member-email {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.profile-you-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgba(108,99,255,0.18);
    color: var(--accent-1);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.profile-member-role {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.role-owner { background: rgba(108,99,255,0.15); color: var(--accent-1); }
.role-member { background: rgba(255,255,255,0.07); color: var(--text-muted); }

/* Action button (non-destructive) */
.profile-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    color: var(--accent-1);
    font-size: 0.92rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.profile-action-btn:hover { background: rgba(108,99,255,0.07); }
.profile-action-btn:active { background: rgba(108,99,255,0.12); }
.profile-chevron { margin-left: auto; font-size: 0.8rem; opacity: 0.6; }
.profile-coming-soon {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(255,255,255,0.07);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Bank accounts empty */
.profile-bank-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.profile-bank-empty i { font-size: 1.3rem; opacity: 0.4; }

/* Danger zone */
.danger-card-profile {
    margin: 0 16px;
    background: var(--surface);
    border: 1px solid rgba(255,71,87,0.2);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.profile-danger-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 15px 16px;
    background: none;
    border: none;
    color: var(--expense);
    font-size: 0.92rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.profile-danger-btn:hover  { background: rgba(255,71,87,0.07); }
.profile-danger-btn:active { background: rgba(255,71,87,0.13); }

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-thumb {
    position: absolute;
    inset: 0;
    background: var(--surface-2);
    border-radius: 14px;
    border: 1.5px solid var(--border-strong);
    transition: background 0.2s;
    cursor: pointer;
}
.toggle-thumb::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-thumb { background: var(--accent-1); border-color: var(--accent-1); }
.toggle-switch input:checked + .toggle-thumb::before { transform: translateX(20px) translateY(-50%); }
.toggle-switch.disabled { opacity: 0.4; pointer-events: none; }

/* Invite sheet extras */
.invite-success-icon {
    text-align: center;
    font-size: 2.5rem;
    color: var(--income);
    margin: 12px 0 8px;
}
.invite-success-note {
    font-size: 0.84rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.5;
}
.invite-link-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 12px 14px;
    margin-bottom: 14px;
    word-break: break-all;
}
.invite-link-text {
    font-size: 0.8rem;
    color: var(--accent-2);
    font-family: monospace;
    line-height: 1.4;
}

/* ── Blazor error UI ──────────────────────────────────────────────────────── */
#blazor-error-ui {
    background: var(--expense-bg);
    color: var(--expense);
    bottom: 0; left: 0; right: 0;
    padding: 12px 20px;
    position: fixed;
    display: none;
    z-index: 9999;
    font-size: 0.84rem;
    font-weight: 500;
    border-top: 1px solid rgba(255,71,87,0.25);
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
#blazor-error-ui .reload  { font-weight: 700; color: var(--expense); margin-left: 8px; }

/* ── Desktop centering ────────────────────────────────────────────────────── */
@media (min-width: 500px) {
    .app-shell { box-shadow: 0 0 0 1px var(--border); }
    .bottom-nav { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
