/* ═══════════════════════════════════════════════════════════
   أُفُق - نظام الشراكات الاستثمارية | التصميم النيومورفي الفاخر (Soft UI)
   ═══════════════════════════════════════════════════════════ */

/* 1. CSS Variables - Design Tokens */
:root {
    /* Fonts */
    --font-main: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Neumorphic Base Colors (Soft Cream-White Canvas) */
    --bg-primary: #F4F3EE;
    --bg-secondary: #EBEAE3;
    --bg-input: #F4F3EE;
    
    /* Neumorphic Shadows (Soft Embossed & Sunken) */
    --shadow-flat: 6px 6px 12px #e0ded5, -6px -6px 12px #ffffff;
    --shadow-flat-hover: 10px 10px 20px #d9d7ce, -10px -10px 20px #ffffff;
    --shadow-inset: inset 4px 4px 8px #d5d3c8, inset -4px -4px 8px #ffffff;
    --shadow-active: inset 2px 2px 5px #d5d3c8, inset -2px -2px 5px #ffffff;
    
    /* Accent Gold Colors */
    --gold-primary: #C9A84C;
    --gold-secondary: #D4AF37;
    --gold-light: #F5E6B8;
    
    /* Typography Colors */
    --text-primary: #2A2825;
    --text-secondary: #605C56;
    --text-muted: #9E9990;
    
    /* Alert / Status Colors (Neumorphic Style) */
    --accent-green: #2EA072;
    --accent-green-bg: rgba(46, 160, 114, 0.08);
    --accent-red: #D25656;
    --accent-red-bg: rgba(210, 86, 86, 0.08);
    --accent-blue: #4A90E2;
    
    /* Sizing & Borders */
    --radius-xs: 10px;
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 26px;
    --radius-xl: 32px;
    --radius-full: 9999px;
    
    --header-height: 72px;
    --nav-height: 76px;
    --max-width: 580px;
    
    --transition-fast: all 0.15s ease;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 2. Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

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

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    outline: none;
}

input, select, textarea {
    font-family: inherit;
    outline: none;
    border: none;
}

/* App Layout Bounds */
#app-container {
    position: relative;
    min-height: 100dvh;
}

#main-content {
    padding: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 32px) 16px calc(var(--nav-height) + 24px);
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

#main-content.no-header-padding {
    padding-top: calc(64px + env(safe-area-inset-top, 0px)) !important;
}

body.guest .hide-on-guest { display: none !important; }
body.guest #main-content { padding-top: calc(40px + env(safe-area-inset-top, 0px)); padding-bottom: 24px; }

/* 3. Top Header Bar */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 16px);
    padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
    background: var(--bg-primary);
    z-index: 100;
    display: flex;
    align-items: center;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-primary);
}

.logo-icon {
    font-size: 20px;
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Month Badge */
.month-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-inset);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-primary);
}

.month-badge .material-symbols-outlined {
    font-size: 15px;
}

/* Profile Dropdown Trigger */
.profile-dropdown-container {
    position: relative;
}

.avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    color: var(--gold-primary);
    font-weight: 800;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.avatar-btn:active {
    box-shadow: var(--shadow-active);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: 220px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 10px;
    box-shadow: var(--shadow-flat-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transition: var(--transition-bounce);
    z-index: 110;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-header { padding: 8px 10px; }
.dropdown-header .user-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.dropdown-header .user-email { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.dropdown-divider { height: 2px; background: var(--bg-secondary); margin: 6px 0; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    width: 100%;
}
.dropdown-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.dropdown-item.logout-item:hover { color: var(--accent-red); background: var(--accent-red-bg); }
.dropdown-item .material-symbols-outlined { font-size: 16px; }

/* 4. Bottom Navigation Capsule Dock */
#mobile-nav {
    position: fixed;
    bottom: 22px;
    left: 16px;
    right: 16px;
    height: 62px;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    box-shadow: 8px 8px 24px #e0ded5, -8px -8px 24px #ffffff;
    z-index: 100;
    max-width: calc(var(--max-width) - 32px);
    margin: 0 auto;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: var(--transition-bounce);
}

.mobile-nav-link .material-symbols-outlined {
    font-size: 22px;
}

.mobile-nav-link .nav-label {
    display: none;
}

/* Inset / sunken round button for active tabs */
.mobile-nav-link.active {
    color: var(--gold-primary);
    box-shadow: var(--shadow-inset);
}

/* Admin-only elements */
.admin-only { display: none; }
body.is-admin .admin-only { display: flex; }

/* 5. Welcome Profile Header Bar */
.welcome-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-flat);
    margin-bottom: 24px;
}

