/* CardAhead Companion Web Dashboard - CSS */
:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(22, 28, 45, 0.65);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-card-hover: rgba(139, 92, 246, 0.3);
    
    --color-text-primary: #F3F4F6;
    --color-text-secondary: #9CA3AF;
    --color-text-muted: #6B7280;
    
    --color-primary: #8B5CF6;
    --color-primary-hover: #A78BFA;
    --color-primary-glow: rgba(139, 92, 246, 0.4);
    
    --color-success: #10B981;
    --color-success-hover: #34D399;
    --color-success-glow: rgba(16, 185, 129, 0.2);
    
    --color-danger: #EF4444;
    --color-danger-hover: #F87171;
    --color-danger-glow: rgba(239, 68, 68, 0.2);
    
    --color-card-blue: linear-gradient(135deg, #1D4ED8 0%, #3B82F6 100%);
    --color-card-purple: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 100%);
    --color-card-green: linear-gradient(135deg, #047857 0%, #10B981 100%);
    --color-card-red: linear-gradient(135deg, #B91C1C 0%, #EF4444 100%);
    --color-card-orange: linear-gradient(135deg, #C2410C 0%, #F97316 100%);
    --color-card-default: linear-gradient(135deg, #374151 0%, #4B5563 100%);
    
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--color-text-primary);
    min-height: 100vh;
    padding: 1.5rem;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.06) 0%, transparent 40%);
    background-attachment: fixed;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* App Layout Wrapper */
.app-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* Navigation Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Mid-header Navigation Tabs */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.3rem;
    border-radius: 12px;
    border: 1px solid var(--border-card);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 9px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.nav-tab svg {
    transition: var(--transition-smooth);
    opacity: 0.7;
}

.nav-tab:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-tab.active {
    color: #FFFFFF;
    background: var(--color-primary);
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

.nav-tab.active svg {
    opacity: 1;
}

.nav-tab:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

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

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.app-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

body.light-mode #app-logo-light {
    display: block;
}

body.light-mode #app-logo-dark {
    display: none;
}

body:not(.light-mode) #app-logo-light {
    display: none;
}

body:not(.light-mode) #app-logo-dark {
    display: block;
}

.brand-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFFFFF 0%, #A78BFA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.brand-text span {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: -1px;
}

.auth-section {
    display: flex;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.4rem 1rem 0.4rem 0.5rem;
    border-radius: 30px;
    border: 1px solid var(--border-card);
}

#user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--color-primary);
}

#user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

/* Card Component Styles */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    border-left: 3px solid var(--color-primary);
    padding-left: 10px;
    margin-bottom: 1.2rem;
}

/* Landing / Hero Section */
.landing-illustration {
    height: 120px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.ill-card {
    position: absolute;
    width: 100px;
    height: 65px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 12px 24px rgba(0,0,0,0.5);
}

.ill-card-1 {
    background: var(--color-card-purple);
    transform: rotate(-12deg) translateX(-25px);
    z-index: 1;
}

.ill-card-2 {
    background: var(--color-card-blue);
    transform: rotate(10deg) translateX(30px) translateY(5px);
    z-index: 2;
    color: #FFF;
    font-weight: 800;
}

.section-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    max-width: 540px;
    margin: 4rem auto 0;
}

.section-hero h2 {
    font-size: 1.6rem;
    margin-bottom: 0.8rem;
}

.section-hero p {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 2.2rem;
}

/* Button UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
    border-radius: 12px;
}

.btn-full {
    width: 100%;
}

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

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px var(--color-primary-glow);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Google Drive Backups Panel */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.section-header h2 {
    font-size: 1.3rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.unsaved-badge {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
}

.description-text {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.2rem;
}

.backup-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    transition: var(--transition-smooth);
}

.backup-item:hover {
    border-color: var(--border-card-hover);
    background: rgba(255, 255, 255, 0.04);
}

