/* =====================================================================
   Maxx Fitness — Premium Management System Theme
   Clean Athletic Dark & Light Theme | WCAG AA 4.5:1 Contrast Compliant
   ===================================================================== */

:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Single Brand Accent (Coral Red) */
    --brand-primary: #f43f5e;
    --brand-primary-hover: #e11d48;
    --brand-primary-subtle: rgba(244, 63, 94, 0.12);
    --brand-primary-border: rgba(244, 63, 94, 0.3);

    /* Status Colors */
    --color-emerald: #10b981;
    --color-emerald-subtle: rgba(16, 185, 129, 0.14);
    --color-amber: #f59e0b;
    --color-amber-subtle: rgba(245, 158, 11, 0.14);
    --color-red: #ef4444;
    --color-red-subtle: rgba(239, 68, 68, 0.14);
    --color-sky: #0ea5e9;
    --color-sky-subtle: rgba(14, 165, 233, 0.14);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --sidebar-width: 260px;
    --header-height: 64px;
    --bottom-nav-height: 60px;
}

/* =====================================================================
   DARK THEME (Default) — 3 Surface Levels & High Contrast
   ===================================================================== */
[data-bs-theme="dark"], [data-theme="dark"] {
    --bg-app: #090d16;             /* Base Background Level 0 */
    --bg-surface: #111827;         /* Card Surface Level 1 */
    --bg-surface-elevated: #162032;/* Elevated Card Surface Level 2 */
    --bg-surface-subtle: #1e293b;  /* Hover / Input Surface Level 3 */

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.14);
    --border-highlight: rgba(255, 255, 255, 0.22);

    /* Text Colors (Verified >= 4.5:1 Contrast) */
    --text-main: #f8fafc;          /* High contrast primary text (white) */
    --text-body: #cbd5e1;          /* Secondary text (light slate) */
    --text-muted: #94a3b8;         /* Subtitles & hints (5.8:1 contrast on #111827) */
    --text-subtle: #94a3b8;        /* Micro labels */

    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-body);
    --bs-card-bg: var(--bg-surface);
    --bs-border-color: var(--border-subtle);
}

/* =====================================================================
   LIGHT THEME — Clean Crisp Neutral Light Mode
   ===================================================================== */
[data-bs-theme="light"], [data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-subtle: #e2e8f0;

    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-medium: rgba(0, 0, 0, 0.14);
    --border-highlight: rgba(0, 0, 0, 0.22);

    --text-main: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-subtle: #64748b;

    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-body);
    --bs-card-bg: var(--bg-surface);
    --bs-border-color: var(--border-subtle);
}

/* =====================================================================
   GLOBAL RESET & TYPOGRAPHY
   ===================================================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-body);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-size: 0.925rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6, .fw-bold {
    color: var(--text-main);
    letter-spacing: -0.015em;
    font-variant-numeric: tabular-nums;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-main {
    color: var(--text-main) !important;
}

/* =====================================================================
   LAYOUT ARCHITECTURE
   ===================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

/* Sidebar — Full-Height Sticky */
.app-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), width 0.2s ease;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    color: var(--brand-primary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    list-style: none;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.65rem 0.75rem 0.25rem;
}

.nav-item {
    margin-bottom: 0.2rem;
}

/* Sidebar Nav Links — Minimal Tinted Active with Thin Left Indicator */
.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    position: relative;
}

.nav-link-custom i {
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.nav-link-custom:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
}

.nav-link-custom:hover i {
    color: var(--text-main);
}

.nav-link-custom.active {
    background: var(--brand-primary-subtle);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-link-custom.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--brand-primary);
    border-radius: 0 3px 3px 0;
}

.nav-link-custom.active i {
    color: var(--brand-primary);
}

.sidebar-footer {
    padding: 1rem 0.875rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    margin-top: auto; /* Pins to absolute bottom */
    flex-shrink: 0;
}

.user-sidebar-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-primary-subtle);
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-right: 0.85rem !important; /* Generous 14px right margin */
}