.welcome-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.welcome-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    color: var(--gold-primary);
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.welcome-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.welcome-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.welcome-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

.welcome-action {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.welcome-action:active {
    box-shadow: var(--shadow-active);
}

/* 6. Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 0 4px;
    gap: 12px;
}

.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

/* Section Header Mobile Layout Stacking */
@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .section-header > div {
        text-align: right;
        width: 100%;
    }
    
    .section-header button, 
    .section-header .btn {
        width: 100%;
    }
    
    .section-header .section-actions {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* 7. Card Panels (Soft Embossed Neumorphic Blocks) */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-flat);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.45);
}

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

.card-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

/* 8. Neumorphic Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: linear-gradient(to bottom, #ffffff 0%, #FAF9F6 100%);
    border-radius: 16px;
    padding: 14px 6px;
    text-align: center;
    box-shadow: 4px 4px 12px rgba(0,0,0,0.02), -4px -4px 12px #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 6px 6px 18px rgba(0,0,0,0.05), -6px -6px 18px #ffffff;
}

.stat-card-arrow {
    position: absolute;
    left: 8px;
    top: 8px;
    font-size: 13px !important;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0.45;
    font-weight: 800;
}

.stat-card:hover .stat-card-arrow {
    transform: translateX(-3px);
    opacity: 0.9;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.3;
}

.stat-value {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    font-family: var(--font-main);
}

.stat-value.text-green { color: var(--accent-green); }
.stat-value.text-red { color: var(--accent-red); }
.stat-value.text-blue { color: var(--accent-blue); }

.stat-unit {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Beautiful soft tinted gradients for cards instead of hard lines */
.stat-card.accent-green {
    background: linear-gradient(135deg, #ffffff 0%, rgba(46, 160, 114, 0.02) 100%);
    border: 1px solid rgba(46, 160, 114, 0.12);
}
.stat-card.accent-red {
    background: linear-gradient(135deg, #ffffff 0%, rgba(210, 86, 86, 0.02) 100%);
    border: 1px solid rgba(210, 86, 86, 0.12);
}
.stat-card.accent-blue {
    background: linear-gradient(135deg, #ffffff 0%, rgba(74, 144, 226, 0.02) 100%);
    border: 1px solid rgba(74, 144, 226, 0.12);
}

/* Exquisite Gold Card (Brushed Gold Slab) */
.stat-card.gold-card {
    background: linear-gradient(135deg, #E2C260 0%, #C9A84C 100%);
    color: #ffffff;
    border: 1px solid rgba(201, 168, 76, 0.2);
    box-shadow: 0 8px 20px rgba(201, 168, 76, 0.15);
}

.stat-card.gold-card:hover {
    box-shadow: 0 12px 24px rgba(201, 168, 76, 0.25);
}

.stat-card.gold-card .stat-label { color: rgba(255, 255, 255, 0.9); }
.stat-card.gold-card .stat-value { color: #ffffff; }
.stat-card.gold-card .stat-unit { color: rgba(255, 255, 255, 0.8); }

/* 9. Custom Premium Lists & Rounded Item Cards */
.premium-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.premium-list-item {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-flat);
    transition: var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.45);
    position: relative;
    overflow: hidden;
}

.premium-list-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-flat-hover);
}

.premium-list-item::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 6px;
    transition: var(--transition-fast);
}