.backup-details h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.backup-details span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.backup-size {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.backup-size-badge {
    background: rgba(139, 92, 246, 0.12);
    color: #C084FC;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Dashboard Grid Layout (Desktop columns) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2rem;
}

/* Left Column Sidebar cards */
.column-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Active Backup Metadata Card */
.backup-info-card {
    border-left: 4px solid var(--color-primary);
}

.backup-badge {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(139, 92, 246, 0.15);
    color: #C084FC;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.backup-info-card h3 {
    border: none;
    padding-left: 0;
    margin-bottom: 0.2rem;
    font-size: 1rem;
    word-break: break-all;
}

.backup-info-card p {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* Credit Cards carousel inside Sidebar */
.cards-carousel {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.8rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.cards-carousel::-webkit-scrollbar {
    display: none;
}

.credit-card-ui {
    flex: 0 0 260px;
    height: 150px;
    border-radius: 16px;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #FFFFFF;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    scroll-snap-align: start;
    transition: var(--transition-smooth);
}

.credit-card-ui:hover {
    transform: translateY(-3px);
}

/* Dashboard Overview Row (Forecast cards) */
.dashboard-overview-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-details {
    flex: 1;
    min-width: 0; /* allows overflow truncation */
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 0.15rem;
    font-weight: 600;
}

.stat-details h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.1;
}

.stat-desc {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Installment Plan UI */
.installment-item {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.installment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.installment-header h4 {
    font-size: 0.82rem;
    color: var(--color-text-primary);
    font-weight: 600;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    height: 6px;
    width: 100%;
    overflow: hidden;
}

.progress-bar-fill {
    background: var(--color-primary);
    height: 100%;
    border-radius: 8px;
    transition: width 0.4s ease;
}

.installment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.installment-footer span {
    font-weight: 500;
}

/* Budget Goal UI */
.budget-goal-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 0.8rem;
}

.budget-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
}

.budget-goal-title {
    font-weight: 600;
    color: var(--color-text-primary);
}

.budget-goal-values {
    color: var(--color-text-secondary);
}

.budget-danger .progress-bar-fill {
    background: var(--color-danger);
}

.budget-warning .progress-bar-fill {
    background: #F59E0B; /* Orange */
}

.budget-safe .progress-bar-fill {
    background: var(--color-success);
}

/* Income Item UI */
.income-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
}

.income-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.income-source {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.income-meta {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.income-amount-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.income-amount {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--color-success);
}


.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-issuer {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.card-logo {
    font-size: 1.1rem;
}

.card-middle {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 0.65rem;
}

.card-due-info span {
    display: block;
    opacity: 0.7;
    font-size: 0.55rem;
    margin-bottom: 0.05rem;
}

.card-due-info strong {
    font-size: 0.7rem;
}

.card-limit span {
    display: block;
    opacity: 0.7;
    font-size: 0.55rem;
    text-align: right;
    margin-bottom: 0.05rem;
}

.card-limit strong {
    font-size: 0.7rem;
}

/* Log Expense Form */
.expense-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.form-row {
    display: flex;
    gap: 0.8rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 550;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    color: var(--color-text-primary);
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.05);
}

.form-group textarea {
    resize: none;
}

/* Right Column Main Dashboard */
.column-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Table toolbar filters */
.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.table-header-row h3 {
    margin-bottom: 0 !important;
}

.table-toolbar {
    display: flex;
    gap: 0.6rem;
}

.table-toolbar input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    color: var(--color-text-primary);
    font-size: 0.8rem;
    width: 180px;
}

.table-toolbar select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    color: var(--color-text-primary);
    font-size: 0.8rem;
    width: 140px;
}

/* Responsive Table layout styles */
.table-scroll-container {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.expenses-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.expenses-table th {
    color: var(--color-text-secondary);
    font-weight: 500;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-card);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.expenses-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--color-text-primary);
}

.expenses-table tbody tr {
    transition: var(--transition-smooth);
}

.expenses-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

/* Tag designs */
.card-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
}

.category-tag {
    color: #FFFFFF;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.amount-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Status indicator dot */
.status-badge {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}

.status-posted {
    background-color: var(--color-success);
    box-shadow: 0 0 6px var(--color-success-glow);
}

.status-pending {
    background-color: #FBBF24;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

/* Row Action delete button */
.btn-delete-row {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.btn-delete-row:hover {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.08);
}

/* Toast Message */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-card);
    border-radius: 30px;
    padding: 0.7rem 1.4rem;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    display: flex;
    align-items: center;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    color: #F87171;
}

/* Spinner & empty states */
.loading-spinner {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    text-align: center;
    padding: 2rem;
    width: 100%;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    width: 100%;
}

.warning-text {
    color: #F87171;
}

/* Light Mode Overrides */
body.light-mode {
    --bg-main: #F3F4F6;
    --bg-card: rgba(255, 255, 255, 0.85);
    --border-card: rgba(0, 0, 0, 0.08);
    --border-card-hover: rgba(139, 92, 246, 0.2);
    
    --color-text-primary: #1F2937;
    --color-text-secondary: #4B5563;
    --color-text-muted: #9CA3AF;
    
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.04) 0%, transparent 40%);
}

body.light-mode .card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