/* Main Workspace */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.header-toggle-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Global Search Trigger Bar */
.search-trigger-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.85rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 240px;
    transition: border-color 0.15s ease;
}

.search-trigger-btn:hover {
    border-color: var(--border-medium);
    color: var(--text-body);
}

.search-trigger-kbd {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

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

/* Action Icon Buttons */
.btn-icon-header {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-body);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    position: relative;
}

.btn-icon-header:hover {
    background: var(--bg-surface-subtle);
    color: var(--text-main);
}

.badge-header-notification {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 99px;
    line-height: 1;
}

/* Content Body */
.content-body {
    flex: 1;
    padding: 1.5rem;
}

/* Page Header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

/* =====================================================================
   BUTTONS (Fixed 18px Icon, Exact 8px Gap, Flat-Elevated Look)
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem !important;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    cursor: pointer;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    gap: 0.4rem !important;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
    gap: 0.6rem !important;
}

.btn i, .btn svg {
    font-size: 1.15em !important;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 0 !important;
}

.btn:has(> i:only-child),
.btn:has(> svg:only-child),
.btn-icon,
.btn-icon-header {
    gap: 0 !important;
    padding: 0.45rem 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:has(> i:only-child) i,
.btn:has(> svg:only-child) svg,
.btn-icon i,
.btn-icon-header i,
.stat-icon-tile i,
i.me-0, i.ms-0 {
    margin-right: 0 !important;
}

.btn-primary {
    background-color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    color: #fff;
}

.btn-outline-custom {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-medium);
    color: var(--text-body);
}

.btn-outline-custom:hover {
    background-color: var(--bg-surface-elevated);
    border-color: var(--border-highlight);
    color: var(--text-main);
}

/* =====================================================================
   CARDS & TABLES (Dark Surface Level 1 Guaranteed + Mandatory Margin)
   ===================================================================== */
.card,
.card-premium,
.filter-card {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-lg);
    box-shadow: none;
    overflow: visible;
    margin-bottom: 1.25rem !important;
}

.card-premium-header {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-premium-body {
    padding: 1.25rem;
    background-color: var(--bg-surface);
}

/* KPI Stat Cards (24px Padding, Hover Lift, Clickable Arrow, Subtle Shadow) */
.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem; /* Standard 24px padding */
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    height: 100%;
    margin-bottom: 0.75rem;
}

a:hover .stat-card,
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-medium);
    box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.08);
}

