/* ==========================================================================
   صندوق عائلي - النظام المالي التكافلي
   Sandouk Modern Design System (Site & Member Portal)
   Colors: Islamic Emerald, Deep Navy & Champagne Gold
   Full RTL & LTR Parity with Mobile & Tablet Optimization
   ========================================================================== */

:root {
    --primary: #064e3b;
    --primary-hover: #047857;
    --primary-light: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.2);
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.25);
    
    --navy-900: #0f172a;
    --navy-950: #0a0f1d;
    --sidebar-bg: #061e18;
    --sidebar-card: #0c2b23;
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --sidebar-text: #a7f3d0;
    --sidebar-text-muted: #6ee7b7;
    
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-hover-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-sub: #94a3b8;
    
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --info: #0ea5e9;
    --info-bg: #f0f9ff;
    --info-border: #bae6fd;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px -4px rgba(6, 78, 59, 0.08);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.18);
    
    --sidebar-width: 275px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--body-bg);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography based on language */
html[dir="rtl"] body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

html[dir="ltr"] body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.font-num, .stat-value, .money-display {
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color .2s ease, transform .2s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   App Shell & Layout (RTL & LTR)
   ========================================================================== */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Sidebar - RTL (Default) */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(195deg, #052e24 0%, #031c16 60%, #02120e 100%);
    color: #e2e8f0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

html[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

html[dir="ltr"] .sidebar {
    left: 0;
    right: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-brand .logo-badge {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #10b981 0%, #047857 50%, #d97706 100%);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.sidebar-brand .brand-title {
    color: #ffffff;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.01em;
}

.sidebar-brand .brand-sub {
    font-size: 11.5px;
    color: #a7f3d0;
    opacity: 0.85;
    font-weight: 500;
}

.sidebar-nav {
    padding: 18px 14px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s ease;
    border: 1px solid transparent;
}

.sidebar-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    color: #6ee7b7;
    transition: transform .2s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

html[dir="rtl"] .sidebar-link:hover {
    transform: translateX(-3px);
}

html[dir="ltr"] .sidebar-link:hover {
    transform: translateX(3px);
}

.sidebar-link:hover i {
    color: #34d399;
    transform: scale(1.1);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.1) 100%);
    color: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-weight: 700;
}

html[dir="rtl"] .sidebar-link.active {
    box-shadow: inset 4px 0 0 #10b981, 0 4px 15px rgba(0, 0, 0, 0.1);
}

html[dir="ltr"] .sidebar-link.active {
    box-shadow: inset -4px 0 0 #10b981, 0 4px 15px rgba(0, 0, 0, 0.1);
}

.sidebar-link.active i {
    color: #10b981;
}

.sidebar-link .badge-count {
    margin-inline-start: auto;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 20px;
    padding: 2px 8px;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

/* Main Area & Topbar */
.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

html[dir="rtl"] .main-area {
    margin-right: var(--sidebar-width);
    margin-left: 0;
}

html[dir="ltr"] .main-area {
    margin-left: var(--sidebar-width);
    margin-right: 0;
}

.topbar {
    height: 72px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar .page-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-content {
    padding: 28px 32px;
    flex: 1;
}

/* Member Topbar Chip */
.admin-chip, .member-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 5px 14px 5px 6px;
    border-radius: 40px;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all .2s ease;
}

.member-chip:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.member-chip .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.member-chip span {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-main);
}

.sidebar-toggle-btn {
    display: none;
    border: 1px solid var(--border-color);
    background: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    font-size: 18px;
    color: var(--text-main);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.notif-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-main);
}

.notif-bell:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.notif-bell .dot {
    position: absolute;
    top: 7px;
    left: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid #ffffff;
}

/* ==========================================================================
   Cards, Panels & Stat Ribbon (Fixed Text Wrapping)
   ========================================================================== */
.card-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow .25s ease, border-color .25s ease, transform .25s ease;
    position: relative;
}

.card-panel:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.card-panel .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 12px;
}

.card-panel .panel-head h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-panel .panel-head h3 i {
    color: var(--primary-light);
}

/* Stat Cards (Flex, no awkward wrap) */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-light), var(--accent));
    opacity: 0;
    transition: opacity .25s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card .stat-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1.2;
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: nowrap;
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 4px;
    font-weight: 500;
}

