:root {
    --bg-color: #F7F8FA;
    --surface-color: #FFFFFF;
    --text-main: #1F2937;
    --text-secondary: #6B7280;
    --color-positive: #10B981; /* Soft green */
    --color-positive-bg: #D1FAE5; /* Very light green background */
    --color-negative: #EF4444; /* Soft red */
    --color-negative-bg: #FEE2E2;
    --color-accent: #6366F1; /* Soft indigo/blue accent */
    --color-border: #E5E7EB;
    
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    
    --sidebar-width: 250px;
    --bottom-nav-height: 65px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

/* Authentication Page Styles */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-container {
    background-color: var(--surface-color);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background-color: #4F46E5;
}

.btn-danger {
    background-color: var(--color-negative);
    color: white;
}

.btn-danger:hover {
    background-color: #DC2626;
}

.btn-secondary {
    background-color: var(--color-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #D1D5DB;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 7px;
    gap: 0.35rem;
}

.btn-sm i {
    width: 14px;
    height: 14px;
}

.btn-icon {
    padding: 0.4rem;
    border-radius: 8px;
    background: var(--bg-color);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.btn-icon.text-danger:hover {
    background: var(--color-negative-bg);
    color: var(--color-negative);
    border-color: var(--color-negative-bg);
}

.btn-icon.text-accent:hover {
    background: #EEF2FF;
    color: var(--color-accent);
    border-color: #C7D2FE;
}

.action-btns {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Visual Icon Picker */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 0.5rem;
    max-height: 190px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    border-radius: 8px;
    background: var(--surface-color);
    border: 1.5px solid var(--color-border);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    gap: 4px;
    user-select: none;
    text-align: center;
}

.icon-option:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-1px);
}

.icon-option.selected {
    border-color: var(--color-accent);
    background: #EEF2FF;
    color: var(--color-accent);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--color-accent);
}

.icon-option i {
    width: 20px;
    height: 20px;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-link {
    color: var(--color-accent);
    font-weight: 500;
    font-size: 0.875rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.alert-error {
    background-color: var(--color-negative-bg);
    color: var(--color-negative);
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.text-positive { color: var(--color-positive); }
.text-negative { color: var(--color-negative); }
.text-danger { color: var(--color-negative); }
.text-sm { font-size: 0.875rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar (Desktop & Mobile Drawer) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease;
    will-change: transform;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header .brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin: 0;
}

.sidebar-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    background: var(--bg-color);
    color: var(--text-main);
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    gap: 0.75rem;
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
    transform: translateX(3px);
}

.nav-item.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--color-accent);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Collapsed Sidebar on Desktop */
@media (min-width: 769px) {
    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }
}

/* Mobile Sidebar Drawer & Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar-close-btn {
        display: flex;
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2.5rem 2rem 2.5rem;
    padding-bottom: calc(2rem + var(--bottom-nav-height));
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

.content-container {
    max-width: 1150px;
    margin: 0 auto;
}

/* Unified App Header / Topbar */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-logo-mobile {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.header-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border-top: 1px solid var(--color-border);
    height: var(--bottom-nav-height);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
}

.bottom-nav .nav-item {
    flex-direction: column;
    padding: 0.5rem;
    margin: 0;
    font-size: 0.75rem;
    gap: 0.25rem;
    border-radius: 0;
}

.bottom-nav .nav-item:hover {
    background-color: transparent;
    transform: none;
}

.bottom-nav .nav-item.active {
    background-color: transparent;
}

.fab-container {
    position: relative;
    top: -20px;
}

.fab-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--color-accent);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

/* Dashboard Cards & Modern Elevated Cards */
.dashboard-top-card {
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
    color: #FFFFFF;
    padding: 2.25rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 30px -6px rgba(49, 46, 129, 0.35);
    position: relative;
    overflow: hidden;
    margin-bottom: 1.75rem;
    text-align: left;
}

.dashboard-top-card::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.3) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.dashboard-top-card .card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.dashboard-top-card .subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