body.light-mode .ios-settings-list {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .ios-settings-row {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

body.light-mode .ios-switch-slider {
    background-color: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.08);
}

/* Accent Color Themes */
body.theme-purple {
    --color-primary: #8B5CF6;
    --color-primary-hover: #A78BFA;
    --color-primary-glow: rgba(139, 92, 246, 0.4);
}
body.theme-blue {
    --color-primary: #3B82F6;
    --color-primary-hover: #60A5FA;
    --color-primary-glow: rgba(59, 130, 246, 0.4);
}
body.theme-green {
    --color-primary: #10B981;
    --color-primary-hover: #34D399;
    --color-primary-glow: rgba(16, 185, 129, 0.4);
}
body.theme-red {
    --color-primary: #EF4444;
    --color-primary-hover: #F87171;
    --color-primary-glow: rgba(239, 68, 68, 0.4);
}
body.theme-orange {
    --color-primary: #F97316;
    --color-primary-hover: #FB923C;
    --color-primary-glow: rgba(249, 115, 22, 0.4);
}
body.theme-indigo {
    --color-primary: #6366F1;
    --color-primary-hover: #818CF8;
    --color-primary-glow: rgba(99, 102, 241, 0.4);
}
body.theme-teal {
    --color-primary: #0D9488;
    --color-primary-hover: #2DD4BF;
    --color-primary-glow: rgba(13, 148, 136, 0.4);
}
body.theme-pink {
    --color-primary: #DB2777;
    --color-primary-hover: #F472B6;
    --color-primary-glow: rgba(219, 39, 119, 0.4);
}
body.theme-sunset {
    --color-primary: #FF512F;
    --color-primary-hover: #DD2476;
    --color-primary-glow: rgba(255, 81, 47, 0.4);
}
body.theme-ocean {
    --color-primary: #0072ff;
    --color-primary-hover: #00c6ff;
    --color-primary-glow: rgba(0, 114, 255, 0.4);
}
body.theme-midnight {
    --color-primary: #4A3B9F;
    --color-primary-hover: #6351CF;
    --color-primary-glow: rgba(74, 59, 159, 0.4);
}
body.theme-forest {
    --color-primary: #11998e;
    --color-primary-hover: #38ef7d;
    --color-primary-glow: rgba(17, 153, 142, 0.4);
}
body.theme-nebula {
    --color-primary: #6a11cb;
    --color-primary-hover: #2575fc;
    --color-primary-glow: rgba(106, 17, 203, 0.4);
}
body.theme-sakura {
    --color-primary: #FF758C;
    --color-primary-hover: #FF7EB3;
    --color-primary-glow: rgba(255, 117, 140, 0.4);
}

/* iOS Settings Styling */
.ios-settings-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.ios-settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ios-settings-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.5rem;
}

.ios-settings-group-header h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    font-weight: 700;
}

.ios-settings-group-header .group-icon {
    font-size: 0.9rem;
}

.ios-settings-list {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    overflow: hidden;
}

.ios-settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition-smooth);
}

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

.ios-settings-row:hover {
    background: rgba(255, 255, 255, 0.015);
}

.row-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.88rem;
    color: var(--color-text-primary);
    font-weight: 500;
}

.row-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.row-control select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    color: var(--color-text-primary);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    min-width: 120px;
    text-align: right;
    transition: var(--transition-smooth);
}

.row-control select:focus {
    border-color: var(--color-primary);
}

.row-control input[type="number"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    color: var(--color-text-primary);
    font-size: 0.82rem;
    outline: none;
    transition: var(--transition-smooth);
}

.row-control input[type="number"]:focus {
    border-color: var(--color-primary);
}

/* iOS Toggle Switch Styles */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: .3s;
    border-radius: 24px;
}

.ios-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ios-switch input:checked + .ios-switch-slider {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.ios-switch input:checked + .ios-switch-slider:before {
    transform: translateX(20px);
}

/* Card Utilization Warning Badge */
.card-util-badge {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
    font-weight: 600;
}

/* Monthly Spend Progress inside stat-card */
.budget-progress-container {
    margin-top: 0.4rem;
    width: 100%;
}

.budget-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.2rem;
}

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

@media (max-width: 640px) {
    body {
        padding: 1rem;
    }
    
    .main-header {
        padding: 1rem 1.2rem;
        margin-bottom: 1.5rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
    }
    
    .nav-tab {
        flex: 1;
        justify-content: center;
    }
    
    .user-profile {
        width: 100%;
        justify-content: space-between;
    }
    
    .dashboard-overview-row {
        grid-template-columns: 1fr;
    }
    
    .table-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    
    .table-toolbar {
        width: 100%;
    }
    
    .table-toolbar input,
    .table-toolbar select {
        flex: 1;
        width: auto;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0.8rem;
    }
}

/* Settings Enhancements */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

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

.settings-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 1.5rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body:not(.light-mode) .settings-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Premium Table styling inside Backups Manager */
.backup-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    font-size: 0.85rem;
}

.backup-table th {
    padding: 0.8rem 1rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 2px solid var(--border-card);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.backup-table td {
    padding: 1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

body.light-mode .backup-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.backup-table tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

body.light-mode .backup-table tr:hover {
    background: rgba(0, 0, 0, 0.01);
}

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

.backup-size-badge {
    display: inline-block;
    background: rgba(139, 92, 246, 0.12);
    color: #C084FC;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

body.light-mode .backup-size-badge {
    background: rgba(139, 92, 246, 0.08);
    color: #7C3AED;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.backup-status-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.12);
    color: #34D399;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

body.light-mode .backup-status-badge {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

/* ============================================================
   NEW DASHBOARD LAYOUT STYLES
   ============================================================ */

/* === Dashboard Content Grid: 2-column layout === */
.dashboard-content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

.dashboard-panel-left {
    min-width: 0;
}

.dashboard-panel-right {
    min-width: 0;
}

/* Responsive: stack at smaller screens */
@media (max-width: 1024px) {
    .dashboard-content-grid {
        grid-template-columns: 1fr;
    }
}

/* === Spend Trend Card === */
.spend-trend-card .card-subtitle {
    display: block;
}

/* === 2x2 Mini Comparison Cards Grid === */
.comparison-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card-mini {
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-radius: 16px;
    transition: var(--transition-smooth);
}

.stat-card-mini:hover {
    border-color: var(--border-card-hover);
    transform: translateY(-2px);
}

.stat-card-mini .mini-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
    font-weight: 700;
    display: block;
}

.stat-card-mini h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    border: none;
    padding: 0;
    margin: 0;
    line-height: 1.1;
}

.stat-card-mini .mini-desc {
    font-size: 0.68rem;
    color: var(--color-text-muted);
    display: block;
}

/* === Dashboard Sync Banner === */
.dashboard-sync-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.75rem 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    min-height: 56px;
    transition: var(--transition-smooth);
}

.dashboard-sync-banner.synced {
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.05);
}

.dashboard-sync-banner.required {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
}

.dashboard-sync-banner.empty {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.05);
}