/* Gradients for Stat Icons */
.bg-grad-green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.bg-grad-blue { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); }
.bg-grad-amber { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.bg-grad-red { background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%); }
.bg-grad-purple { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 13.5px;
    padding: 10px 18px;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
    border-color: #047857;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-soft {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--text-main);
}

.btn-soft:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* Forms */
.form-label {
    font-weight: 700;
    font-size: 13.5px;
    margin-bottom: 7px;
    color: var(--text-main);
}

.form-control, .form-select {
    border-radius: var(--radius-md);
    border: 1.5px solid #e2e8f0;
    padding: 11px 16px;
    font-size: 14px;
    font-family: inherit;
    background-color: #ffffff;
    color: var(--text-main);
    transition: all .2s ease;
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: #10b981;
    outline: none;
    box-shadow: 0 0 0 3.5px rgba(16, 185, 129, 0.15);
}

/* Responsive Table */
.table-panel {
    border-radius: var(--radius-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

.table-modern {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    min-width: 580px;
}

html[dir="rtl"] .table-modern thead th {
    text-align: right;
}

html[dir="ltr"] .table-modern thead th {
    text-align: left;
}

.table-modern thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 700;
    padding: 15px 18px;
    border: none;
    border-bottom: 1.5px solid var(--border-color);
    white-space: nowrap;
}

.table-modern tbody td {
    padding: 15px 18px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    vertical-align: middle;
    color: var(--text-main);
}

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

.table-modern tbody tr:hover {
    background-color: #f8fafc;
}

/* Compact Share Lots Documentation Table & Spacing */
.table-lots-box {
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid var(--border-color, #e2e8f0);
    background: #fff;
    margin-top: 8px;
}
.table-lots-compact {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}
.table-lots-compact th {
    background: #f8fafc;
    color: var(--text-muted, #475569);
    font-size: 12px;
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1.5px solid var(--border-color, #e2e8f0);
    white-space: nowrap;
}
.table-lots-compact td {
    padding: 11px 14px;
    font-size: 13px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.table-lots-compact tbody tr:last-child td {
    border-bottom: none;
}
.table-lots-compact tbody tr:hover {
    background-color: #f8fafc;
}
.table-lots-compact .col-id { width: 5%; min-width: 50px; text-align: center; }
.table-lots-compact .col-shares { width: 10%; min-width: 100px; }
.table-lots-compact .col-date { width: 17%; min-width: 160px; }
.table-lots-compact .col-due { width: 13%; min-width: 125px; }
.table-lots-compact .col-sixmo { width: 23%; min-width: 215px; }
.table-lots-compact .col-found { width: 19%; min-width: 185px; }
.table-lots-compact .col-status { width: 13%; min-width: 135px; text-align: center; }
.table-lots-compact .badge-status {
    padding: 4px 10px;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 20px;
}
.table-lots-compact .badge-status::before {
    display: none !important;
}

/* Badges */
.badge-status {
    padding: 5px 13px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-success::before { background: #10b981; }

.badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-warning::before { background: #f59e0b; }

.badge-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-danger::before { background: #ef4444; }

.badge-info { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.badge-info::before { background: #0ea5e9; }

.badge-secondary { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-secondary::before { background: #94a3b8; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 55px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 46px;
    color: #cbd5e1;
    margin-bottom: 14px;
    display: block;
}

/* Alerts */
.alert-modern {
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.alert-success-modern { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger-modern { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* Auth Layout */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, #064e3b 0%, #06261f 50%, #02120e 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 44px 38px;
    width: 100%;
    max-width: 490px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 10;
}

.auth-card.wide {
    max-width: 840px;
    padding: 40px 44px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, #10b981 0%, #047857 50%, #d97706 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 28px;
    font-weight: 900;
    margin: 0 auto 18px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.auth-card .form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b !important;
    margin-bottom: 6px;
}

.auth-card .form-control {
    height: 48px !important;
    border-radius: 14px !important;
    border: 1.5px solid #cbd5e1 !important;
    background-color: #f8fafc !important;
    color: #0f172a !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    padding: 0.65rem 1rem;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}

.form-control-icon-start {
    padding-inline-start: 46px !important;
    padding-inline-end: 16px !important;
}

html[dir="rtl"] .form-control-icon-start {
    padding-right: 46px !important;
    padding-left: 16px !important;
}

html[dir="ltr"] .form-control-icon-start {
    padding-left: 46px !important;
    padding-right: 16px !important;
}

.form-control-icon-both {
    padding-inline-start: 46px !important;
    padding-inline-end: 46px !important;
}

html[dir="rtl"] .form-control-icon-both {
    padding-right: 46px !important;
    padding-left: 46px !important;
}

html[dir="ltr"] .form-control-icon-both {
    padding-left: 46px !important;
    padding-right: 46px !important;
}

.auth-card .form-control:focus {
    background-color: #ffffff !important;
    border-color: #059669 !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.16) !important;
    color: #0f172a !important;
    outline: none !important;
}

.auth-card .form-control::placeholder {
    color: #94a3b8 !important;
    font-weight: 400 !important;
}

.auth-card .btn-primary,
.btn-primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 0.95rem !important;
    border-radius: 14px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 10px 25px -4px rgba(5, 150, 105, 0.38) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.auth-card .btn-primary:hover,
.btn-primary:hover {
    background: linear-gradient(135deg, #047857 0%, #064e3b 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 15px 30px -4px rgba(5, 150, 105, 0.48) !important;
    color: #ffffff !important;
}

.btn-soft {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    font-weight: 700 !important;
    transition: all 0.2s ease !important;
}

.btn-soft:hover {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

.alert-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.alert-danger-modern {
    background-color: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}

.alert-success-modern {
    background-color: #f0fdf4 !important;
    color: #166534 !important;
    border: 1px solid #bbf7d0 !important;
}

/* ==========================================================================
   Mobile & Tablet Responsiveness (360px - 1024px)
   ========================================================================== */
@media (max-width: 992px) {
    html[dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    html[dir="ltr"] .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0) !important;
    }
    .main-area {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    .topbar {
        padding: 0 18px;
    }
    .page-content {
        padding: 20px 16px;
    }
    .sidebar-toggle-btn {
        display: inline-flex;
    }
    .stat-card {
        padding: 16px;
        gap: 12px;
    }
    .stat-card .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 12px;
    }
    .stat-card .stat-value {
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    .auth-card {
        padding: 28px 20px;
    }
    .topbar .page-title {
        font-size: 15px;
    }
    .member-chip span {
        display: none;
    }
}

/* ======================================================================
   Modern OTP Inputs & Verification Card Styling
   ====================================================================== */
.otp-container {
    margin: 1.5rem 0;
}

.otp-inputs {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    direction: ltr !important;
    margin: 1.25rem 0 !important;
}

.otp-inputs input,
.otp-inputs .otp-digit {
    width: 62px !important;
    height: 68px !important;
    font-size: 1.85rem !important;
    font-weight: 800 !important;
    text-align: center !important;
    border-radius: 16px !important;
    border: 2px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
    outline: none !important;
    padding: 0 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.otp-inputs input:hover,
.otp-inputs .otp-digit:hover {
    border-color: #cbd5e1 !important;
    background: #ffffff !important;
}

.otp-inputs input:focus,
.otp-inputs .otp-digit:focus {
    border-color: #10b981 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18), 0 8px 16px -4px rgba(16, 185, 129, 0.15) !important;
    transform: translateY(-2px) scale(1.04) !important;
}

.otp-inputs input.filled,
.otp-inputs .otp-digit.filled {
    border-color: #059669 !important;
    background: #f0fdf4 !important;
    color: #047857 !important;
}

.otp-inputs input.error,
.otp-inputs .otp-digit.error {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    color: #b91c1c !important;
    animation: otpShake 0.4s ease-in-out !important;
}

@keyframes otpShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Demo Badge & Card */
.otp-demo-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1.5px solid #a7f3d0;
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

.otp-demo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1.5px dashed #059669;
    color: #047857;
    font-weight: 800;
    font-size: 1.15rem;
    padding: 3px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.otp-demo-chip:hover {
    background: #047857;
    color: #ffffff;
    border-color: #047857;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.25);
}

/* 50s Resend Timer Button */
.btn-resend {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    transition: all 0.25s ease !important;
    border-radius: 14px !important;
}

.btn-resend.is-locked {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    background: #f1f5f9 !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0 !important;
    pointer-events: none !important;
}

.btn-resend.is-ready {
    opacity: 1 !important;
    cursor: pointer !important;
    background: #f0fdf4 !important;
    color: #047857 !important;
    border: 1px solid #a7f3d0 !important;
    pointer-events: auto !important;
}

.btn-resend.is-ready:hover {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2) !important;
}

@media (max-width: 480px) {
    .otp-inputs {
        gap: 8px !important;
    }
    .otp-inputs input,
    .otp-inputs .otp-digit {
        width: 48px !important;
        height: 56px !important;
        font-size: 1.45rem !important;
        border-radius: 12px !important;
    }
}


/* ==========================================================================
   Member portal v2 - page layout helpers (kpi rows, main+side split, lists)
   ========================================================================== */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 19px; font-weight: 800; margin: 0; color: var(--text-main); }
.page-head p { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.split.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 1199px) { .kpi-grid, .kpi-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 991px) { .split, .split.even { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 575px) { .kpi-grid, .kpi-grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }

.info-list .info-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border-color); font-size: 13.5px; }
.info-list .info-row:last-child { border-bottom: 0; }
.info-list .info-row span { color: var(--text-muted); }
.info-list .info-row b { font-weight: 700; color: var(--text-main); text-align: end; }

.progress-modern { height: 10px; border-radius: 999px; background: var(--border-light); overflow: hidden; }
.progress-modern > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary-light), var(--accent)); transition: width .4s ease; }
.progress-caption { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-color); background: #fff; font-size: 12.5px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: all .2s; }
.chip:hover { border-color: var(--primary-light); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .count { opacity: .75; margin-inline-start: 4px; font-weight: 600; }

.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border-color); border-radius: 14px; background: #fff; transition: all .2s; }
.notif-item:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.notif-item .n-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.notif-item .n-title { font-weight: 800; font-size: 14.5px; color: var(--text-main); }
.notif-item .n-body { color: var(--text-muted); font-size: 13.5px; line-height: 1.8; margin-top: 2px; }
.notif-item .n-time { color: var(--text-sub); font-size: 11.5px; margin-top: 6px; }
.n-success { background: #ecfdf5; color: #059669; }
.n-warning { background: #fffbeb; color: #d97706; }
.n-danger { background: #fef2f2; color: #dc2626; }
.n-info { background: #eff6ff; color: #2563eb; }
.n-brand { background: #f5f3ff; color: #7c3aed; }

.formula { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; background: var(--body-bg); border: 1px dashed var(--border-color); border-radius: 14px; padding: 16px; }
.formula .f-box { text-align: center; min-width: 70px; }
.formula .f-box b { display: block; font-size: 20px; font-weight: 900; }
.formula .f-box small { color: var(--text-muted); font-size: 12px; }
.formula .op { font-size: 20px; color: var(--text-sub); font-weight: 700; }
.formula .f-total b { color: var(--primary-hover); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; display: flex; gap: 12px; padding: 9px 0; font-size: 13.5px; line-height: 1.8; color: var(--text-muted); }
.steps li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; margin-top: 2px; }

.loan-item { border: 1px solid var(--border-color); border-radius: 14px; padding: 16px; background: #fff; display: flex; flex-direction: column; gap: 12px; transition: all .2s; }
.loan-item:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.loan-item .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.loan-item .amount { font-size: 21px; font-weight: 900; color: var(--text-main); line-height: 1.2; }
.loan-item .meta { color: var(--text-muted); font-size: 12.5px; }
.loan-item .nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 13px; font-weight: 700; }
.loan-item .nums small { display: block; color: var(--text-sub); font-weight: 600; font-size: 11.5px; }
.loans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; }

.req-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--border-color); }
.req-row:last-child { border-bottom: 0; }
.req-row .r-main b { display: block; font-size: 14.5px; }
.req-row .r-main span { color: var(--text-muted); font-size: 12px; }

.profile-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-hero .avatar-lg { width: 64px; height: 64px; border-radius: 20px; background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; box-shadow: 0 10px 20px rgba(16, 185, 129, .25); }
.profile-hero .who b { display: block; font-size: 18px; font-weight: 800; }
.profile-hero .who span { color: var(--text-muted); font-size: 13px; }
.ltr-input { direction: ltr; text-align: left; }
.tip-box { background: var(--warning-bg); border: 1px solid var(--warning-border); color: #92400e; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.8; }
.note-box { background: var(--success-bg); border: 1px solid var(--success-border); color: #065f46; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.8; }

/* Equal-height KPI cards inside Bootstrap rows (home dashboard) */
.row > [class*="col-"] > .stat-card { height: 100%; }

/* Tailwind (CDN) defines `.collapse { visibility: collapse }`, which hides Bootstrap collapses right after they open. */
.collapse,
.collapsing {
    visibility: visible !important;
}