.premium-list-item.type-income::before {
    background: linear-gradient(to bottom, var(--accent-green), #4ccea1);
}

.premium-list-item.type-expense::before {
    background: linear-gradient(to bottom, var(--accent-red), #ff8a8a);
}

.item-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.item-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    background: var(--bg-primary);
    box-shadow: var(--shadow-inset);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

.item-avatar.gradient {
    background: linear-gradient(135deg, var(--gold-secondary) 0%, var(--gold-primary) 100%);
    color: #ffffff;
    box-shadow: 2px 2px 6px rgba(201, 168, 76, 0.25);
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.item-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.4;
}

.item-subtitle {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.item-left {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
}

.item-value {
    font-size: 14.5px;
    font-weight: 900;
    color: var(--text-primary);
    white-space: nowrap;
}

.item-badge-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Status Badges in Soft UI */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 9.5px;
    font-weight: 800;
}

.status-paid { background: var(--accent-green-bg); color: var(--accent-green); }
.status-partial { background: rgba(245, 158, 11, 0.08); color: #E08C00; }
.status-unpaid { background: var(--accent-red-bg); color: var(--accent-red); }
.status-overpaid { background: rgba(46, 160, 114, 0.12); color: var(--accent-green); }

.balance-positive { color: var(--accent-green); }
.balance-negative { color: var(--accent-red); }
.balance-zero { color: var(--text-muted); }

/* 10. Buttons (Premium Soft UI & Elegant Contoured Shapes) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 12.5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    color: var(--text-secondary);
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.5);
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
    box-shadow: var(--shadow-active);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-secondary) 0%, var(--gold-primary) 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(201, 168, 76, 0.18), var(--shadow-flat);
}

.btn-gold:active {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-secondary) 100%);
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-green {
    background: linear-gradient(135deg, #32B380 0%, #2EA072 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(46, 160, 114, 0.18), var(--shadow-flat);
}

.btn-green:active {
    background: linear-gradient(135deg, #2EA072 0%, #24805b 100%);
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-outline {
    box-shadow: var(--shadow-inset);
    color: var(--gold-primary);
    border: 1px solid rgba(201, 168, 76, 0.15);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 10px;
    gap: 4px;
}

.btn-block {
    width: 100%;
}

.btn .material-symbols-outlined {
    font-size: 15px;
    display: inline-block;
    vertical-align: middle;
}

/* 11. Forms & Inset Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding-right: 4px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    box-shadow: var(--shadow-inset);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

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

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%239E9990'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 36px;
}

/* 12. Modals (Bottom Drawer Style) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(42, 40, 37, 0.35);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

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

.modal-content {
    width: 100%;
    max-width: var(--max-width);
    max-height: 85dvh;
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px 20px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: var(--transition-bounce);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
}

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

.modal-handle {
    width: 40px;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    margin: 0 auto 18px;
    box-shadow: var(--shadow-inset);
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

/* 13. Auth Wrapper & Premium Banner Layout with Covers & Overlays */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 20px;
    background: var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-primary);
    border-radius: 36px;
    overflow: hidden;
    box-shadow: var(--shadow-flat);
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.auth-header-banner {
    height: 280px;
    position: relative;
    overflow: hidden;
    border-bottom: 3px solid var(--gold-primary);
}

.auth-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    z-index: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.auth-slide.active {
    opacity: 1;
    z-index: 2;
}

.auth-slide-overlay {
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(16, 46, 36, 0.95) 0%, rgba(16, 46, 36, 0.8) 50%, rgba(16, 46, 36, 0.45) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 32px 24px;
    text-align: center;
    box-sizing: border-box;
}

.auth-slide-title {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-slide-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.auth-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.auth-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
}

.auth-dot.active {
    width: 18px;
    border-radius: 3px;
    background: var(--gold-primary);
}

.auth-body {
    padding: 28px 24px 32px;
}

.auth-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 2px;
    text-align: center;
}

.auth-subtitle {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}

.auth-input-pill {
    border-radius: 14px !important;
    padding: 11px 16px !important;
    border: none !important;
    font-size: 13px !important;
}

.auth-btn-pill {
    border-radius: 14px !important;
    padding: 11px 16px !important;
    font-size: 13px !important;
    box-shadow: 0 6px 15px rgba(201, 168, 76, 0.2), var(--shadow-flat) !important;
}

.auth-error {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
    display: none;
}

/* 14. Toast Container */
#toast-container {
    position: fixed;
    top: calc(var(--header-height) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 360px;
}

.toast {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    box-shadow: var(--shadow-flat-hover);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 700;
    animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.success { border-right: 3px solid var(--accent-green); }
.toast.error { border-right: 3px solid var(--accent-red); }
.toast.info { border-right: 3px solid var(--gold-primary); }

.toast .material-symbols-outlined { font-size: 18px; }
.toast.success .material-symbols-outlined { color: var(--accent-green); }
.toast.error .material-symbols-outlined { color: var(--accent-red); }
.toast.info .material-symbols-outlined { color: var(--gold-primary); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 15. Charts container */
.chart-container {
    min-height: 250px;
    margin-top: 12px;
}

/* 16. Utility Classes */
.text-center { text-align: center; }
.text-gold { color: var(--gold-primary); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }

/* Number display styling */
.num {
    direction: ltr;
    unicode-bidi: bidi-override;
    display: inline-block;
    font-family: 'Inter', 'Cairo', sans-serif;
    font-weight: 700;
}

/* Loading & Empty placeholders */
.loading-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state .material-symbols-outlined {
    font-size: 42px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 700;
}

.expense-image-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-primary);
    box-shadow: var(--shadow-flat);
    cursor: pointer;
    transition: var(--transition-fast);
}

.expense-image-thumb:hover {
    transform: scale(1.15);
}

.image-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(42, 40, 37, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
    cursor: pointer;
}

.image-preview-overlay img {
    max-width: 90%;
    max-height: 85dvh;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   بطاقات الشركاء الفاخرة (Premium Partner Cards)
   ═══════════════════════════════════════════════════════════ */
.premium-investor-card {
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-bounce);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: right;
}

.premium-investor-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: var(--shadow-flat-hover);
}