.dashboard-sync-banner .banner-content {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex: 1;
    min-width: 0;
}

.dashboard-sync-banner .banner-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.dashboard-sync-banner .banner-text {
    min-width: 0;
}

.dashboard-sync-banner .banner-text h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 0.05rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', sans-serif;
    border: none;
    padding: 0;
}

.dashboard-sync-banner .banner-text p {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-sync-banner .banner-text.synced h4 { color: #34D399; }
.dashboard-sync-banner .banner-text.required h4 { color: #F87171; }
.dashboard-sync-banner .banner-text.empty h4 { color: #FBBF24; }

/* === Upcoming Obligations List === */
.dashboard-upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
    padding-right: 2px;
}

.upcoming-obligation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    transition: var(--transition-smooth);
}

.upcoming-obligation-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-card-hover);
}

.obligation-details {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1;
}

.obligation-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obligation-desc {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obligation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}

.obligation-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.obligation-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.18rem 0.5rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.obligation-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.obligation-badge.warning {
    background: rgba(251, 191, 36, 0.15);
    color: #FBBF24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.obligation-badge.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* === DB Loaded Badge & Timestamp in Settings header === */
.db-loaded-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(139, 92, 246, 0.12);
    color: #C084FC;
    border: 1px solid rgba(139, 92, 246, 0.25);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-loaded-timestamp {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-style: italic;
    white-space: nowrap;
}

/* === Quick Log Expense button hover on dashboard === */
#btn-quick-log-expense:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--color-primary-glow);
}

/* ============================================================
   LIGHT MODE OVERRIDES FOR NEW DASHBOARD ELEMENTS
   ============================================================ */
body.light-mode .dashboard-sync-banner {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .dashboard-sync-banner.synced {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
}

body.light-mode .dashboard-sync-banner.required {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

body.light-mode .dashboard-sync-banner.empty {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.25);
}

body.light-mode .upcoming-obligation-item {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .upcoming-obligation-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .stat-card-mini {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

body.light-mode .db-loaded-badge {
    background: rgba(139, 92, 246, 0.08);
    color: #7C3AED;
    border-color: rgba(139, 92, 246, 0.15);
}

body.light-mode .obligation-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

body.light-mode .obligation-badge.warning {
    background: rgba(217, 119, 6, 0.1);
    color: #B45309;
}

body.light-mode .obligation-badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}

/* ============================================================
   ANALYTICS VIEW — FULL REDESIGN
   ============================================================ */

/* --- Analytics header / period filter --- */
.analytics-header {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.analytics-filter-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    border-radius: 999px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.analytics-nav-btn {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.4rem;
    line-height: 1;
    width: 44px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    border-right: 1px solid var(--border-card);
}

.analytics-nav-btn:last-child {
    border-right: none;
    border-left: 1px solid var(--border-card);
}

.analytics-nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-primary);
}

.analytics-period-label-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 38px;
    min-width: 140px;
    justify-content: center;
}

.analytics-period-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-primary);
    font-family: 'Outfit', sans-serif;
}

.analytics-period-select {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    outline: none;
    padding: 0;
}

/* --- Analytics grid layout --- */
.analytics-grid {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.analytics-row-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

@media (max-width: 900px) {
    .analytics-row-two {
        grid-template-columns: 1fr;
    }
}

/* --- Analytics card shared --- */
.analytics-card {
    padding: 1.3rem 1.4rem;
}

.analytics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.9rem;
}

.analytics-section-label {
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

/* --- Credit Pool --- */
.analytics-util-pct {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
}

.analytics-credit-bar-wrap {
    margin-bottom: 1rem;
}

.analytics-credit-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    overflow: hidden;
}

.analytics-credit-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #10B981 0%, var(--color-primary) 100%);
    transition: width 0.6s ease;
}

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

.analytics-credit-stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

.analytics-stat-micro-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
    margin-bottom: 0.2rem;
}

.analytics-stat-micro-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-text-primary);
}

.analytics-credit-limit-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: 0.3rem;
}

/* --- Category Donut --- */
.analytics-cat-total-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-primary);
    font-family: 'Outfit', sans-serif;
}

.analytics-donut-layout {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.analytics-donut-wrap {
    position: relative;
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}

/* --- Interactive Legend --- */
.analytics-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    max-height: 160px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.analytics-legend-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    padding: 0.2rem 0.4rem;
    transition: var(--transition-smooth);
}

.analytics-legend-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.analytics-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.analytics-legend-name {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
}

.analytics-legend-pct {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.analytics-legend-row.active .analytics-legend-name {
    color: var(--color-text-primary);
    font-weight: 600;
}

.analytics-legend-row.active .analytics-legend-pct {
    color: var(--color-primary);
}

/* --- Top Spends --- */
.analytics-top-spends {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.4rem;
}

.analytics-spend-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.analytics-spend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analytics-spend-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 65%;
}