.dashboard-top-card .main-balance {
    font-size: 2.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.badge-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #10B981;
    box-shadow: 0 0 8px #10B981;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.15rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 380px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    background-color: var(--surface-color);
    padding: 1.25rem 1.4rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.04), 0 1px 4px -1px rgba(0, 0, 0, 0.02);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px -4px rgba(0, 0, 0, 0.07), 0 4px 8px -2px rgba(0, 0, 0, 0.03);
    border-color: rgba(99, 102, 241, 0.3);
}

.summary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-icon-badge {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.summary-card:hover .card-icon-badge {
    transform: scale(1.05);
}

.card-icon-badge i {
    width: 20px;
    height: 20px;
}

.card-icon-badge.income { background: #ECFDF5; color: #10B981; }
.card-icon-badge.expense { background: #FEF2F2; color: #EF4444; }
.card-icon-badge.loan { background: #FFFBEB; color: #F59E0B; }
.card-icon-badge.debt { background: #FDF2F8; color: #EC4899; }
.card-icon-badge.wallet { background: #EEF2FF; color: #6366F1; }

.summary-card .summary-label {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.summary-card .summary-value {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Modern Transaction Item Card */
.transaction-item {
    background-color: var(--surface-color);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.95rem 1.25rem;
    margin-bottom: 0.65rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.transaction-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.05);
    border-color: rgba(99, 102, 241, 0.25);
}

.tx-icon-wrapper {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.transaction-item:hover .tx-icon-wrapper {
    transform: scale(1.05);
}

.tx-icon-wrapper.income { background: #ECFDF5; color: #10B981; }
.tx-icon-wrapper.expense { background: #FEF2F2; color: #EF4444; }
.tx-icon-wrapper.transfer { background: #EEF2FF; color: #6366F1; }
.tx-icon-wrapper.loan_out { background: #FFFBEB; color: #D97706; }
.tx-icon-wrapper.loan_return { background: #ECFDF5; color: #059669; }
.tx-icon-wrapper.debt_payment { background: #FEF2F2; color: #DC2626; }

/* Progress bar for Loan & Debt */
.progress-bar-bg {
    width: 100%;
    height: 6px;
    background-color: #F1F5F9;
    border-radius: 9999px;
    overflow: hidden;
    margin: 0.65rem 0;
}

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

.progress-bar-fill.success {
    background: linear-gradient(90deg, #10B981 0%, #34D399 100%);
}

.progress-bar-fill.warning {
    background: linear-gradient(90deg, #F59E0B 0%, #FBBF24 100%);
}

.progress-bar-fill.danger {
    background: linear-gradient(90deg, #EF4444 0%, #F87171 100%);
}

.badge-pill {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-pill.success { background: #ECFDF5; color: #065F46; }
.badge-pill.warning { background: #FFFBEB; color: #92400E; }
.badge-pill.danger { background: #FEF2F2; color: #991B1B; }
.badge-pill.neutral { background: #F3F4F6; color: #4B5563; }

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

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.empty-state {
    background-color: var(--surface-color);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: var(--color-border);
}

/* Quick Add Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content.bottom-sheet {
    background-color: var(--surface-color);
    width: 100%;
    max-width: 550px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (min-width: 769px) {
    .modal-overlay {
        align-items: center;
    }
    .modal-content.bottom-sheet {
        border-radius: var(--radius-lg);
        transform: translateY(20px);
    }
    .modal-overlay.active .modal-content {
        transform: translateY(0);
    }
}

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

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
}

.quick-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.875rem;
    font-weight: 500;
    gap: 0.75rem;
    transition: background-color 0.2s;
}

.quick-action-btn:hover {
    background-color: rgba(99, 102, 241, 0.05);
}

.quick-action-btn i {
    width: 24px;
    height: 24px;
}

.quick-action-btn.income i { color: var(--color-positive); }
.quick-action-btn.expense i { color: var(--color-negative); }
.quick-action-btn.transfer i { color: var(--color-accent); }

/* Compact Categories Styles */
.category-columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.category-group-card {
    background: var(--surface-color);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.category-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--color-border);
    background: #FAFAFC;
}

.category-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.category-group-title i {
    width: 18px;
    height: 18px;
}

.category-compact-list {
    display: flex;
    flex-direction: column;
}

.category-compact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.125rem;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.15s ease;
}

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

.category-compact-item:hover {
    background-color: #F8FAFC;
}

.category-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

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

.category-item-icon i {
    width: 16px;
    height: 16px;
}

.category-item-icon.income {
    background-color: var(--color-positive-bg);
    color: var(--color-positive);
}

.category-item-icon.expense {
    background-color: var(--color-negative-bg);
    color: var(--color-negative);
}

.category-item-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* Debt & Installment Enhancements */
.radio-pill-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.radio-pill-item {
    flex: 1;
    min-width: 130px;
}

.radio-pill-item input[type="radio"] {
    display: none;
}

.radio-pill-item label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    background: var(--bg-color);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    text-align: center;
    gap: 0.25rem;
}

.radio-pill-item input[type="radio"]:checked + label {
    border-color: var(--color-accent);
    background: #EEF2FF;
    color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent);
}

.radio-pill-item label i {
    width: 18px;
    height: 18px;
}

.preview-schedule-box {
    background: var(--surface-color);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 1rem;
}

.preview-schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #F8FAFC;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.875rem;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.preview-table th {
    text-align: left;
    padding: 0.5rem 1rem;
    background: #F1F5F9;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
}

.preview-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--text-main);
}

.preview-table tr:last-child td {
    border-bottom: none;
}

/* Installment Timeline Cards on Show Page */
.installment-timeline-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--surface-color);
    transition: background 0.15s ease;
}

.installment-timeline-card:hover {
    background: #FAFAFC;
}

.installment-timeline-card:last-child {
    border-bottom: none;
}

.installment-timeline-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.installment-badge-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
}

.installment-badge-num.paid {
    background: var(--color-positive-bg);
    color: var(--color-positive);
}

.installment-badge-num.partial {
    background: #FEF3C7;
    color: #D97706;
}

.installment-badge-num.unpaid {
    background: #F1F5F9;
    color: var(--text-secondary);
    border: 1px solid var(--color-border);
}

.installment-badge-num.overdue {
    background: var(--color-negative-bg);
    color: var(--color-negative);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.filter-tab-btn {
    padding: 0.4rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--surface-color);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-tab-btn:hover {
    background: #F1F5F9;
    color: var(--text-main);
}

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

/* Overdue / Due Banner */
.debt-alert-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.debt-alert-banner.warning {
    background: #FFFBEB;
    border-color: #FDE68A;
    color: #92400E;
}

/* Clickable Dashboard Card */
a.summary-card.clickable-card {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
    position: relative;
}

a.summary-card.clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.4);
}

a.summary-card.clickable-card:active {
    transform: translateY(-1px);
}

/* PWA Install Banner & Buttons */
.pwa-install-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #4F46E5 0%, #3B82F6 100%);
    color: #FFFFFF;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    animation: slideDown 0.3s ease-out;
}

.pwa-install-banner .banner-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.pwa-install-banner .banner-text i {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.pwa-install-btn {
    background: #FFFFFF;
    color: #4F46E5;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pwa-install-btn:hover {
    background: #F8FAFC;
    transform: scale(1.02);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 1rem 1rem calc(2rem + var(--bottom-nav-height)) 1rem;
    }
    
    .bottom-nav {
        display: flex;
    }
    
    .dashboard-top-card {
        padding: 1.5rem;
    }
}

/* ==========================================================================
   Global Navigation Loading, Skeleton Screens & Smooth Transitions
   ========================================================================== */

/* 1. Top Navigation Progress Bar */
.global-nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    background: transparent;
    transition: opacity 0.15s ease;
}

.global-nav-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366F1, #8B5CF6, #EC4899);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.6), 0 0 4px rgba(236, 72, 153, 0.4);
    border-radius: 0 2px 2px 0;
    transition: width 0.3s cubic-bezier(0.1, 0.7, 0.1, 1);
}

.global-nav-progress.active {
    opacity: 1;
}

.global-nav-progress.active::after {
    animation: navProgressIndeterminate 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes navProgressIndeterminate {
    0% {
        left: 0%;
        width: 0%;
    }
    50% {
        left: 25%;
        width: 60%;
    }
    100% {
        left: 100%;
        width: 0%;
    }
}

/* 2. Smooth Page Content Transition */
.content-container {
    animation: pageFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

@keyframes pageFadeIn {
    from {
        opacity: 0.82;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 3. Skeleton Shimmer Core Engine */
.skeleton-shimmer {
    background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmerAnimation 1.6s ease-in-out infinite;
    border-radius: var(--radius-md);
    display: block;
}

@keyframes skeletonShimmerAnimation {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Skeleton Atomic Components */
.skeleton-box {
    background: #E2E8F0;
}

.skeleton-text {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.skeleton-text.title {
    height: 22px;
    width: 45%;
    border-radius: 7px;
    margin-bottom: 12px;
}

.skeleton-text.subtitle {
    height: 12px;
    width: 65%;
    margin-bottom: 16px;
}

.skeleton-text.w-100 { width: 100%; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-35 { width: 35%; }
.skeleton-text.w-25 { width: 25%; }

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.skeleton-header-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skeleton-list-item {
    background: var(--surface-color);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    gap: 0.75rem;
}

.skeleton-chart-box {
    height: 220px;
    border-radius: var(--radius-md);
    width: 100%;
}

.skeleton-tabs-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    padding-bottom: 4px;
}

.skeleton-tab-pill {
    height: 36px;
    width: 90px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* 4. Floating Slow Network Notice */
.global-nav-slow-notice {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 1.25rem);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(30, 41, 59, 0.92);
    backdrop-filter: blur(8px);
    color: #FFFFFF;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.global-nav-slow-notice.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Mobile Typography & Header Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    .app-header {
        margin-bottom: 1rem;
        padding-bottom: 0.65rem;
    }

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

    .section-header h2 {
        font-size: 1.15rem;
        font-weight: 700;
    }

    .section-header p {
        font-size: 0.8rem;
    }

    .main-content {
        padding: 1rem 1rem 2rem 1rem;
        padding-bottom: calc(1.75rem + var(--bottom-nav-height));
    }
}

/* ==========================================================================
   Modern Settings & Member Management UI
   ========================================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.settings-card {
    background: var(--surface-color);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.settings-card:hover {
    box-shadow: 0 4px 14px -3px rgba(0, 0, 0, 0.08);
    border-color: rgba(99, 102, 241, 0.25);
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--color-border);
}

.settings-card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.settings-icon-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-icon-badge.green {
    background: var(--color-positive-bg);
    color: var(--color-positive);
}

.settings-icon-badge.amber {
    background: #FEF3C7;
    color: #D97706;
}

.settings-icon-badge.red {
    background: var(--color-negative-bg);
    color: var(--color-negative);
}

/* Modern Input with Icon */
.modern-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.modern-input-group .input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
    width: 18px;
    height: 18px;
    transition: color 0.2s ease;
}

.modern-input-group input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--surface-color);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.modern-input-group input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.modern-input-group:focus-within .input-icon {
    color: var(--color-accent);
}

/* Modern Read-Only Email Display */
.settings-email-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    gap: 0.75rem;
}

.settings-email-display .email-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    overflow: hidden;
}

.settings-email-display .email-text {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modern Invite Member Box */
.invite-container {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(247, 248, 250, 0.8) 100%);
    border: 1.5px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    margin-bottom: 1.5rem;
}

.invite-form-row {
    display: flex;
    gap: 0.65rem;
    align-items: stretch;
    margin-top: 0.85rem;
}

@media (max-width: 600px) {
    .invite-form-row {
        flex-direction: column;
    }
}

.invite-form-row .modern-input-group {
    flex: 1;
}

.invite-btn {
    padding: 0.8rem 1.35rem;
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.25);
    transition: all 0.2s ease;
}

.invite-btn:hover {
    background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
    box-shadow: 0 5px 14px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

/* Modern Member List */
.member-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.member-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-color);
    border: 1px solid var(--color-border);
    transition: background-color 0.2s ease, transform 0.2s ease;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.member-card-item:hover {
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}




