:root {
    --primary: #FFD700;
    --primary-gradient: linear-gradient(135deg, #FFD700 0%, #F59E0B 100%);
    --primary-glow: rgba(255, 215, 0, 0.3);

    --secondary: #10B981;
    --secondary-gradient: linear-gradient(135deg, #10B981 0%, #059669 100%);

    --bg-dark: #0F172A;
    --bg-card: rgba(30, 41, 59, 0.65);
    --bg-card-highlight: rgba(51, 65, 85, 0.8);

    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;

    --border: rgba(148, 163, 184, 0.1);
    --border-highlight: rgba(148, 163, 184, 0.2);

    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);

    --danger: #EF4444;
    --danger-gradient: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);

    /* Compatibility Aliases */
    --gold: var(--primary);
    --gold-dark: #B45309;
    --red: var(--danger);
    --red-dark: #7F1D1D;
    --red-light: #FCA5A5;
    --white: var(--text-primary);
    --black: var(--bg-dark);
    --dark-gray: #1E293B;
    --medium-gray: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(255, 215, 0, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

#root {
    min-height: 100vh;
    padding-bottom: 90px;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 3px;
}

/* =============================================
UNIFIED TOP BAR
============================================= */

/* True-black safe-area bleed for Dynamic Island */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background: #000000;
    z-index: 200;
    pointer-events: none;
}

.top-bar-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 30, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    /* Breathing room below Dynamic Island */
    padding-top: calc(env(safe-area-inset-top) + 10px);
}

/* Dynamic Island devices — gradient fade from black */
@media (min-height: 852px) and (max-width: 430px) {
    .top-bar-wrapper {
        background: linear-gradient(to bottom,
                #000000 0%,
                rgba(10, 14, 30, 0.95) 100%);
    }
}

/* Row 1: logo left + page title right */
.top-bar-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 10px;
}

.top-bar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-logo-text {
    font-size: 15px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.2px;
}

/* Stat chips inline with logo */
.top-bar-chips {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 100px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.stat-chip-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.8;
}