.premium-investor-card:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: var(--shadow-active);
}

/* Card Header */
.investor-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.investor-card-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.investor-avatar-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-primary);
    box-shadow: var(--shadow-inset);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--gold-primary);
}

.investor-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.investor-avatar-initials {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-secondary) 0%, var(--gold-primary) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 2px 2px 5px rgba(201, 168, 76, 0.2);
}

.investor-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.investor-card-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

.investor-card-email {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.investor-card-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.share-percentage-tag {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold-primary);
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* Progress Section */
.investor-card-progress-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.investor-card-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.investor-card-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-inset);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.investor-card-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill-paid {
    background: linear-gradient(90deg, var(--accent-green) 0%, #4ADE80 100%);
    box-shadow: 0 0 8px rgba(46, 160, 114, 0.3);
}

.progress-fill-partial {
    background: linear-gradient(90deg, #E08C00 0%, #F59E0B 100%);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.progress-fill-unpaid {
    background: var(--bg-secondary);
}

.progress-fill-overpaid {
    background: linear-gradient(90deg, var(--accent-blue) 0%, #60A5FA 100%);
    box-shadow: 0 0 8px rgba(74, 144, 226, 0.3);
}

/* Grid Details */
.investor-card-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: rgba(235, 234, 227, 0.35);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1px solid rgba(235, 234, 227, 0.6);
}

.investor-grid-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.investor-grid-label {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.investor-grid-value {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Card Footer */
.investor-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 800;
    border-top: 1px dashed rgba(212, 175, 55, 0.15);
    padding-top: 10px;
    margin-top: 2px;
}

.investor-footer-balance {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.investor-footer-action {
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    gap: 2px;
    transition: var(--transition-fast);
}

.premium-investor-card:hover .investor-footer-action {
    transform: translateX(-4px);
}

/* 17. Premium Badge Component styles */
.premium-badge-gold {
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.25);
    color: var(--gold-primary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    font-family: var(--font-main);
}

.premium-badge-secondary {
    background: rgba(96, 92, 86, 0.06);
    border: 1px solid rgba(96, 92, 86, 0.15);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    font-family: var(--font-main);
}

/* 17.5. Premium Profile UI Styles (Mockup Style) */
.profile-cover {
    height: 120px;
    background: linear-gradient(135deg, rgba(201, 168, 76, 0.15) 0%, rgba(201, 168, 76, 0.05) 100%);
    border-radius: 20px 20px 0 0;
    position: relative;
}

.profile-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: -50px auto 12px auto; /* Overlap cover */
    z-index: 5;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), var(--shadow-flat);
    border: 4px solid var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.profile-avatar-edit-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(201, 168, 76, 0.4);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    transition: transform 0.2s ease;
}

.profile-avatar-edit-badge:active {
    transform: scale(0.9);
}

.profile-info {
    text-align: center;
    margin-bottom: 24px;
}

.profile-name {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.profile-email {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 10px;
}

/* Premium Options List Layout */
.profile-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.profile-option-row {
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.profile-option-row:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-active);
}

.profile-option-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-option-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(201, 168, 76, 0.08);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.profile-option-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
}

.profile-option-desc {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

.profile-option-chevron {
    color: var(--text-muted);
    font-size: 18px;
    transition: transform 0.2s ease;
}

.profile-option-row.active .profile-option-chevron {
    transform: rotate(-90deg); /* points down in RTL, or rotate to indicate expanded */
}

/* Collapsible container */
.profile-collapse-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}

.profile-collapse-container.open {
    max-height: 1000px;
    opacity: 1;
    margin-top: -4px;
    margin-bottom: 8px;
}

/* 18. Responsive adjustments */
@media (max-width: 380px) {
    .stats-grid { gap: 10px; }
    .stat-card { padding: 14px 8px; border-radius: 14px; }
    .stat-value { font-size: 15px; }
    .stat-label { font-size: 9.5px; }
    .stat-icon { width: 28px; height: 28px; }
    .stat-icon .material-symbols-outlined { font-size: 15px !important; }
    .premium-list-item { padding: 12px 14px; }
}

@media (min-width: 480px) {
    .stat-value { font-size: 22px; }
}

@media (min-width: 768px) {
    :root {
        --max-width: 600px;
    }
}

/* 19. Responsive Personal Finance Cards */
.personal-finance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.personal-finance-item {
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    border-radius: var(--radius-sm);
    padding: 12px 6px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.45);
    white-space: nowrap;
}