.analytics-spend-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

.analytics-spend-bar-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.analytics-spend-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--color-primary);
    transition: width 0.5s ease;
}

.analytics-spend-pct {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

/* --- Weekly Peak Label --- */
.analytics-weekly-peak {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
    min-height: 1em;
}

/* --- Comparison Legend --- */
.analytics-comparison-legend {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.analytics-comparison-legend-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.analytics-comparison-legend-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analytics-comparison-legend-val {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
}

.analytics-comparison-divider {
    width: 1px;
    background: var(--border-card);
    margin: 0 0.3rem;
    align-self: stretch;
}

/* --- Smart Insights --- */
.analytics-insights {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.analytics-insight-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: var(--transition-smooth);
    border-radius: 8px;
}

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

.analytics-insight-row:hover {
    padding-left: 0.3rem;
}

.analytics-insight-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.analytics-insight-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.5;
    flex: 1;
}

/* --- Light mode for analytics --- */
body.light-mode .analytics-filter-bar {
    background: rgba(255, 255, 255, 0.8);
}

body.light-mode .analytics-nav-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .analytics-credit-bar-track,
body.light-mode .analytics-spend-bar-track {
    background: rgba(0, 0, 0, 0.06);
}

body.light-mode .analytics-legend-row:hover {
    background: rgba(0, 0, 0, 0.03);
}

body.light-mode .analytics-insight-row {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

/* ============================================================
   EXPENSES VIEW — iOS-INSPIRED REDESIGN
   ============================================================ */

/* --- Summary Header Card --- */
.exp-summary-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
}

.exp-summary-left {
    min-width: 0;
}

.exp-total-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-text-primary);
    line-height: 1.1;
    margin: 0.2rem 0 0.1rem 0;
}

.exp-tx-count {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.exp-summary-divider {
    width: 1px;
    height: 50px;
    background: var(--border-card);
    flex-shrink: 0;
}

.exp-summary-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.exp-summary-stat {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.exp-stat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.exp-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.exp-stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
}

.exp-summary-stat-divider {
    width: 1px;
    height: 30px;
    background: rgba(255,255,255,0.07);
    flex-shrink: 0;
}

/* --- Search + Filter Toolbar --- */
/* --- Search + Filter Toolbar --- */
.exp-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 0.6rem;
    border-radius: 16px;
}

body.light-mode .exp-toolbar {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.exp-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.exp-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    transition: var(--transition-smooth);
}

.exp-search-input {
    width: 100%;
    padding: 0.62rem 0.9rem 0.62rem 2.6rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    color: var(--color-text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition-smooth);
    box-sizing: border-box;
}

body.light-mode .exp-search-input {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.exp-search-input:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

body.light-mode .exp-search-input:hover {
    border-color: rgba(0, 0, 0, 0.16);
}

.exp-search-input:focus {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

body.light-mode .exp-search-input:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.exp-search-input:focus + .exp-search-icon {
    color: var(--color-primary);
}

.exp-filter-select {
    padding: 0.62rem 2.2rem 0.62rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    color: var(--color-text-primary);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
}

body.light-mode .exp-filter-select {
    background-color: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.exp-filter-select:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

body.light-mode .exp-filter-select:hover {
    border-color: rgba(0, 0, 0, 0.16);
}

.exp-filter-select:focus {
    border-color: var(--color-primary);
    background-color: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

body.light-mode .exp-filter-select:focus {
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* --- Grouped Expenses List --- */
.expenses-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-bottom: 6rem;
}

.exp-day-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    padding-top: 1rem;
    margin-top: 0.4rem;
}

.exp-day-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0.4rem;
    right: 0.4rem;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.01) 100%);
}

body.light-mode .exp-day-group::before {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.01) 100%);
}

.exp-day-group:first-child {
    padding-top: 0.2rem;
    margin-top: 0;
}

.exp-day-group:first-child::before {
    display: none;
}

.exp-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0.5rem;
    margin-bottom: 0.1rem;
}

.exp-day-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.exp-day-count {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: 0.4rem;
    display: inline-block;
    vertical-align: middle;
}

body.light-mode .exp-day-count {
    background: rgba(0, 0, 0, 0.03);
}

.exp-day-total {
    font-family: 'Outfit', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--color-text-muted);
}

.exp-day-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exp-day-dot {
    font-size: 0.76rem;
    color: var(--color-text-muted);
    opacity: 0.5;
    user-select: none;
}

.nepali-date-badge {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-primary);
    background: rgba(139, 92, 246, 0.08);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    padding: 2px 8px;
    border-radius: 9999px;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border: 1px solid color-mix(in srgb, var(--color-primary) 15%, transparent);
    display: inline-block;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

/* Individual expense row card */
.exp-row-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 0.85rem 1rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

body.light-mode .exp-row-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.exp-row-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--cat-hover-color, rgba(139, 92, 246, 0.25));
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px var(--cat-hover-color, rgba(139, 92, 246, 0.2));
}

body.light-mode .exp-row-card:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 24px -8px var(--cat-hover-color, rgba(139, 92, 246, 0.15));
}