/* ── UI-001: Hamburger Menu for Mobile ───────────────────── */
.hamburger-btn {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1;
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background: linear-gradient(180deg, #0B1021 0%, #151B2E 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 160;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding-top: calc(env(safe-area-inset-top) + 20px);
}

.mobile-menu.open {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-menu-title {
    font-size: 16px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-menu-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
}

.mobile-menu-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.mobile-menu-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mobile-menu-sync {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.mobile-menu-page-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px;
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Show hamburger on mobile, hide desktop elements */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .top-bar-chips {
        display: none;
    }

    .top-bar-page-title {
        display: none;
    }
}

/* Page title on right of row 1 */
.top-bar-page-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Row 2: sub-navigation underline tabs */
.top-bar-row2 {
    display: flex;
    gap: 0;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.top-bar-row2::-webkit-scrollbar {
    display: none;
}

.sub-nav-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 14px;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    font-family: inherit;
}

.sub-nav-tab.active {
    color: var(--text-primary);
    font-weight: 700;
    border-bottom-color: var(--primary);
}

.sub-nav-tab:active {
    transform: scale(0.97);
}

/* =============================================
BOTTOM NAV — Minimalist
============================================= */

/* Section */
.section-container {
    padding: 20px 24px 0;
    animation: fadeIn 0.5s ease-out;
}

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

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.add-btn {
    background: var(--bg-card-highlight);
    color: var(--primary);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-btn:active {
    transform: scale(0.95);
}

/* Summary Cards */
.summary-grid {
    display: grid;
    gap: 20px;
}

.summary-card {
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-card:hover {
    border-color: rgba(255, 215, 0, 0.08);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.15);
}

.summary-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.summary-stat {
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 12px 8px;
}

.summary-stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.summary-stat-label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Item Cards */
.item-card {
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.1);
}

.item-card:active {
    transform: scale(0.98);
}

.item-card.gold::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-gradient);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.card-header>div:first-child {
    flex: 1;
    min-width: 0;
    margin-right: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
    /* BUG-004: truncate long names instead of breaking layout */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    /* BUG-004: also truncate subtitles */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.card-badge {
    background: rgba(255, 215, 0, 0.1);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(255, 215, 0, 0.15);
}

.card-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.detail-value {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-value.highlight {
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--secondary-gradient);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Gold Loan Owner */
.gold-owner {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.owner-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid rgba(255, 215, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.owner-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.owner-bank {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Input Fields */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #000;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 30px var(--primary-glow);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-highlight);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    margin-top: 12px;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Search */
.search-container {
    padding: 16px 24px 12px;
}

.search-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 48px;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 15px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.search-input:focus {
    outline: none;
    background: var(--bg-card-highlight);
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.clear-search {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: var(--text-primary);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.clear-search.visible {
    display: flex;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    width: 100%;
    background: #1E293B;
    border-radius: 32px 32px 0 0;
    padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
    max-height: 90vh;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: var(--text-secondary);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Bottom Nav — 5-Tab Grouped Design ─────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(8, 12, 24, 0.96);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 4px 0;
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    z-index: 90;
    height: calc(62px + env(safe-area-inset-bottom));
}

.nav-btn {
    background: none;
    border: none;
    /* Each tab uses a CSS custom property --nav-color for its accent */
    color: var(--text-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 10px;
    position: relative;
    transition: color 0.2s ease;
    min-width: 56px;
    min-height: 44px;
    justify-content: center;
    font-family: inherit;
}

.nav-btn.active {
    color: var(--nav-color, var(--primary));
}

/* Colored pill indicator above active icon */
.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--nav-color, var(--primary));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-btn.active::before {
    opacity: 1;
}

/* Glow on active icon */
.nav-btn.active .nav-icon {
    filter: drop-shadow(0 0 7px color-mix(in srgb, var(--nav-color, var(--primary)) 55%, transparent));
}

/* Notification badge (e.g. pending payments) */
.nav-btn .nav-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #EF4444;
    border: 1.5px solid rgba(8, 12, 24, 0.96);
}

.nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s ease;
}

.nav-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.7;
}

/* ── More Drawer — slide-up sheet ─────────────────────────── */
.more-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 200;
    animation: fadeIn 0.2s ease-out;
}

.more-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 201;
    background: #1a2235;
    border-radius: 24px 24px 0 0;
    padding: 0 16px calc(24px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.more-drawer-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 14px auto 20px;
}

.more-drawer-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.more-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 14px;
    padding: 13px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
    text-align: left;
}

.more-drawer-item:active {
    background: rgba(255, 255, 255, 0.07);
    transform: scale(0.98);
}

.more-drawer-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.more-drawer-item-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.more-drawer-item-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.more-drawer-item-arrow {
    margin-left: auto;
    color: var(--text-tertiary);
    font-size: 14px;
}

.more-drawer-dismiss {
    width: 100%;
    padding: 13px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
    transition: background 0.15s;
}

.more-drawer-dismiss:active {
    background: rgba(255, 255, 255, 0.09);
}

/* ── Sub-tab active color override via CSS var ─────────────── */
.sub-nav-tab.wealth-active {
    color: #10B981 !important;
    border-bottom-color: #10B981 !important;
}

.sub-nav-tab.debt-active {
    color: #EF4444 !important;
    border-bottom-color: #EF4444 !important;
}

.sub-nav-tab.budget-active {
    color: #60A5FA !important;
    border-bottom-color: #60A5FA !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.2;
    filter: grayscale(100%);
}

.empty-text {
    font-size: 16px;
    color: var(--text-tertiary);
}

/* ============================================
PWA & iOS ENHANCEMENTS
============================================ */

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        background-attachment: fixed;
    }

    #root {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* Smooth Scrolling for iOS */
* {
    -webkit-overflow-scrolling: touch;
}

/* Prevent iOS Zoom on Input Focus */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
    font-size: 16px !important;
}

/* Enhanced Touch Targets for Mobile */
@media (max-width: 768px) {

    button,
    .nav-btn,
    .sub-nav-tab,
    .add-btn {
        min-height: 44px;
    }

    .summary-card {
        margin-bottom: 16px;
    }

    .form-input {
        padding: 14px 16px;
        font-size: 16px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* iPhone Specific Optimizations */
@media (max-width: 430px) {
    .section-container {
        padding: 16px;
    }

    .top-bar-row2 {
        padding: 0 8px;
    }

    .sub-nav-tab {
        padding: 10px 12px;
        font-size: 12px;
    }

    .summary-card-title {
        font-size: 16px;
    }

    .detail-label {
        font-size: 13px;
    }

    .detail-value {
        font-size: 14px;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
        overflow-y: auto;
    }
}

/* BUG-003: prevent modal overflow on very narrow screens (< 320px) */
@media (max-width: 319px) {
    .modal-content {
        width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 20px 12px calc(20px + env(safe-area-inset-bottom));
        max-height: 92vh;
    }

    .modal-title {
        font-size: 18px;
    }

    .form-input,
    .form-select {
        padding: 12px 10px;
        font-size: 14px !important;
    }

    .btn {
        padding: 14px;
        font-size: 13px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Landscape Mode Optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .top-bar-row1 {
        padding-bottom: 6px;
    }

    .bottom-nav {
        height: calc(52px + env(safe-area-inset-bottom));
    }

    #root {
        padding-bottom: 60px;
    }
}

/* PWA Install Prompt Styling */
.pwa-install-prompt {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: var(--shadow);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 90%;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.pwa-install-btn {
    background: var(--primary-gradient);
    color: var(--bg-dark);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: white;
    text-align: center;
    padding: max(8px, env(safe-area-inset-top)) 8px 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* Enhanced Loading State */
.pwa-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    transform-origin: left;
    animation: loading 1s ease-in-out infinite;
    z-index: 10000;
}

@keyframes loading {
    0% {
        transform: scaleX(0);
    }

    50% {
        transform: scaleX(0.5);
    }

    100% {
        transform: scaleX(1);
    }
}

/* Pull to Refresh Indicator */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.3s ease;
    z-index: 1000;
}

.pull-to-refresh.active {
    top: 20px;
}

/* Haptic Feedback Simulation */
@media (hover: none) and (pointer: coarse) {

    button:active,
    .nav-btn:active,
    .sub-nav-tab:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* Dark Mode Enhancements for OLED */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #000000;
    }

    .summary-card {
        background: rgba(20, 20, 20, 0.8);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =============================================
BUDGET SECTION
============================================= */

.budget-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 16px 0;
}

.budget-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.budget-group {
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

/* Group header bar */
.budget-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.budget-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.budget-group-total {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.budget-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.2);
    color: var(--primary);
    border-radius: 100px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.budget-add-btn:active {
    transform: scale(0.95);
    background: rgba(255, 215, 0, 0.14);
}

/* Individual budget row */
.budget-row {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s ease;
}

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

.budget-row.disabled {
    opacity: 0.45;
}

/* Row top line: toggle + category name + amount + delete */
.budget-row-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Custom toggle checkbox */
.budget-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.budget-toggle:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.budget-toggle:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 8px;
    height: 5px;
    border-left: 2px solid #000;
    border-bottom: 2px solid #000;
    transform: rotate(-45deg);
}

.budget-category-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
    min-width: 0;
    /* allow flex shrink */
}

.budget-category-input:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.budget-amount-input {
    width: 108px;
    min-width: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    text-align: right;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.budget-amount-input:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

/* Row bottom: description field */
.budget-desc-input {
    width: 100%;
    background: transparent;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding: 8px 30px 2px 30px;
    /* indent to align under category */
    color: var(--text-tertiary);
    font-size: 12px;
    font-family: inherit;
    margin-top: 8px;
    transition: color 0.2s ease;
}

.budget-desc-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.budget-desc-input:focus {
    outline: none;
    color: var(--text-secondary);
}

.budget-delete-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 8px;
    color: rgba(239, 68, 68, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    transition: color 0.2s ease, background 0.2s ease;
}

.budget-delete-btn:active {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Group footer: total row */
.budget-group-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.budget-group-footer-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
}

.budget-group-footer-value {
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}

/* Grand total card */
.budget-grand-total {
    background: rgba(255, 215, 0, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.budget-grand-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.budget-grand-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

/* =============================================
NG-1: SMART BUDGET TRACKER STYLES
============================================= */

/* Cycle utilisation summary banner */
.cycle-utilisation-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cycle-util-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.cycle-util-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.cycle-util-values {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.cycle-util-spent {
    font-weight: 700;
    font-size: 14px;
}

.cycle-util-pct {
    font-weight: 800;
    font-size: 15px;
}

/* Per-row utilisation bar (inside budget-row) */
.budget-utilisation-wrap {
    padding: 6px 0 4px 30px;
}

.budget-util-bar-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.budget-util-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.budget-util-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.budget-util-spent-text {
    font-size: 11px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.budget-util-pct-text {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Log Spend toggle button (inside row) */
.spend-log-toggle-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 8px 3px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.15s ease;
}

.spend-log-toggle-btn:active {
    opacity: 0.6;
}

/* Inline spend-log panel (slides open under each row) */
.spend-log-panel {
    margin: 4px 0 6px 30px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.spend-entry-form {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

.spend-amt-input {
    flex: 0 0 96px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.spend-amt-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
}

.spend-note-input {
    flex: 1;
    min-width: 80px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
}

.spend-note-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
}

.spend-note-input::placeholder,
.spend-amt-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.spend-submit-btn {
    padding: 8px 14px;
    background: var(--secondary-gradient);
    border: none;
    border-radius: 10px;
    color: #000;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.spend-submit-btn:active {
    opacity: 0.8;
    transform: scale(0.97);
}

/* Spend history log inside panel */
.spend-history-list {
    padding: 4px 0;
    max-height: 160px;
    overflow-y: auto;
}

.spend-history-row {
    display: grid;
    grid-template-columns: 78px 1fr auto;
    gap: 8px;
    padding: 7px 12px;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    align-items: center;
}

.spend-history-row:last-child {
    border-bottom: none;
}

.spend-hist-date {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.spend-hist-note {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spend-hist-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.spend-history-empty {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Cycle Close / New Cycle banner */
.cycle-close-banner {
    background: rgba(255, 215, 0, 0.07);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: fadeIn 0.3s ease-out;
}

.cycle-close-text {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

.cycle-close-text strong {
    color: var(--primary);
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
}

.cycle-close-btn {
    background: var(--primary-gradient);
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    color: #000;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.cycle-close-btn:active {
    transform: scale(0.96);
}

/* Budget Overview tab: per-group utilisation cards */
.budget-overview-util-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 8px;
}

.budget-overview-util-row:last-child {
    border-bottom: none;
}

.bou-label {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

.bou-bar-wrap {
    flex: 2;
}

.bou-pct {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: right;
}

/* NG-1: Floating Action Button — Log Spend */
.fab-log-spend {
    position: fixed;
    right: 20px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    color: #000;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 85;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-log-spend:active {
    transform: scale(0.92);
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.2);
}

/* UI-002: FAB hidden state for scroll auto-hide */
.fab-log-spend.fab-hidden {
    transform: translateY(100px) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

/* FAB quick-log sheet */
.fab-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.2s ease-out;
}

.fab-sheet {
    width: 100%;
    background: #1a2332;
    border-radius: 28px 28px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.fab-sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.fab-sheet-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.fab-budget-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.fab-budget-btn {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.fab-budget-btn.selected {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.35);
    color: var(--primary);
}

.fab-category-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    max-height: 160px;
    overflow-y: auto;
}

.fab-category-btn {
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fab-category-btn.selected {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.25);
    color: var(--text-primary);
}

.fab-category-remaining {
    font-size: 11px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.fab-amount-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.fab-amt-input {
    flex: 1;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.fab-amt-input:focus {
    outline: none;
    border-color: var(--primary);
}

.fab-note-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 14px;
}

.fab-note-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
}

.fab-note-input::placeholder,
.fab-amt-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.fab-confirm-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 16px;
    color: #000;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.3px;
}

.fab-confirm-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.fab-confirm-btn:not(:disabled):active {
    transform: scale(0.98);
}

/* =============================================
GOOGLE SYNC STYLES (continued below)
============================================= */

/* Login Screen */
.auth-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    background-image:
        radial-gradient(at 20% 20%, rgba(255, 215, 0, 0.08) 0px, transparent 50%),
        radial-gradient(at 80% 80%, rgba(16, 185, 129, 0.06) 0px, transparent 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 40px 24px;
}

.auth-logo {
    font-size: 52px;
    margin-bottom: 8px;
}

.auth-app-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.auth-tagline {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 48px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: 24px;
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.auth-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: #ffffff;
    color: #1f2937;
    border: none;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.google-signin-btn:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.google-signin-btn:active {
    transform: translateY(0);
}

.google-signin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-note {
    margin-top: 20px;
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.6;
}

.auth-error {
    margin-top: 16px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 12px;
    text-align: left;
}

/* Restoring session splash */
.auth-restoring {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 16px;
}

.auth-restoring-logo {
    font-size: 48px;
}

.auth-restoring-name {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

.auth-restoring-dots {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.auth-restoring-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: restoring-bounce 1.2s infinite ease-in-out;
}

.auth-restoring-dots span:nth-child(1) {
    animation-delay: 0s;
}

.auth-restoring-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.auth-restoring-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes restoring-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1.0);
        opacity: 1;
    }
}

.auth-restoring-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Sync Status Bar (in TopBar) */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    transition: background 0.2s;
    white-space: nowrap;
}

.sync-indicator:hover {
    background: rgba(255, 255, 255, 0.06);
}

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

.sync-dot.synced {
    background: #10B981;
}

.sync-dot.syncing {
    background: #F59E0B;
    animation: pulse-dot 1s infinite;
}

.sync-dot.error {
    background: #EF4444;
}

.sync-dot.offline {
    background: #64748B;
}

/* SYNC-FIX: Stuck sync indicator styling */
.sync-indicator.sync-stuck {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulse-red 1.5s infinite;
    cursor: pointer;
}

.sync-indicator.sync-stuck:hover {
    background: rgba(239, 68, 68, 0.25);
}

@keyframes pulse-red {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
    }
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.sync-label {
    color: var(--text-secondary);
}

/* Google Sync card in Settings */
.sync-settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
}

.sync-settings-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.sync-settings-icon {
    width: 36px;
    height: 36px;
    background: rgba(66, 133, 244, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sync-settings-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.sync-settings-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.sync-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    margin-bottom: 12px;
}

.sync-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
    overflow: hidden;
}

.sync-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sync-user-info {
    flex: 1;
    min-width: 0;
}

.sync-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-user-email {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-last-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.sync-btn-row {
    display: flex;
    gap: 8px;
}

.btn-sync {
    flex: 1;
    padding: 10px;
    background: rgba(66, 133, 244, 0.15);
    border: 1px solid rgba(66, 133, 244, 0.3);
    border-radius: 12px;
    color: #93c5fd;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sync:hover {
    background: rgba(66, 133, 244, 0.25);
}

.btn-sync:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-signout {
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    color: #fca5a5;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-signout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* FI Share Button */
.btn-fi-share {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(99, 102, 241, 0.12) 100%);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 14px;
    color: #c4b5fd;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.btn-fi-share:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(99, 102, 241, 0.2) 100%);
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.2);
}

.btn-fi-share:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Drive Backup */
.btn-drive-backup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 14px;
    color: #6ee7b7;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.btn-drive-backup:hover {
    background: rgba(16, 185, 129, 0.2);
}

.btn-drive-backup:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.backup-history-list {
    margin-top: 12px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.backup-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.backup-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    gap: 8px;
}

.backup-history-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.backup-file-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.backup-file-info {
    flex: 1;
    min-width: 0;
}

.backup-file-name {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.backup-file-date {
    color: var(--text-tertiary);
    font-size: 11px;
    margin-top: 2px;
}

.backup-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* ── NG-2: Loan Payment Journal ──────────────────────────────── */
.loan-payment-row {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mark-paid-btn {
    padding: 10px 16px;
    background: var(--secondary-gradient);
    border: none;
    border-radius: 12px;
    color: #000;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all 0.2s;
    font-family: inherit;
    width: 100%;
    text-align: center;
}

.mark-paid-btn:active {
    transform: scale(0.96);
}

.payment-done-badge {
    font-size: 12px;
    color: var(--secondary);
    font-weight: 600;
    padding: 4px 0;
}

.payment-warning-badge {
    font-size: 12px;
    color: #F59E0B;
    font-weight: 600;
    padding: 4px 0;
}

.loan-history-toggle {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 11px;
    cursor: pointer;
    padding: 8px 0 4px;
    font-family: inherit;
    text-align: left;
    width: 100%;
    transition: color 0.2s;
}

.loan-history-toggle:hover {
    color: var(--text-secondary);
}

.loan-history-panel {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 8px 12px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.loan-history-row {
    display: grid;
    grid-template-columns: 60px 82px 1fr 52px;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
}

.loan-history-row:last-child {
    border-bottom: none;
}

.lh-period {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.lh-date {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.lh-amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.lh-type {
    font-size: 10px;
    font-weight: 700;
    text-align: right;
    letter-spacing: 0.3px;
}

.lh-type.lh-full {
    color: var(--secondary);
}

.lh-type.lh-partial {
    color: #F59E0B;
}

.lh-type.lh-over {
    color: var(--primary);
}

.lh-type.lh-interest {
    color: var(--text-secondary);
}

/* =============================================
BUDGET CYCLE RESET — NEW STYLES
============================================= */

/* Cycle period pill shown in TopBar / section header */
.cycle-period-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.18);
    border-radius: 100px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

/* Upgraded cycle-close banner with Drive export status */
.cycle-reset-banner {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.10) 0%, rgba(245, 158, 11, 0.07) 100%);
    border: 1px solid rgba(255, 215, 0, 0.28);
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-out;
}

.cycle-reset-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cycle-reset-banner-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
}

.cycle-reset-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cycle-reset-confirm-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: #000;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cycle-reset-confirm-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cycle-reset-confirm-btn:not(:disabled):active {
    transform: scale(0.97);
}

.cycle-reset-dismiss-btn {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.cycle-reset-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Budget History tab */
.budget-history-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-tertiary);
    font-size: 14px;
}

.budget-history-card {
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}

.budget-history-card:hover {
    border-color: rgba(255, 215, 0, 0.08);
}

.budget-history-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.budget-history-card-header:active {
    background: rgba(255, 255, 255, 0.02);
}

.budget-history-period {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.budget-history-dates {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.budget-history-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.budget-history-score-pill {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
}

.drive-export-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 100px;
    padding: 3px 8px;
    white-space: nowrap;
}

.drive-export-badge.failed {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.budget-history-body {
    padding: 0 18px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.budget-history-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    margin: 14px 0 8px;
}

.budget-history-item-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px 44px;
    gap: 6px;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 12px;
}

.budget-history-item-row:last-child {
    border-bottom: none;
}

.bhi-category {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bhi-budget {
    color: var(--text-tertiary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bhi-spent {
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bhi-pct {
    font-size: 11px;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bhi-bar-row {
    grid-column: 1 / -1;
    padding: 2px 0 4px;
}

.budget-history-totals {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
}

.bht-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.bht-values {
    display: flex;
    gap: 14px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* Confirm modal overlay for cycle reset */
.cycle-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease-out;
}

.cycle-confirm-modal {
    background: #1E293B;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 28px 24px;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cycle-confirm-icon {
    font-size: 40px;
    text-align: center;
    margin-bottom: 12px;
}

.cycle-confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.cycle-confirm-body {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

.cycle-confirm-checklist {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cycle-confirm-check-item {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cycle-confirm-check-item span:first-child {
    font-size: 14px;
}

.cycle-confirm-btn-row {
    display: flex;
    gap: 10px;
}

.cycle-confirm-go-btn {
    flex: 1;
    padding: 14px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 14px;
    color: #000;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.cycle-confirm-go-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cycle-confirm-cancel-btn {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}