.stat-card-arrow {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0;
    transform: translate(-3px, 3px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

a:hover .stat-card-arrow {
    opacity: 1;
    transform: translate(0, 0);
    color: var(--brand-primary);
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.4rem;
}

.stat-number {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
    margin-bottom: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.stat-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Color Tokens: Slate for Neutral Lapsed, Amber High Contrast for Soon */
.text-slate { color: #64748b !important; }
[data-bs-theme="dark"] .text-slate { color: #94a3b8 !important; }

.text-amber, .text-warning {
    color: #b45309 !important; /* WCAG AA 5.2:1 against pure white */
}
[data-bs-theme="dark"] .text-amber,
[data-bs-theme="dark"] .text-warning {
    color: #fbbf24 !important;
}

/* Low-Saturation Tinted Icon Tiles */
.stat-icon-tile {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.tile-primary { background: var(--brand-primary-subtle); color: var(--brand-primary); }
.tile-emerald { background: var(--color-emerald-subtle); color: var(--color-emerald); }
.tile-amber   { background: rgba(245, 158, 11, 0.15); color: #b45309; }
[data-bs-theme="dark"] .tile-amber { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.tile-red     { background: var(--color-red-subtle); color: var(--color-red); }
.tile-sky     { background: var(--color-sky-subtle); color: var(--color-sky); }
.tile-slate   { background: rgba(148, 163, 184, 0.15); color: #64748b; }
[data-bs-theme="dark"] .tile-slate { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }

/* Readable Payment Method Badges (Icon + Name) */
.badge-method {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.22rem 0.55rem;
    border-radius: 6px;
    text-transform: capitalize;
}
.badge-method i {
    font-size: 0.85rem;
}
.method-gpay {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8 !important;
    border: 1px solid rgba(37, 99, 235, 0.25);
}
[data-bs-theme="dark"] .method-gpay {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.method-cash {
    background: rgba(16, 185, 129, 0.1);
    color: #047857 !important;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
[data-bs-theme="dark"] .method-cash {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.method-card {
    background: rgba(139, 92, 246, 0.1);
    color: #6d28d9 !important;
    border: 1px solid rgba(139, 92, 246, 0.25);
}
[data-bs-theme="dark"] .method-card {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa !important;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.method-online {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1 !important;
    border: 1px solid rgba(14, 165, 233, 0.25);
}
[data-bs-theme="dark"] .method-online {
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8 !important;
    border: 1px solid rgba(14, 165, 233, 0.3);
}
.method-phonepe {
    background: rgba(124, 58, 237, 0.1);
    color: #6d28d9 !important;
    border: 1px solid rgba(124, 58, 237, 0.25);
}
[data-bs-theme="dark"] .method-phonepe {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc !important;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.method-default {
    background: var(--bg-surface-elevated);
    color: var(--text-body) !important;
    border: 1px solid var(--border-medium);
}

/* Soft Tinted Plan Pills (No Heavy Hard Borders) */
.plan-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.65rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    border: none;
    line-height: 1.25;
}
.plan-pill-monthly {
    background: rgba(14, 165, 233, 0.12);
    color: #0284c7 !important;
}
.plan-pill-quarterly {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed !important;
}
.plan-pill-yearly, .plan-pill-annual {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309 !important;
}
.plan-pill-default {
    background: var(--bg-surface-elevated);
    color: var(--text-body) !important;
}
[data-bs-theme="dark"] .plan-pill-monthly {
    background: rgba(14, 165, 233, 0.2);
    color: #38bdf8 !important;
}
[data-bs-theme="dark"] .plan-pill-quarterly {
    background: rgba(139, 92, 246, 0.2);
    color: #c084fc !important;
}
[data-bs-theme="dark"] .plan-pill-yearly, [data-bs-theme="dark"] .plan-pill-annual {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24 !important;
}

/* Donut Chart Custom Legend */
.donut-legend-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    justify-content: center;
}
.donut-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    gap: 0.75rem;
}
.donut-legend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Fixed 8px gap between dot and text */
    color: var(--text-body);
}
.donut-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.donut-dot-active { background: #10b981; }
.donut-dot-expiring { background: #f59e0b; }
.donut-dot-lapsed { background: #94a3b8; }

/* Global Focus Ring for Keyboard Users */
:focus-visible {
    outline: 2px solid var(--brand-primary) !important;
    outline-offset: 2px !important;
}

/* Tables (Strict Dark Surface Background, Dark Borders, No White Rows) */
.table-custom-wrapper {
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-body) !important;
    background-color: var(--bg-surface) !important;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom th {
    background-color: var(--bg-surface-elevated) !important;
    color: var(--text-muted) !important;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-subtle) !important;
    white-space: nowrap;
}

.table-custom td {
    padding: 0.65rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-body) !important;
    font-size: 0.85rem;
}

.table-custom tbody tr:hover td {
    background-color: var(--bg-surface-elevated) !important;
}

.table-custom tbody tr {
    transition: background-color 0.1s ease;
}

/* Status Pills with Dot */
.badge-status {
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.2px;
}

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

.badge-success {
    background-color: var(--color-emerald-subtle);
    color: var(--color-emerald);
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.badge-warning {
    background-color: var(--color-amber-subtle);
    color: var(--color-amber);
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge-danger {
    background-color: var(--color-red-subtle);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.badge-neutral {
    background-color: var(--bg-surface-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

/* =====================================================================
   BOTTOM TAB BAR (Mobile Navigation < 992px)
   ===================================================================== */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    z-index: 1030;
    justify-content: space-around;
    align-items: center;
}

.bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
    height: 100%;
    flex: 1;
    min-height: 44px; /* Touch target */
    gap: 2px;
}

.bottom-tab-item i {
    font-size: 20px;
}

.bottom-tab-item.active {
    color: var(--brand-primary);
    font-weight: 700;
}

.bottom-tab-item.tab-center-btn {
    position: relative;
    top: -10px;
}

.center-checkin-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
    border: 2px solid var(--bg-surface);
}

/* Offcanvas Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    z-index: 1035;
}

/* =====================================================================
   RESPONSIVE OPTIMIZATIONS (360px, 390px, 412px, 768px, 1366px)
   ===================================================================== */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .sidebar-backdrop.show {
        display: block;
    }
    .header-toggle-btn {
        display: inline-flex;
    }
    .search-trigger-btn {
        min-width: 140px;
    }
    .mobile-bottom-bar {
        display: flex;
    }
    .content-body {
        padding-bottom: calc(var(--bottom-nav-height) + 1.5rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 767.98px) {
    .content-body {
        padding: 1rem 0.875rem calc(var(--bottom-nav-height) + 1.25rem + env(safe-area-inset-bottom, 0px));
    }
    .page-title {
        font-size: 1.3rem;
    }
    .stat-number {
        font-size: 1.5rem;
    }
    .stat-card {
        padding: 1rem;
    }
    .search-trigger-btn {
        min-width: 40px;
        padding: 0.45rem 0.6rem;
    }
    .search-trigger-btn span, .search-trigger-kbd {
        display: none;
    }

    /* Stacked tables for mobile view */
    .table-responsive-stack thead {
        display: none;
    }
    .table-responsive-stack, 
    .table-responsive-stack tbody, 
    .table-responsive-stack tr, 
    .table-responsive-stack td {
        display: block;
        width: 100%;
    }
    .table-responsive-stack tr {
        margin-bottom: 0.85rem;
        background: var(--bg-surface-elevated) !important;
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        padding: 0.5rem;
    }
    .table-responsive-stack td {
        text-align: right;
        padding: 0.55rem 0.75rem;
        border-bottom: 1px solid var(--border-subtle) !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: transparent !important;
    }
    .table-responsive-stack td:last-child {
        border-bottom: none !important;
    }
    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.76rem;
        text-transform: uppercase;
        color: var(--text-muted);
        text-align: left;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =====================================================================
   FORM CONTROLS & INPUTS (Consistent Dark & Light Elevated Surfaces)
   ===================================================================== */
.form-control, .form-select {
    background-color: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-main) !important;
    border-radius: var(--radius-md);
    font-size: 0.885rem;
    padding: 0.525rem 0.85rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Strict Uniform Form Control Heights (Standard 40px, Small 36px, Large 48px) */
.form-control:not(textarea), 
.form-select, 
.input-group-text, 
input[type="date"], 
input[type="text"].flatpickr-input, 
.ts-control, 
.btn {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    box-sizing: border-box !important;
    line-height: 1.2 !important;
}

.form-control-sm:not(textarea), 
.form-select-sm, 
.input-group-sm .form-control:not(textarea), 
.input-group-sm .input-group-text, 
.input-group-sm input[type="date"], 
.input-group-sm input.flatpickr-input, 
.ts-wrapper.form-select-sm .ts-control, 
.btn-sm {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
    box-sizing: border-box !important;
    line-height: 1.2 !important;
}

.form-control-lg:not(textarea), 
.form-select-lg, 
.input-group-lg .form-control:not(textarea), 
.input-group-lg .input-group-text, 
.input-group-lg input[type="date"], 
.input-group-lg input.flatpickr-input, 
.ts-wrapper.form-select-lg .ts-control, 
.btn-lg {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    box-sizing: border-box !important;
    line-height: 1.2 !important;
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-surface-elevated) !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px var(--brand-primary-subtle) !important;
    color: var(--text-main) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.75;
}

.input-group-text {
    background-color: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-muted) !important;
    border-radius: var(--radius-md);
    font-size: 0.885rem;
}

.form-check-input {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--brand-primary-subtle);
    border-color: var(--brand-primary);
}

/* Tabs Styling */
.nav-tabs {
    border-bottom: 1px solid var(--border-subtle);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--text-main);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--brand-primary) !important;
    background: transparent !important;
    border-bottom: 2px solid var(--brand-primary) !important;
}

/* =====================================================================
   PROPER PAGINATION STYLING (Windowed, Responsive, Accessible)
   ===================================================================== */
.pagination-wrapper {
    background-color: var(--bg-surface) !important;
    border-top: 1px solid var(--border-subtle) !important;
}

.pagination {
    margin-bottom: 0;
    gap: 4px;
    flex-wrap: wrap;
}

.pagination .page-item .page-link {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.55rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm) !important;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    color: var(--text-body);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    text-decoration: none;
}

.pagination .page-item:not(.active):not(.disabled) .page-link:hover {
    background-color: var(--bg-surface-subtle);
    border-color: var(--border-highlight);
    color: var(--text-main);
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.4);
}

.pagination .page-item.disabled .page-link {
    background-color: transparent !important;
    border-color: var(--border-subtle) !important;
    color: var(--text-muted) !important;
    opacity: 0.45;
    pointer-events: none;
}

/* =====================================================================
   PROPER FILTER TOOLBAR & FILTER CARD STYLING
   ===================================================================== */
.filter-card {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.filter-card-header {
    padding: 0.75rem 1.15rem;
    background-color: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.filter-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.filter-card-body {
    padding: 1rem 1.15rem;
    background-color: var(--bg-surface);
}

/* Filter Segmented Controls / Chips */
.filter-pills-bar {
    display: inline-flex;
    background-color: var(--bg-surface-elevated);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    gap: 3px;
    overflow-x: auto;
    max-width: 100%;
}

.filter-pill {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.filter-pill:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.filter-pill.active {
    background-color: var(--brand-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.35);
}

.filter-pill .pill-count {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    font-weight: 700;
}

.filter-pill:not(.active) .pill-count {
    background: var(--bg-surface-subtle);
    color: var(--text-muted);
}

/* Modals Styling */
.modal-content {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.modal-header, .modal-footer {
    border-color: var(--border-subtle) !important;
}

/* =====================================================================
   ICON SPACING UTILITIES (Better Gap between Text and Icons Everywhere)
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px !important;
}

.btn-sm {
    gap: 6px !important;
    padding: 0.38rem 0.75rem;
    font-size: 0.8rem;
}

.btn i, .btn svg {
    margin-right: 0 !important;
}

.btn:has(> i:only-child), .btn:has(> svg:only-child), .btn-icon {
    padding: 0.5rem;
    gap: 0 !important;
}

.btn-sm:has(> i:only-child), .btn-sm:has(> svg:only-child), .btn-icon.btn-sm {
    padding: 0.38rem 0.5rem;
    gap: 0 !important;
}

.breadcrumb-item i {
    margin-right: 6px;
    vertical-align: -1px;
}

.badge i {
    margin-right: 5px;
    vertical-align: -1px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item i {
    margin-right: 0 !important;
    font-size: 1.05rem;
}

.stat-meta i {
    margin-right: 4px;
}

.page-subtitle i {
    margin-right: 4px;
}

.nav-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.alert {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert i {
    font-size: 1.15rem;
    flex-shrink: 0;
}

/* =====================================================================
   DASHBOARD RESPONSIVE ENHANCEMENTS (< 768px and < 480px)
   ===================================================================== */
@media (max-width: 767.98px) {
    .stat-card {
        padding: 0.875rem 0.85rem !important;
        min-height: 80px;
    }
    .stat-label {
        font-size: 0.72rem !important;
        margin-bottom: 0.15rem !important;
    }
    .stat-number {
        font-size: clamp(1.15rem, 4vw, 1.35rem) !important;
        line-height: 1.15;
    }
    .stat-meta {
        font-size: 0.68rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .page-header {
        margin-bottom: 1.25rem !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    .page-header > div:last-child {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
    }
    .page-header > div:last-child .btn {
        flex: 0 0 auto;
        padding: 0.5rem 0.85rem;
        font-size: 0.85rem;
    }
    .filter-card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    .filter-pills-bar {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .row > [class*="col-"] {
        margin-bottom: 0.85rem;
    }
    .row > [class*="col-"]:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .stat-number {
        font-size: clamp(1rem, 3.8vw, 1.2rem) !important;
    }
    .page-title {
        font-size: 1.25rem !important;
    }
    .page-header > div:last-child .btn {
        flex: 1 1 auto;
    }
    .pagination-wrapper {
        flex-direction: column;
        align-items: center !important;
        text-align: center;
        gap: 0.75rem !important;
    }
    .pagination .page-link {
        min-width: 28px;
        height: 28px;
        font-size: 0.75rem;
        padding: 0 0.35rem;
    }
}

/* =====================================================================
   LOGIN PAGE & AUTOFILL OVERRIDES
   ===================================================================== */
.login-page-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: stretch;
    background-color: var(--bg-app);
}

/* Chrome / Safari Autofill Override (Eliminates Blue/Lilac Tint) */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-surface-elevated) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: var(--text-main) !important;
    font-size: 16px !important;
}

[data-bs-theme="light"] input:-webkit-autofill,
[data-bs-theme="light"] input:-webkit-autofill:hover, 
[data-bs-theme="light"] input:-webkit-autofill:focus, 
[data-bs-theme="light"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #f8fafc inset !important;
    -webkit-text-fill-color: #0f172a !important;
}

/* Hero Panel (Fixed Dark Surface in BOTH themes) */
.login-hero-panel {
    background: linear-gradient(145deg, #070a12 0%, #0d1322 55%, #1e1b4b 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    position: relative;
    overflow: hidden;
    padding: 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-hero-glow-1 {
    position: absolute;
    top: -80px;
    left: -80px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.login-hero-glow-2 {
    position: absolute;
    bottom: -60px;
    right: -60px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.login-hero-panel h1,
.login-hero-panel h2,
.login-hero-panel h3,
.login-hero-panel p,
.login-hero-panel span,
.login-hero-panel a {
    color: #ffffff;
}

.login-hero-panel .hero-title {
    color: #ffffff !important;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.login-hero-panel .hero-copy {
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 1.05rem;
    line-height: 1.6;
}

.login-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
}

.login-feature-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.login-feature-title {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.login-feature-desc {
    color: rgba(255, 255, 255, 0.65) !important;
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0;
}

.login-hero-footer {
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.login-hero-footer span {
    color: rgba(255, 255, 255, 0.65) !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.login-hero-footer span i {
    color: #f43f5e !important;
}

/* Right Login Form Workspace */
.login-form-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    background: radial-gradient(circle at 90% 10%, rgba(244, 63, 94, 0.06) 0%, transparent 50%), var(--bg-app);
}

[data-bs-theme="light"] .login-form-area {
    background: radial-gradient(circle at 90% 10%, rgba(244, 63, 94, 0.05) 0%, transparent 50%), #f8fafc;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 2.5rem 2.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    animation: loginCardFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-bs-theme="light"] .login-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

@keyframes loginCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card {
        animation: none !important;
    }
}

/* Input Fields Ergonomics (48px height, 12px radius, Coral Focus Ring) */
.login-input-wrap {
    position: relative;
}

.login-input {
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 16px !important; /* Prevents iOS auto-zoom */
    padding-left: 2.85rem !important;
    padding-right: 2.85rem !important;
    background-color: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-main) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

[data-bs-theme="light"] .login-input {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

.login-input:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.22) !important;
    outline: none !important;
}

.login-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
    pointer-events: none;
}

.login-input-wrap:focus-within .login-input-icon {
    color: var(--brand-primary) !important;
}

/* Password Toggle Touch Button (44px) */
.login-pwd-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.login-pwd-toggle:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Styled Checkbox */
.login-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--border-medium);
    background-color: var(--bg-surface-elevated);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.login-checkbox:checked {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.35);
}

.login-checkbox:focus {
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

/* Submit Button */
.btn-login-submit {
    height: 48px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    background-color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-login-submit:hover:not(:disabled) {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(244, 63, 94, 0.45);
}

.btn-login-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* Inline Security Alert */
.login-alert {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

[data-bs-theme="light"] .login-alert {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* Top Corner Floating Theme Toggle */
.login-theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    color: var(--text-body);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-theme-toggle:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    border-color: var(--border-highlight);
}

/* Print Styles */
@media print {
    .app-sidebar, .app-header, .mobile-bottom-bar, .d-print-none, .btn {
        display: none !important;
    }
    .app-main {
        margin: 0 !important;
        padding: 0 !important;
    }
    .content-body {
        padding: 0 !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .card-premium {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}

/* =====================================================================
   DASHBOARD ENHANCEMENTS: Period Pill Filter, Dues & Live Operations
   ===================================================================== */
.stat-card-link {
    text-decoration: none !important;
    color: inherit !important;
    display: block;
    height: 100%;
}
.stat-card-link:focus-visible .stat-card {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.period-filter-nav {
    display: inline-flex;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 3px;
}
.period-filter-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: calc(var(--radius-md) - 2px);
    border: none;
    background: transparent;
    text-decoration: none !important;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}
.period-filter-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface);
}
.period-filter-btn.active {
    background: var(--bg-surface);
    color: var(--brand-primary);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
[data-bs-theme="dark"] .period-filter-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--brand-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.ops-card-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.1s ease;
}
.ops-card-item:last-child {
    border-bottom: none;
}
.ops-card-item:hover {
    background: var(--bg-surface-elevated);
}

.progress-bar-custom {
    height: 8px;
    background: var(--bg-surface-elevated);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================================
   PREMIUM DROPDOWNS & FLATPICKR DATEPICKER CUSTOM THEMING
   ===================================================================== */

/* 1. HTML5 Standard Form Select Premium Styling */
.form-select {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    color: var(--text-main);
    border-radius: var(--radius-md);
    padding: 0.55rem 2.25rem 0.55rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 500;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23f43f5e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-select:focus {
    background-color: var(--bg-surface);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-subtle);
    color: var(--text-main);
}

.form-select option {
    background-color: var(--bg-surface);
    color: var(--text-main);
    padding: 8px 12px;
}

/* 2. TomSelect Premium Searchable Dropdown Overrides */
select.tom-select-custom,
select.tom-select,
select.select2-premium,
.ts-hidden {
    display: none !important;
}

.ts-wrapper.tom-select-custom,
.ts-wrapper.select2-premium,
.ts-wrapper.tom-select,
.ts-wrapper.form-select,
.ts-wrapper.form-select-lg {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    width: 100% !important;
}

.ts-control {
    background-color: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-main) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.65rem 0.95rem !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    box-shadow: none !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px var(--brand-primary-subtle) !important;
    background-color: var(--bg-surface) !important;
}

.ts-control input {
    color: var(--text-main) !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
}

.ts-control .item {
    color: var(--text-main) !important;
    font-weight: 600 !important;
}

.ts-control .placeholder {
    color: var(--text-muted) !important;
    font-weight: 400 !important;
}

/* Fix Dropdown Popover Z-Index & High Contrast Elevation */
.ts-dropdown {
    background-color: #162032 !important;
    border: 1px solid var(--brand-primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.75) !important;
    padding: 0.4rem !important;
    z-index: 999999 !important;
}

.ts-dropdown .option {
    padding: 0.65rem 0.95rem !important;
    border-radius: var(--radius-sm) !important;
    color: #f8fafc !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
}

.ts-dropdown .option:hover, 
.ts-dropdown .option.active {
    background-color: var(--brand-primary) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

.ts-dropdown .option.selected {
    background-color: var(--brand-primary-hover) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* 3. Profile Tab & Table Symmetry Rules */
.profile-info-table {
    width: 100%;
}

.profile-info-table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.88rem;
}

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

.bmi-scale-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 1rem;
}

@media (max-width: 575.98px) {
    .bmi-scale-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

.bmi-pill {
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-elevated);
    transition: all 0.15s ease;
}

.bmi-pill.active-bmi {
    border-color: var(--brand-primary);
    background: var(--brand-primary-subtle);
}

.bmi-pill-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bmi-pill-val {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* 4. Flatpickr Premium Datepicker Overrides */
.flatpickr-calendar {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-highlight) !important;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.45) !important;
    border-radius: var(--radius-lg) !important;
    font-family: var(--font-sans) !important;
    padding: 8px !important;
    z-index: 99999 !important;
}

.flatpickr-months {
    background: var(--bg-surface-elevated) !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    padding: 4px 0 !important;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: var(--text-main) !important;
    font-weight: 700 !important;
}

.flatpickr-weekday {
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    font-size: 0.78rem !important;
}

.flatpickr-day {
    color: var(--text-body) !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 500 !important;
}

.flatpickr-day:hover, .flatpickr-day:focus {
    background: var(--bg-surface-subtle) !important;
    color: var(--text-main) !important;
}

.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
    background: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #fff !important;
    font-weight: 700 !important;
}

.flatpickr-day.today {
    border-color: var(--brand-primary) !important;
}

/* 5. Global Padding & Spacing Perfection Across Viewports */
@media (min-width: 1200px) {
    .content-body {
        padding: 1.75rem 2.25rem !important;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .content-body {
        padding: 1.25rem 1.5rem !important;
    }
}

@media (max-width: 767.98px) {
    .content-body {
        padding: 0.85rem 0.75rem calc(var(--bottom-nav-height) + 2rem + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    .page-header {
        margin-bottom: 1rem;
        gap: 0.5rem;
    }
    
    .page-title {
        font-size: 1.25rem !important;
    }

    .stat-card {
        padding: 1rem !important;
    }

    .app-header {
        padding: 0 0.85rem !important;
    }

    /* Fixed Bottom Nav Elevation */
    .mobile-bottom-bar {
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4) !important;
    }
}

.card-premium-body {
    padding: 1.25rem 1.5rem;
}

@media (max-width: 575.98px) {
    .card-premium-body {
        padding: 0.75rem !important;
    }

    .ops-card-item {
        padding: 0.75rem;
    }

    .btn-sm {
        padding: 0.4rem 0.65rem;
        font-size: 0.78rem;
    }
}

/* Universal Avatar Right Margin & Spacing */
.user-avatar-sm,
.avatar,
.member-avatar,
td img.rounded-circle,
.table-custom img.rounded-circle {
    margin-right: 0.85rem !important; /* 14px right margin between avatar and member name */
    flex-shrink: 0;
}

/* Universal Icon-to-Text Spacing Across Non-Button Elements */
.badge i, 
.breadcrumb-item i, 
.dropdown-item i, 
.nav-link-custom i, 
.page-title i,
.page-subtitle i,
.form-label i,
.stat-label i,
.filter-card-title i,
.badge-status i,
td i, 
th i {
    margin-right: 0.45rem !important; /* Crisp 7-8px right margin */
    vertical-align: middle;
}

/* Button icons must rely on flex gap ONLY and NEVER get right margin offset */
.btn i,
.btn svg,
.btn-icon i,
.btn-icon svg,
button.btn i,
a.btn i,
.btn-sm i,
.btn-lg i {
    margin-right: 0 !important;
}

/* Status Dot Right Margin */
.badge-status-dot {
    margin-right: 0.45rem !important;
}