@media (max-width: 480px) {
    .personal-finance-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .personal-finance-item.span-mobile-full {
        grid-column: span 2;
    }
}

@media (max-width: 360px) {
    .personal-finance-grid {
        grid-template-columns: 1fr;
    }
    .personal-finance-item.span-mobile-full {
        grid-column: span 1;
    }
}

/* 20. Responsive Ledger Filter Grid */
.ledger-filters-container {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-flat);
    margin-bottom: 20px;
}

.ledger-filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.ledger-filter-item {
    background: var(--bg-primary);
    box-shadow: var(--shadow-inset);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.45);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.ledger-filter-select {
    background: transparent;
    border: none;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-main);
    cursor: pointer;
    outline: none;
    direction: rtl;
    width: 100%;
    -webkit-appearance: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

@media (max-width: 480px) {
    .ledger-filter-row {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 8px;
    }
    .ledger-filter-item {
        width: 100%;
    }
}

/* 21. Premium Ledger Totals Layout */
.ledger-totals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.ledger-total-card {
    background: var(--bg-primary);
    box-shadow: var(--shadow-flat);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.45);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.ledger-total-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-flat-hover);
}

.ledger-total-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.ledger-total-card.income-card::before {
    background: linear-gradient(to right, var(--accent-green), #4ccea1);
}

.ledger-total-card.expense-card::before {
    background: linear-gradient(to right, var(--accent-red), #ff8a8a);
}

.ledger-total-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.2px;
}

.ledger-total-value {
    font-size: 14.5px;
    font-weight: 900;
    font-family: var(--font-main);
}

@media (max-width: 380px) {
    .ledger-totals-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}