.exp-row-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.exp-row-info {
    flex: 1;
    min-width: 0;
}

.exp-row-merchant {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.exp-row-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.exp-row-category {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 99px;
    color: #fff;
    letter-spacing: 0.03em;
}

.exp-row-card-tag {
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

.exp-row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}

.exp-row-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--color-text-primary);
}

.exp-row-status {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.1rem 0.38rem;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.exp-row-status.status-paid {
    background: rgba(16, 185, 129, 0.12);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.exp-row-status.status-partial {
    background: rgba(245, 158, 11, 0.12);
    color: #FBBF24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.exp-row-status.status-unpaid {
    background: rgba(239, 68, 68, 0.12);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.exp-row-delete {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.exp-row-card:hover .exp-row-delete {
    opacity: 1;
    transform: scale(1);
}

.exp-row-delete:hover {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.05);
}

/* --- Floating Action Button (FAB) --- */
.exp-fab {
    position: fixed;
    bottom: 2.2rem;
    right: 2.2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, #8B5CF6 50%, #EC4899 100%);
    border: none;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px var(--color-primary-glow);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    z-index: 200;
}

.exp-fab.fab-visible {
    display: flex;
    animation: fab-pulse 2s infinite;
}

.exp-fab svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.exp-fab:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 10px 32px var(--color-primary-glow);
}

.exp-fab:hover svg {
    transform: rotate(90deg) scale(1.1);
}

.exp-fab:active {
    transform: scale(0.95);
}

@keyframes fab-pulse {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

/* --- Premium Empty State Illustration --- */
.empty-state-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state-illustration {
    margin-bottom: 1.2rem;
    opacity: 0.25;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.empty-state-wrap:hover .empty-state-illustration {
    opacity: 0.45;
    transform: scale(1.03);
}

.empty-state-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.35rem;
}

.empty-state-text {
    font-size: 0.78rem;
    max-width: 280px;
    line-height: 1.45;
}

/* ============================================================
   LOG EXPENSE MODAL
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeInOverlay 0.18s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-sheet {
    width: 100%;
    max-width: 680px;
    background: var(--bg-main);
    border-radius: 28px 28px 0 0;
    padding: 0.5rem 1.8rem 2.5rem 1.8rem;
    border: 1px solid var(--border-card);
    border-bottom: none;
    animation: slideUpSheet 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 92vh;
    overflow-y: auto;
}

@keyframes slideUpSheet {
    from { transform: translateY(100%); opacity: 0.5; }
    to   { transform: translateY(0); opacity: 1; }
}

.modal-drag-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    margin: 0.6rem auto 1.3rem auto;
}

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

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-card);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-text-primary);
}

.modal-amount-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1.4rem;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 18px;
}

.modal-currency-symbol {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    flex-shrink: 0;
}

.modal-amount-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Outfit', sans-serif;
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--color-text-primary);
    width: 100%;
    min-width: 0;
    letter-spacing: -0.02em;
}

.modal-amount-input::placeholder {
    color: rgba(255, 255, 255, 0.1);
}

.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .modal-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Light mode overrides for expenses */
body.light-mode .exp-summary-divider,
body.light-mode .exp-summary-stat-divider {
    background: rgba(0, 0, 0, 0.08);
}

body.light-mode .exp-filter-select {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.light-mode .modal-sheet {
    background: #F1F5F9;
    border-color: rgba(0, 0, 0, 0.07);
}

body.light-mode .modal-drag-handle {
    background: rgba(0, 0, 0, 0.1);
}

body.light-mode .modal-amount-row {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.07);
}

body.light-mode .modal-amount-input::placeholder {
    color: rgba(0, 0, 0, 0.12);
}

body.light-mode .modal-close-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .exp-row-status.status-paid {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

body.light-mode .exp-row-status.status-partial {
    background: rgba(217, 119, 6, 0.08);
    color: #B45309;
}

body.light-mode .exp-row-status.status-unpaid {
    background: rgba(220, 38, 38, 0.08);
    color: #B91C1C;
}

/* ============================================================
   EXPENSE DETAIL SIDE-SHEET & RECEIPT VIEW
   ============================================================ */
.details-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1100;
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
    animation: fadeInOverlay 0.2s ease;
}

.details-sheet-container {
    width: 100%;
    max-width: 480px;
    background: var(--bg-main, #111315);
    border-left: 1px solid var(--border-card, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    animation: slideRightSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes slideRightSheet {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@media (max-width: 768px) {
    .details-sheet-overlay {
        align-items: flex-end;
    }
    .details-sheet-container {
        max-width: 100%;
        height: 92vh;
        border-left: none;
        border-radius: 28px 28px 0 0;
        border-top: 1px solid var(--border-card, rgba(255, 255, 255, 0.08));
        animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
}

.details-ambient-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.details-glow-circle-1 {
    position: absolute;
    top: -10%;
    right: -20%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
}

.details-glow-circle-2 {
    position: absolute;
    bottom: -10%;
    left: -20%;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.1;
    background: #8b5cf6;
}

.details-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-card, rgba(255, 255, 255, 0.08));
    z-index: 2;
    background: rgba(17, 19, 21, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.light-mode .details-sheet-header {
    background: rgba(248, 250, 252, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.details-sheet-back-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0;
    font-family: inherit;
}

.details-sheet-edit-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-card, rgba(255, 255, 255, 0.08));
    color: var(--color-text-primary);
    padding: 0.4rem 1rem;
    border-radius: 99px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    font-family: inherit;
}

body.light-mode .details-sheet-edit-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.details-sheet-edit-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

body.light-mode .details-sheet-edit-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.details-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    z-index: 1;
    position: relative;
}

.receipt-card-wrapper {
    position: relative;
    padding-top: 1.5rem;
    margin-bottom: 2rem;
}

.receipt-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 0 0;
    padding: 2.2rem 1.5rem 1.8rem 1.5rem;
    position: relative;
    z-index: 1;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    background-image: linear-gradient(180deg, rgba(var(--category-color-rgb), 0.15) 0%, transparent 100%);
    margin-bottom: 8px; /* Room for zig-zag overlay */
}

body.light-mode .receipt-card {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 25px rgba(0,0,0,0.04);
    background-image: linear-gradient(180deg, rgba(var(--category-color-rgb), 0.08) 0%, transparent 100%);
}

.receipt-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--category-color);
    border-radius: 18px 18px 0 0;
}

.receipt-serration-wrapper {
    position: relative;
    height: 10px;
    margin-top: -8px;
    margin-bottom: 1.8rem;
    overflow: hidden;
    filter: drop-shadow(0 11px 10px rgba(0,0,0,0.12));
}

.receipt-serration {
    width: 100%;
    height: 10px;
    background-image: linear-gradient(-45deg, var(--bg-main, #111315) 5px, transparent 0), 
                      linear-gradient(45deg, var(--bg-main, #111315) 5px, transparent 0);
    background-position: left bottom;
    background-repeat: repeat-x;
    background-size: 10px 10px;
    position: absolute;
    bottom: 0;
}

body.light-mode .receipt-serration {
    background-image: linear-gradient(-45deg, #F8FAFC 5px, transparent 0), 
                      linear-gradient(45deg, #F8FAFC 5px, transparent 0);
}

.receipt-floating-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--category-color) 0%, color-mix(in srgb, var(--category-color) 80%, black) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(var(--category-color-rgb), 0.35);
    border: 3.5px solid var(--bg-main, #111315);
    z-index: 3;
}

body.light-mode .receipt-floating-badge {
    border-color: #F8FAFC;
}

.receipt-title {
    font-size: 0.62rem;
    font-family: monospace;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.8rem;
    margin-bottom: 0.3rem;
}

.receipt-merchant {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    text-align: center;
    color: var(--color-text-primary);
    text-transform: uppercase;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.receipt-dashed-line {
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
    margin: 1.2rem 0;
}

body.light-mode .receipt-dashed-line {
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.receipt-amount-section {
    text-align: center;
}

.receipt-amount-label {
    font-size: 0.6rem;
    font-family: monospace;
    color: var(--color-text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 0.2rem;
}

.receipt-amount-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.receipt-remaining-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
}

.receipt-remaining-label {
    font-size: 0.65rem;
    font-family: monospace;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
}

.receipt-remaining-val {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-text-primary);
}

.receipt-remaining-val.unpaid {
    color: #ef4444;
}

.receipt-barcode {
    display: flex;
    justify-content: center;
    gap: 2.2px;
    margin-top: 0.8rem;
    opacity: 0.6;
}

.receipt-barcode-line {
    height: 28px;
    background: var(--color-text-primary);
}

.receipt-meta-id {
    font-size: 0.55rem;
    font-family: monospace;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.8rem;
    letter-spacing: 0.02em;
}

.receipt-stamp {
    position: absolute;
    top: 1.6rem;
    right: 1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 900;
    color: #10b981;
    border: 2.5px solid #10b981;
    border-radius: 6px;
    padding: 2px 6px;
    transform: rotate(-12deg);
    opacity: 0.8;
    user-select: none;
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.15);
    background: rgba(17, 19, 21, 0.8);
}

body.light-mode .receipt-stamp {
    background: rgba(255, 255, 255, 0.8);
}

.receipt-stamp.unpaid {
    color: #ef4444;
    border-color: #ef4444;
}

.receipt-stamp.partial {
    color: #f59e0b;
    border-color: #f59e0b;
}

.receipt-mark-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.4rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--color-primary-glow);
    transition: var(--transition-smooth);
    font-family: inherit;
}

.receipt-mark-btn:hover {
    background: var(--color-primary-hover);
}

.receipt-mark-btn.unpaid {
    background: rgba(249, 115, 22, 0.08);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.2);
    box-shadow: none;
}

.receipt-mark-btn.unpaid:hover {
    background: rgba(249, 115, 22, 0.15);
}

.detail-grid-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    margin-top: 1.2rem;
}

.details-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-bottom: 1.8rem;
}

.details-grid-cell {
    display: flex;
    align-items: center;
    gap: 0.68rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
}

body.light-mode .details-grid-cell {
    background: rgba(0, 0, 0, 0.02);
}

.details-cell-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.details-cell-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.details-cell-title {
    font-size: 0.52rem;
    font-weight: 800;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.details-cell-value {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.details-payments-section {
    margin-bottom: 1.8rem;
}

.details-payments-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.details-payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.8rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-card);
    border-radius: 12px;
}

body.light-mode .details-payment-row {
    background: rgba(0, 0, 0, 0.01);
}

.details-payment-info {
    display: flex;
    flex-direction: column;
}

.details-payment-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.details-payment-date {
    font-size: 0.6rem;
    color: var(--color-text-muted);
}

.details-payment-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
    color: #10b981;
}

.btn-inline-add {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-card);
    color: var(--color-text-primary);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    transition: var(--transition-smooth);
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

body.light-mode .btn-inline-add {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

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

body.light-mode .btn-inline-add:hover {
    background: rgba(0, 0, 0, 0.07);
}

.details-payment-log-form {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

body.light-mode .details-payment-log-form {
    background: rgba(0, 0, 0, 0.01);
}

.details-payment-log-form input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

body.light-mode .details-payment-log-form input {
    background: #ffffff;
}

.details-payment-log-form input:focus {
    border-color: var(--color-primary);
}

.details-payment-form-buttons {
    display: flex;
    gap: 0.5rem;
}

.details-payment-form-buttons button {
    flex: 1;
    padding: 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.details-payment-cancel-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-primary);
}

body.light-mode .details-payment-cancel-btn {
    background: rgba(0, 0, 0, 0.04);
}

.details-payment-submit-btn {
    background: var(--color-primary);
    color: white;
}

.details-payment-submit-btn:hover {
    background: var(--color-primary-hover);
}

.details-banknotes-section {
    margin-bottom: 2rem;
}

.banknote-fanned-container {
    height: 110px;
    position: relative;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
}

.banknote-visual-item {
    width: 135px;
    height: 68px;
    border-radius: 6px;
    position: absolute;
    top: 20px;
    left: 50%;
    margin-left: -67px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.45s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: var(--note-color);
    background: linear-gradient(135deg, var(--note-color) 0%, color-mix(in srgb, var(--note-color) 80%, black) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 8px;
    color: rgba(255, 255, 255, 0.95);
    user-select: none;
}

.banknote-visual-inner {
    border: 0.8px dashed rgba(255, 255, 255, 0.2);
    position: absolute;
    inset: 3px;
    border-radius: 4px;
    pointer-events: none;
}

.banknote-visual-stripe {
    width: 6px;
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 25px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.05));
    pointer-events: none;
}

.banknote-visual-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.2px solid rgba(255, 255, 255, 0.12);
    position: absolute;
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

.banknote-value-top {
    font-family: serif;
    font-size: 0.52rem;
    font-weight: 700;
    line-height: 1;
}

.banknote-value-top span {
    display: block;
    font-size: 0.7rem;
    margin-top: 1px;
}

.banknote-value-bottom {
    align-self: flex-end;
    font-family: serif;
    font-size: 0.7rem;
    font-weight: 700;
}

.coin-visual-row {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding-left: 12px;
}

.coin-visual-item {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--coin-color) 0%, color-mix(in srgb, var(--coin-color) 75%, black) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
    font-size: 0.6rem;
    margin-left: -12px;
    transition: transform 0.3s ease;
    user-select: none;
}

.coin-visual-item span {
    font-size: 0.42rem;
    font-weight: 700;
}

.details-banknote-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.details-banknote-denom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
}

body.light-mode .details-banknote-denom-row {
    background: rgba(0, 0, 0, 0.01);
}

.details-denom-left {
    display: flex;
    align-items: center;
}

.details-denom-badge {
    width: 20px;
    height: 12px;
    border-radius: 3px;
    border: 0.5px solid rgba(255, 255, 255, 0.15);
    background: var(--denom-color);
}

.details-denom-badge.coin {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.details-denom-text {
    font-size: 0.78rem;
    font-weight: 800;
    margin-left: 0.6rem;
    color: var(--color-text-primary);
}

.details-denom-count {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 700;
}

.details-delete-section {
    margin-top: 2rem;
    margin-bottom: 3rem;
}

.btn-danger-outline {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    font-weight: 800;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
}

.details-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding-bottom: 4rem;
}

.details-edit-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.details-edit-form label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.details-edit-form input,
.details-edit-form select,
.details-edit-form textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

body.light-mode .details-edit-form input,
body.light-mode .details-edit-form select,
body.light-mode .details-edit-form textarea {
    background: #ffffff;
}

.details-edit-form input:focus,
.details-edit-form select:focus,
.details-edit-form textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Custom Theme Confirmation Dialog */
.confirm-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeInConfirm 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.confirm-dialog-card {
    background: var(--bg-card, rgba(30, 32, 35, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 1.8rem;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    transform: scale(0.92);
    opacity: 0;
    animation: popInConfirm 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

body.light-mode .confirm-dialog-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
}

.confirm-dialog-icon {
    width: 48px;
    height: 48px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
}

.confirm-dialog-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    color: var(--color-text-primary);
}

.confirm-dialog-message {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin: 0 0 1.5rem 0;
    line-height: 1.45;
}

.confirm-dialog-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-dialog-actions .btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.btn-danger {
    background-color: #ef4444;
    color: #FFF;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}

@keyframes fadeInConfirm {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popInConfirm {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

