/* 
   ==================================================================================
   QRP WATER - PREMIUM CRM DESIGN SYSTEM v6.0
   Mobile-First | Glassmorphism | Progressive Enhancement
   ==================================================================================
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
    /* Theme Transition */
    --transition-theme: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;

    /* Primary Brand Colors (Constant) */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.15);

    /* Neutral Palette */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic Colors (Shared) */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Dimensions */
    --sidebar-width: 280px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --touch-target: 44px;

    /* Base Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows (Light Mode Defaults) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Theme-specific variables (Default: Light Mode) */
    --bg-main: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-accent: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: rgba(99, 102, 241, 0.15);
}

/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* Fluid base font: 14px on mobile → 15px on desktop */
    font-size: clamp(14px, 1.5vw, 15px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: var(--transition-theme);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    transition: var(--transition-theme);
}

/* ==================== VISIBILITY UTILITIES ==================== */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* ==================== PAGE HEADER ACTIONS ==================== */
.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Remove margin-right from buttons inside action wrappers */
.page-header-actions .btn-primary,
.page-header-actions .btn-secondary {
    margin-right: 0 !important;
}

/* ==================== HAMBURGER TOGGLE ==================== */
.menu-toggle {
    display: flex;
    position: fixed;
    top: 0.75rem;
    left: 1rem;
    z-index: 2000;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 0;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    touch-action: manipulation;
}

.menu-toggle span {
    width: 20px;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: all var(--transition-base);
    display: block;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ==================== SIDEBAR OVERLAY ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    margin-bottom: 2rem;
    padding-left: 3.5rem;
    display: flex;
    align-items: center;
    height: 44px;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.logo:hover {
    background: rgba(255, 255, 255, 0.05);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.logo:hover .logo-icon::before {
    transform: translateX(100%);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 900;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.logo-text span {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    z-index: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.875rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    min-height: var(--touch-target);
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-base);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(4px);
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.nav-item.active::before {
    height: 80%;
}

.nav-badge {
    margin-left: auto;
    background: var(--warning);
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0 6px;
    border-radius: 99px;
    min-width: 1.2rem;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    line-height: 1;
}

.nav-badge.danger {
    background: var(--danger);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.nav-item:hover svg {
    transform: scale(1.1) rotate(-5deg);
}

/* ==================== MAIN CONTENT ==================== */
/* Mobile first: no left margin, top padding for toggle button */
.main-content {
    margin-left: 0;
    padding: 4rem 0.75rem 1.5rem;
    min-height: 100vh;
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: clamp(1.4rem, 4vw, 1.75rem);
    font-weight: 900;
    background: var(--text-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.2rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
/* ==================== STATS GRID ==================== */
/* Mobile: 2 columns → Tablet: 3 → Desktop: 4 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
    margin-bottom: 1.75rem;
}

/* ── Stat Card ── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.1rem 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.25s cubic-bezier(0.34,1.2,0.64,1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    padding-bottom: 0;
}

/* Coloured bottom accent bar */
.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 3px;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    background: var(--primary);
    transition: width 0.35s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-card:hover::after { width: 100%; }

/* Stat inner layout: icon row + details */
.stat-card-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.875rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
    z-index: 2;
}

.stat-card:hover .stat-icon { transform: scale(1.12) rotate(-6deg); }

.stat-icon.blue   { background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%); box-shadow: 0 6px 16px rgba(99,102,241,0.32); }
.stat-icon.green  { background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%); box-shadow: 0 6px 16px rgba(16,185,129,0.3);  }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%); box-shadow: 0 6px 16px rgba(245,158,11,0.3);  }
.stat-icon.red    { background: linear-gradient(135deg, #ef4444 0%, #f97316 100%); box-shadow: 0 6px 16px rgba(239,68,68,0.3);   }
.stat-icon.purple { background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%); box-shadow: 0 6px 16px rgba(168,85,247,0.3);  }
.stat-icon.cyan   { background: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%); box-shadow: 0 6px 16px rgba(6,182,212,0.3);   }

.stat-icon svg { color: white; width: 20px; height: 20px; }

.stat-details { flex: 1; min-width: 0; }

.stat-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.2rem, 3.5vw, 1.55rem);
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.2rem;
    letter-spacing: -0.03em;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: var(--bg-accent);
}

.stat-change.positive { color: var(--success); background: rgba(16,185,129,0.08); }
.stat-change.negative { color: var(--danger);  background: rgba(239,68,68,0.08);  }

/* ==================== DASHBOARD HERO BANNER ==================== */
/* ==================== PREMIUM PURE WATER HERO ==================== */
.dashboard-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2.5rem 2.8rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

/* Base Liquid Background Fill */
.dashboard-hero::before {
    content: "";
    position: absolute;
    bottom: -15%;
    left: -5%;
    width: 110%;
    height: 70%;
    background: linear-gradient(0deg, rgba(99,102,241,0.08) 0%, transparent 100%);
    border-radius: 50% / 20%;
    transform: rotate(-1deg);
    animation: liquidMove 8s ease-in-out infinite alternate;
    z-index: 0;
}

/* Crystallization Effect (Purity Sparkles) */
.dashboard-hero::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20% 40%, white 100%, transparent),
        radial-gradient(1px 1px at 50% 20%, white 100%, transparent),
        radial-gradient(1px 1px at 80% 60%, white 100%, transparent),
        radial-gradient(2px 2px at 15% 15%, rgba(255,255,255,0.4) 100%, transparent);
    background-size: 200px 200px;
    animation: sparkleSlow 10s linear infinite;
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

@keyframes liquidMove {
    0% { transform: translateY(0) rotate(-1deg); border-radius: 50% / 20%; }
    100% { transform: translateY(-15px) rotate(1deg); border-radius: 50% / 15%; }
}

@keyframes sparkleSlow {
    from { background-position: 0 0; }
    to { background-position: 0 200px; }
}

.purity-droplet {
    display: inline-flex;
    color: #6366f1;
    filter: drop-shadow(0 0 8px rgba(99,102,241,0.5));
    animation: dropPulse 3s infinite ease-in-out;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes dropPulse {
    0%, 100% { transform: translateY(0) scale(1.05); opacity: 0.8; }
    50% { transform: translateY(-5px) scale(0.95); opacity: 1; }
}

.dashboard-hero-content {
    position: relative;
    z-index: 1;
}

.dashboard-hero-greeting {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.dashboard-hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.3rem, 4vw, 1.75rem);
    font-weight: 900;
    color: #fff;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.dashboard-hero-sub {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
}

.dashboard-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    padding: 4px 10px;
    margin-top: 0.625rem;
    backdrop-filter: blur(8px);
}

/* ==================== SECTION HEADERS ==================== */
.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent-cyan) 100%);
    flex-shrink: 0;
}

/* ==================== DASHBOARD GRID ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ==================== TAB SYSTEM ENHANCEMENTS ==================== */
.tab-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-accent);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.tab-btn.active .tab-count-badge {
    background: var(--primary);
    color: white;
}

/* Secondary/Profile usage might need slight variations */
.tab-count-badge.profile-mode {
    background: var(--gray-100);
    color: var(--gray-500);
}

.tab-btn.active .tab-count-badge.profile-mode {
    background: var(--primary);
    color: white;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-all {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.05);
    transition: all var(--transition-base);
    white-space: nowrap;
    align-self: flex-start;
}

.view-all::after {
    content: '→';
    font-size: 1rem;
    transition: transform var(--transition-base);
}

.view-all:hover {
    background: rgba(99, 102, 241, 0.1);
}

.view-all:hover::after {
    transform: translateX(3px);
}

/* ==================== FILTERS & SEARCH ==================== */
.filters-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

@media (min-width: 992px) {
    .filters-container {
        flex-direction: row;
        align-items: center;
    }
}

.filter-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .filter-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }
    .filter-controls select:last-child {
        grid-column: span 2;
    }
}

.filter-select {
    padding: 0.625rem 0.75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--white);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: var(--touch-target);
    outline: none;
    font-family: 'Outfit', sans-serif;
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sidebar-text);
    pointer-events: none;
    transition: color var(--transition-base);
}

.search-input {
    width: 100% !important;
    padding: 0.625rem 1rem 0.625rem 2.5rem !important;
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--radius-md) !important;
    font-size: 1rem !important;
    background: var(--white) !important;
    transition: all var(--transition-base) !important;
    color: var(--gray-700) !important;
    min-height: var(--touch-target);
}

.search-input:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-glow) !important;
}

.card-body {
    padding: 1rem;
    color: var(--text-secondary);
}

/* ==================== BUTTONS ==================== */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.125rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-height: var(--touch-target);
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4), var(--shadow-glow);
}

.btn-primary:hover::before { opacity: 1; }

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-accent);
    border-color: var(--text-muted);
    color: var(--gray-900);
}

/* ==================== TABLES ==================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(129, 140, 248, 0.05) 100%);
}

thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.action-buttons {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    flex-wrap: nowrap;
}

/* Touch-friendly icon buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target);
    height: var(--touch-target);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    touch-action: manipulation;
}

.btn-icon:hover {
    background: var(--bg-accent);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-navigation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary) !important;
    background: var(--primary-glow) !important;
    border-radius: var(--radius-sm);
    padding: 6px;
    margin-left: 0.5rem;
    transition: all var(--transition-base);
}

.btn-navigation:hover {
    background: var(--primary) !important;
    color: white !important;
    transform: scale(1.1);
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

/* Table Density */
.table-compact tbody td {
    padding: 0.35rem 1rem !important;
    font-size: 0.8rem !important;
}

.table-compact thead th {
    padding: 0.5rem 1rem !important;
    font-size: 0.7rem !important;
}

.table-zebra tbody tr:nth-child(odd) {
    background: rgba(0, 0, 0, 0.015);
}

.table-zebra tbody tr:hover {
    background: rgba(99, 102, 241, 0.05) !important;
}

/* ==================== FORMS ==================== */
#viewPrivacy, label[for="viewPrivacy"],
#viewCompact, label[for="viewCompact"] {
    display: none;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-base);
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: var(--touch-target);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Mobile: stacked form rows */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10005; /* Render above bottom nav (9999) and floating action buttons */
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    animation: fadeIn var(--transition-base);
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

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

/* Mobile sheets slide up from bottom */
.modal-content {
    background: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-2xl);
    animation: slideUp var(--transition-slow);
    position: relative;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, transparent 100%);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
}

.close-modal {
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
    width: var(--touch-target);
    height: var(--touch-target);
    touch-action: manipulation;
}

.close-modal:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-content form {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    background: var(--bg-accent);
    flex-shrink: 0;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    width: 100%;
    justify-content: center;
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 1rem; /* Better breathing room between tabs */
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: 1.5rem; /* Ensure last tab text doesn't hit edge when scrolling */
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 0.875rem 1.25rem; /* More horizontal padding for easier click targets */
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-bottom: -2px;
    position: relative;
    white-space: nowrap;
    min-height: var(--touch-target);
    flex-shrink: 0; /* Prevents tab text from shrinking or getting cut off */
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.tab-btn:hover { color: var(--primary); background: rgba(59, 130, 246, 0.03); }
.tab-btn.active { 
    color: var(--primary); 
    background: rgba(59, 130, 246, 0.08);
    border-radius: 8px 8px 0 0;
}
.tab-btn.active::before { transform: scaleX(1); height: 4px; }

.tab-content { display: none; }

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.success { background: var(--success-bg); color: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.danger  { background: var(--danger-bg);  color: var(--danger); }
.badge.info    { background: var(--info-bg);    color: var(--info); }

/* ==================== HELPER CLASSES ==================== */
.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--gray-900);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--sidebar-text);
    font-size: 0.95rem;
}

.input-readonly {
    background: var(--gray-100) !important;
    cursor: not-allowed !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
}

.offer-banner {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.875rem;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.offer-banner strong {
    color: #9a3412;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.offer-banner p {
    color: #c2410c;
    font-size: 0.875rem;
    line-height: 1.6;
}

.terms-card {
    background: var(--bg-accent);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.terms-card h4 {
    font-size: 1rem;
    margin-bottom: 0.875rem;
    color: var(--text-primary);
}

.terms-card ol { padding-left: 1.25rem; }
.terms-card li {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Ledger: mobile single column */
.ledger-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.ledger-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    text-align: center;
    transition: all var(--transition-base);
}

.ledger-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.ledger-card p {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.ledger-card h3 {
    font-size: 1.2rem;
    font-weight: 900;
}

.form-inline {
    background: var(--bg-accent);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

/* ==================== CUSTOMER VIEW DETAILS ==================== */
.view-details-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0;
}

.details-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.details-section-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.details-section-title svg {
    width: 16px;
    height: 16px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.item-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-value-pill {
    padding: 3px 8px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
}

.item-value.highlight { color: var(--primary); }

.privacy-masked {
    background: var(--gray-300);
    color: transparent !important;
    border-radius: 6px;
    user-select: none;
}

/* ==================== COMPACT CUSTOMER CARD SYSTEM (PREMIUM) ==================== */
.customer-mobile-list.compact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
}

@media (min-width: 640px) {
    .customer-mobile-list.compact-grid { grid-template-columns: 1fr 1fr; }
}

.customer-compact-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0.85rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.customer-compact-card:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(0,0,0,0.02); }

.ccc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ccc-info { flex: 1; }

.ccc-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }

.ccc-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.ccc-meta { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.ccc-dot { width: 3px; height: 3px; background: var(--gray-300); border-radius: 50%; }

.ccc-quick-actions { display: flex; gap: 8px; }

.ccc-icon-btn {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    border: none; cursor: pointer; transition: all 0.2s;
    background: var(--bg-accent); color: var(--text-secondary);
}

.ccc-icon-btn.call { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.ccc-icon-btn.wa { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.ccc-icon-btn.edit { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.ccc-icon-btn.delete { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.ccc-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--gray-100);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ccc-footer-item { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.ccc-footer-item svg { color: var(--text-muted); }

/* REDUNDANT TOGGLE PREVIOUSLY HIDDEN - RESTORING PER USER REQUEST */
/* .menu-toggle { display: none !important; } */

/* Existing list styles for fallback */
.customer-mobile-list:not(.compact-grid) {
    color: var(--text-secondary);
    transition: all var(--transition-base);
    cursor: pointer;
    padding: 0;
    touch-action: manipulation;
}

.btn-mobile-action:active {
    background: var(--bg-accent);
    transform: scale(0.9);
}

.btn-mobile-action svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.25;
}

.btn-mobile-action[onclick*="callCustomer"] { color: var(--primary); border-color: var(--primary-glow); }
.btn-mobile-action[onclick*="editCustomer"] { color: var(--primary-dark); }
.btn-mobile-action[onclick*="cancelSubscription"],
.btn-mobile-action[onclick*="reactivateCustomer"] { color: var(--warning); border-color: var(--warning-bg); }
.btn-mobile-action[onclick*="deleteCustomer"] { color: var(--danger); border-color: var(--danger-bg); }

/* ==================== PAGE VISIBILITY ==================== */
.page {
    display: none;
    animation: fadeInPage var(--transition-base);
}

.page.active { display: block; }

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

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 10px; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    border: 2px solid var(--gray-100);
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
}

/* ==================== ANIMATIONS ==================== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

@keyframes shimmer {
    0%   { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* ==================== CONFIRMATION MODAL ==================== */
.modal-confirm-content {
    max-width: 100% !important;
    text-align: center;
    padding: 2rem 1.5rem !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.modal-confirm-icon {
    width: 64px;
    height: 64px;
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1.25rem;
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.05);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-5px); }
}

.modal-confirm-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.625rem;
    letter-spacing: -0.02em;
}

.modal-confirm-message {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.modal-confirm-actions button {
    width: 100%;
    justify-content: center;
    padding: 0.875rem 1.5rem;
}

/* Ensure dialog/confirm/prompt modals are centered and sit on top of everything */
#confirmationModal, 
#alertModal, 
#whatsappSelectorModal, 
#promptModal {
    z-index: 30000 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem !important;
}

#confirmationModal .modal-content,
#alertModal .modal-content,
#whatsappSelectorModal .modal-content,
#promptModal .modal-content {
    border-radius: var(--radius-xl) !important;
    max-width: 420px !important;
    width: 100% !important;
    margin: auto !important;
}

/* ==================== DANGER BUTTON ==================== */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    min-height: var(--touch-target);
    touch-action: manipulation;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 1rem;
    bottom: auto;
    left: 1rem;
    right: 1rem;
    z-index: 20000; /* Higher than modals (10005) and bottom nav (9999) */
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    pointer-events: none;
}

.toast {
    min-width: 0;
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    pointer-events: auto;
    animation: toastSlideIn var(--transition-bounce);
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--primary);
    animation: toastProgress 3000ms linear forwards;
}

@keyframes toastSlideIn {
    from { transform: translateY(-100%) scale(0.9); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

.toast.fadeOut {
    animation: toastFadeOut var(--transition-base) forwards;
}

@keyframes toastFadeOut {
    to { transform: scale(0.95); opacity: 0; }
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.success::after { background: var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.error .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast.error::after { background: var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast.warning::after { background: var(--warning); }
.toast.info { border-left: 4px solid var(--info); }
.toast.info .toast-icon { background: var(--info-bg); color: var(--info); }
.toast.info::after { background: var(--info); }

.toast-message {
    flex: 1;
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 600;
}

.toast-close {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-base);
    touch-action: manipulation;
}

.toast-close:hover { color: var(--gray-700); }

/* ==================== TABLET — min-width: 640px ==================== */
@media (min-width: 640px) {
    .main-content {
        padding: 4.5rem 1.25rem 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon svg {
        width: 20px;
        height: 20px;
    }

    .stat-value { font-size: 1.3rem; }
    .stat-label { font-size: 0.65rem; }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .ledger-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .page-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .card-header {
        flex-direction: row;
        align-items: center;
        padding: 1rem 1.25rem;
    }

    .search-wrapper {
        max-width: 280px;
        margin-left: auto;
    }

    .view-details-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem 1rem;
    }

    .modal {
        align-items: center;
        padding: 1rem;
    }

    .modal-content {
        border-radius: var(--radius-xl);
        max-width: 600px;
        max-height: 95vh;
        margin: auto;
    }

    .modal-confirm-content {
        border-radius: var(--radius-xl) !important;
        max-width: 420px !important;
        padding: 3rem 2rem !important;
    }

    .modal-confirm-actions {
        flex-direction: row;
    }

    .modal-confirm-actions button {
        width: auto;
        flex: 1;
    }

    .modal-footer {
        flex-direction: row;
        justify-content: flex-end;
        padding: 1.25rem 1.5rem;
    }

    .modal-footer .btn-primary,
    .modal-footer .btn-secondary {
        width: auto;
    }

    .toast-container {
        top: 1.5rem;
        bottom: auto;
        right: 1.5rem;
        left: auto;
        max-width: 420px;
    }

    .toast { min-width: 320px; }

    @keyframes toastSlideIn {
        from { transform: translateX(100%) scale(0.9); opacity: 0; }
        to   { transform: translateX(0) scale(1); opacity: 1; }
    }

    .mobile-only  { display: none; }
    .desktop-only { display: block; }
}

/* ==================== DESKTOP — min-width: 1024px ==================== */
@media (min-width: 1024px) {
    .menu-toggle {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar {
        transform: translateX(0);
        padding: 1.75rem 1.25rem;
    }

    .sidebar-header {
        padding-left: 0;
        height: auto;
        margin-bottom: 2.5rem;
    }

    .logo-icon {
        display: flex !important;
        width: 48px;
        height: 48px;
    }

    .main-content {
        margin-left: var(--sidebar-width);
        padding: 1.5rem 1.75rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.25rem;
    }

    .stat-card { padding: 1rem; }
    .stat-icon { width: 42px; height: 42px; }
    .stat-icon svg { width: 20px; height: 20px; }
    .stat-value { font-size: 1.35rem; }
    .stat-label { font-size: 0.7rem; }

    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 1.25rem;
    }

    .grid-2-col {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    @media (min-width: 768px) {
        .grid-2-col {
            grid-template-columns: 1.2fr 1fr;
        }
    }

    .card-header {
        padding: 1rem 1.5rem;
    }

    .card-body {
        padding: 1rem 1.5rem;
    }

    .search-wrapper {
        max-width: 320px;
    }

    .modal-content {
        max-width: 750px;
        border-radius: var(--radius-xl);
    }

    .modal-header {
        padding: 1.75rem 2rem;
    }

    .modal-header h2 { font-size: 1.5rem; }

    .modal-body {
        padding: 1.5rem 2rem;
    }

    .modal-content form {
        padding: 1.5rem 2rem;
    }

    .modal-footer {
        padding: 1.5rem 2rem;
    }

    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1rem;
    }

    .ledger-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .stat-card:hover { transform: translateY(-8px); }

    /* Desktop view options UX */
    #viewOptionsDropdown {
        width: 100%;
        max-width: 300px;
        padding: 1.25rem;
    }

    #preferences-page .card-body > div[style*="display: flex"] {
        gap: 1.5rem !important;
    }
}

/* ==================== WIDE DESKTOP — min-width: 1280px ==================== */
@media (min-width: 1280px) {
    .main-content {
        padding: 1.5rem 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    }
}

/* ==================== BOTTOM NAVIGATION ==================== */
/* Hidden on desktop — shown only on mobile (< 1024px) */
.bottom-nav {
    display: none;
}

@media (max-width: 1023px) {
    /* Add padding so content isn't hidden behind bottom nav */
    .main-content {
        padding-bottom: 80px;
    }

    /* Sticky Customer/Page Tabs on mobile to keep them accessible on scroll */
    .tabs {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-main);
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        padding-left: 3.5rem; /* Leave space for floating hamburger menu toggle */
        margin-left: -0.75rem; /* Align edge-to-edge with the screen */
        margin-right: -0.75rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
        border-bottom: 1.5px solid rgba(0, 0, 0, 0.08);
    }

    /* ---- Bottom Bar ---- */
    .bottom-nav {
        display: flex;
        align-items: center;
        justify-content: space-around;
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(99, 102, 241, 0.12);
        box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
        z-index: 9999 !important;
        padding: 0 4px;
        /* Safe area for iPhone home bar */
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* ---- Individual Tab Item ---- */
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        flex: 1;
        padding: 6px 4px 4px;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--sidebar-text);
        text-decoration: none;
        font-family: inherit;
        position: relative;
        transition: color var(--transition-fast);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        min-height: 56px;
    }

    .bottom-nav-item:active {
        transform: scale(0.92);
    }

    /* Icon wrapper — holds the pill highlight */
    .bn-icon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 28px;
        border-radius: 14px;
        transition: background var(--transition-fast), transform var(--transition-bounce);
    }

    .bn-label {
        font-size: 0.6rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        line-height: 1;
        transition: color var(--transition-fast);
    }

    /* Active indicator dot (tiny) at top of bar above icon */
    .bn-indicator {
        display: none;
    }

    /* ---- Active State ---- */
    .bottom-nav-item.active {
        color: var(--primary);
    }

    .bottom-nav-item.active .bn-icon {
        background: rgba(99, 102, 241, 0.12);
        transform: translateY(-2px);
    }

    .bottom-nav-item.active .bn-icon svg {
        stroke-width: 2.5;
    }

    .bottom-nav-item.active .bn-label {
        font-weight: 800;
    }

    /* ---- Centre FAB Wrapper ---- */
    .bn-fab-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        flex: 1;
        padding-bottom: 4px;
        touch-action: manipulation;
    }

    /* Lifts FAB above the bar */
    .bn-fab {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
        color: white;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45), 0 2px 8px rgba(99, 102, 241, 0.3);
        transition: all var(--transition-bounce);
        transform: translateY(-14px);
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .bn-fab:hover,
    .bn-fab:focus {
        transform: translateY(-16px) scale(1.08);
        box-shadow: 0 10px 28px rgba(99, 102, 241, 0.55);
        outline: none;
    }

    .bn-fab:active {
        transform: translateY(-12px) scale(0.94);
    }

    .bn-fab-label {
        font-size: 0.6rem;
        font-weight: 700;
        color: var(--primary);
        letter-spacing: 0.02em;
        margin-top: -10px; /* tuck under the elevated FAB */
    }

    /* ---- More Overlay ---- */
    .bn-more-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 10002; /* Render above bottom nav and floating buttons */
        opacity: 0;
        transition: opacity var(--transition-base);
    }

    .bn-more-overlay.open {
        display: block;
        opacity: 1;
    }

    /* ---- More Drawer ---- */
    .bn-more-drawer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        z-index: 10003; /* Render above overlay (10002) and bottom-nav (9999) */
        padding: 0 1.25rem 1.5rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.15);
        transform: translateY(100%);
        transition: transform var(--transition-slow);
        max-height: 85vh; /* Limit height and allow scroll on small devices */
        overflow-y: auto;
    }

    .bn-more-drawer.open {
        transform: translateY(0);
    }

    /* Pull handle */
    .bn-more-handle {
        width: 40px;
        height: 4px;
        background: var(--gray-200);
        border-radius: var(--radius-full);
        margin: 12px auto 0;
    }

    .bn-more-title {
        font-size: 0.7rem;
        font-weight: 800;
        color: var(--sidebar-text);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        margin: 1rem 0 0.875rem;
    }

    /* 3-column grid of items */
    .bn-more-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .bn-more-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding: 0.875rem 0.5rem;
        text-decoration: none;
        color: var(--gray-700);
        border: 1px solid var(--gray-100);
        border-radius: var(--radius-lg);
        background: var(--bg-accent);
        font-size: 0.75rem;
        font-weight: 700;
        transition: all var(--transition-base);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        font-family: inherit;
    }

    .bn-more-item:active {
        transform: scale(0.94);
        background: rgba(99, 102, 241, 0.07);
        border-color: rgba(99, 102, 241, 0.2);
    }

    .bn-more-item:hover {
        background: rgba(99, 102, 241, 0.06);
        border-color: rgba(99, 102, 241, 0.2);
        color: var(--primary);
    }

    .bn-more-icon {
        width: 46px;
        height: 46px;
        border-radius: var(--radius-md);
        background: white;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--gray-100);
        transition: transform var(--transition-bounce);
    }

    .bn-more-item:active .bn-more-icon {
        transform: scale(0.9);
    }

    /* Logout special style */
    .bn-more-logout {
        color: var(--danger) !important;
    }

    .bn-more-logout .bn-more-icon {
        color: var(--danger);
    }

    .bn-more-logout:hover {
        background: rgba(239, 68, 68, 0.05) !important;
        border-color: rgba(239, 68, 68, 0.2) !important;
    }
}

/* ==================== PAYMENT LOGS — MOBILE-FIRST CARDS ==================== */

/* Mobile: show cards, hide table */
.payment-mobile-list  { display: flex; flex-direction: column; gap: 0.875rem; }
.payment-desktop-table { display: none; }

/* ── Individual Payment Card ── */
.payment-card {
    background: #ffffff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
    overflow: hidden;
    position: relative;
}

.payment-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px 0 0 4px;
}

/* Top row: customer + amount */
.payment-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.payment-card-customer {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

/* Avatar circle */
.payment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.payment-customer-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.payment-order-no {
    font-size: 0.72rem;
    color: var(--sidebar-text);
    font-weight: 600;
    margin-top: 1px;
}

/* Amount badge */
.payment-amount-badge {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Meta chips row */
.payment-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.875rem;
}

.payment-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-accent);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-full);
    padding: 3px 8px;
    white-space: nowrap;
}

.payment-method-chip {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

/* Action buttons row */
.payment-card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.payment-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
}

.payment-action-view {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
}
.payment-action-view:active { background: rgba(99, 102, 241, 0.18); }

.payment-action-edit {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
}
.payment-action-edit:active { background: rgba(16, 185, 129, 0.18); }

.payment-action-delete {
    background: rgba(239, 68, 68, 0.07);
    color: var(--danger);
}
.payment-action-delete:active { background: rgba(239, 68, 68, 0.15); }

/* ── Desktop breakpoint: switch to table ── */
@media (min-width: 1024px) {
    .payment-mobile-list   { display: none; }
    .payment-desktop-table { display: block; }
}

/* Tablet: still show cards, but 2-up */
@media (min-width: 640px) and (max-width: 1023px) {
    .payment-mobile-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .payment-customer-name { max-width: 140px; }

    .payment-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }
}

/* ==================== SERVICE LOGS — MOBILE-FIRST CARDS ==================== */

/* Mobile: show cards, hide table */
.service-mobile-list   { display: flex; flex-direction: column; gap: 0.875rem; }
.service-desktop-table { display: none; }

/* ── Individual Service Card ── */
.service-card {
    background: #ffffff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
    position: relative;
    overflow: hidden;
}

/* Cyan accent strip (service brand colour) */
.service-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, #06b6d4 0%, #6366f1 100%);
    border-radius: 4px 0 0 4px;
}

/* Urgent highlight — amber left strip + warm tint */
.service-card--urgent {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.03);
}
.service-card--urgent::before {
    background: linear-gradient(180deg, #f59e0b 0%, #ef4444 100%);
}

/* Top row: customer info + service-type badge */
.service-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.service-card-customer {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    flex: 1;
}

/* Avatar */
.service-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.service-customer-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.service-order-no {
    font-size: 0.72rem;
    color: var(--sidebar-text);
    font-weight: 600;
    margin-top: 1px;
}

/* Coloured type badge (built inline via JS, CSS just shapes it) */
.service-type-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

/* Meta chip row */
.service-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.service-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-accent);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-full);
    padding: 3px 8px;
    white-space: nowrap;
}

.service-tech-chip {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.service-cost-chip {
    background: rgba(16, 185, 129, 0.07);
    border-color: rgba(16, 185, 129, 0.18);
    color: var(--success);
    font-weight: 700;
}

.service-urgent-chip {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning);
    font-weight: 800;
    animation: pulseChip 2s ease-in-out infinite;
}

@keyframes pulseChip {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

/* Work done snippet */
.service-work-done {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-accent);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.625rem;
    margin-bottom: 0.75rem;
    line-height: 1.45;
}

.service-work-done svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--sidebar-text);
}

/* Action buttons */
.service-card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.service-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
}

.service-action-view   { background: rgba(6, 182, 212, 0.08);  color: #06b6d4; }
.service-action-view:active   { background: rgba(6, 182, 212, 0.18); }

.service-action-edit   { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.service-action-edit:active   { background: rgba(16, 185, 129, 0.18); }

.service-action-delete { background: rgba(239, 68, 68, 0.07);  color: var(--danger); }
.service-action-delete:active { background: rgba(239, 68, 68, 0.15); }

/* ── Desktop: flip to table ── */
@media (min-width: 1024px) {
    .service-mobile-list   { display: none; }
    .service-desktop-table { display: block; }
}

/* ── Tablet: 2-column card grid ── */
@media (min-width: 640px) and (max-width: 1023px) {
    .service-mobile-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .service-customer-name { max-width: 130px; }

    .service-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }
}

/* ==================== COMPLAINTS — MOBILE-FIRST CARDS ==================== */

.complaint-mobile-list   { display: flex; flex-direction: column; gap: 0.875rem; }
.complaint-desktop-table { display: none; }

.complaint-card {
    background: #ffffff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

/* Rose accent strip */
.complaint-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, #ec4899 0%, #ef4444 100%);
    border-radius: 4px 0 0 4px;
}

.complaint-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.complaint-card-customer {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    flex: 1;
}

.complaint-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899 0%, #ef4444 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.complaint-customer-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.complaint-phone {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

.complaint-status-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.complaint-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.875rem;
}

.complaint-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-accent);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-full);
    padding: 3px 8px;
}

.complaint-visit-chip {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

/* 5-button grid: 3 top + 2 bottom */
.complaint-card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
}

.complaint-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.45rem 0.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.68rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 34px;
}

.complaint-action-view   { background: rgba(99,102,241,0.08);  color: var(--primary); }
.complaint-action-view:active   { background: rgba(99,102,241,0.18); }
.complaint-action-edit   { background: rgba(16,185,129,0.08);  color: var(--success); }
.complaint-action-edit:active   { background: rgba(16,185,129,0.18); }
.complaint-action-wa     { background: rgba(37,211,102,0.1);   color: #25d366; }
.complaint-action-wa:active     { background: rgba(37,211,102,0.2);  }
.complaint-action-call   { background: rgba(6,182,212,0.08);   color: #06b6d4; }
.complaint-action-call:active   { background: rgba(6,182,212,0.18);  }
.complaint-action-delete { background: rgba(239,68,68,0.07);   color: var(--danger); }
.complaint-action-delete:active { background: rgba(239,68,68,0.15); }

@media (min-width: 1024px) {
    .complaint-mobile-list   { display: none; }
    .complaint-desktop-table { display: block; }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .complaint-mobile-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .complaint-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
}

/* ==================== HISTORY — MOBILE-FIRST TIMELINE ==================== */

.history-mobile-list   { display: flex; flex-direction: column; gap: 0; }
.history-desktop-table { display: none; }

/* Timeline card */
.history-card {
    display: flex;
    gap: 0;
    position: relative;
}

/* Left: dot + vertical line */
.history-card-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 28px;
    flex-shrink: 0;
}

.history-type-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
    z-index: 1;
    transition: transform var(--transition-bounce);
}

.history-card:hover .history-type-dot { transform: scale(1.3); }

.history-line {
    width: 2px;
    flex: 1;
    background: var(--gray-100);
    margin-top: 4px;
    min-height: 20px;
}

.history-mobile-list .history-card:last-child .history-line { display: none; }

/* Right: body */
.history-card-body {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.history-card:hover .history-card-body { box-shadow: var(--shadow-md); }

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

.history-action {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-900);
    flex: 1;
    min-width: 0;
}

.history-type-chip {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.history-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 0.5rem;
}

.history-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: var(--sidebar-text);
    font-weight: 600;
    margin-bottom: 0.625rem;
}

.history-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: rgba(99,102,241,0.07);
    color: var(--primary);
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.history-view-btn:active { background: rgba(99,102,241,0.16); transform: scale(0.95); }

@media (min-width: 1024px) {
    .history-mobile-list   { display: none; }
    .history-desktop-table { display: block; }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .history-card-body { padding: 1rem; }
    .history-action    { font-size: 0.95rem; }
    .history-desc      { font-size: 0.85rem; }
}

/* ==================== PURCHASE HISTORY — MOBILE-FIRST CARDS ==================== */

.purchase-mobile-list   { display: flex; flex-direction: column; gap: 0.875rem; }
.purchase-desktop-table { display: none; }

.purchase-card {
    background: #ffffff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

/* Purple accent strip (purchase/inventory brand colour) */
.purchase-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, #a855f7 0%, #6366f1 100%);
    border-radius: 4px 0 0 4px;
}

/* Top: product icon + name + price */
.purchase-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.purchase-product-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    flex: 1;
}

.purchase-product-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(168,85,247,0.12) 0%, rgba(99,102,241,0.12) 100%);
    border: 1px solid rgba(168,85,247,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a855f7;
    flex-shrink: 0;
}

.purchase-product-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.purchase-seller {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

.purchase-price {
    font-size: 1.1rem;
    font-weight: 900;
    color: #a855f7;
    letter-spacing: -0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Stock mini-dashboard row */
.purchase-stock-row {
    display: flex;
    align-items: center;
    background: var(--bg-accent);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.75rem;
    gap: 0;
}

.purchase-stock-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.purchase-stock-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.purchase-stock-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.purchase-stock-divider {
    width: 1px;
    height: 28px;
    background: var(--gray-200);
    flex-shrink: 0;
}

/* Meta chips */
.purchase-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.875rem;
}

.purchase-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-accent);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-full);
    padding: 3px 8px;
}

.purchase-stock-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.01em;
}

.purchase-note-chip {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(168,85,247,0.05);
    border-color: rgba(168,85,247,0.15);
    color: #a855f7;
}

/* Action buttons */
.purchase-card-actions {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.5rem;
}

.purchase-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.5rem 0.4rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
}

.purchase-action-stock  { background: rgba(168,85,247,0.09); color: #a855f7; }
.purchase-action-stock:active  { background: rgba(168,85,247,0.18); }
.purchase-action-edit   { background: rgba(16,185,129,0.08);  color: var(--success); }
.purchase-action-edit:active   { background: rgba(16,185,129,0.18); }
.purchase-action-delete { background: rgba(239,68,68,0.07);   color: var(--danger); }
.purchase-action-delete:active { background: rgba(239,68,68,0.15); }

@media (min-width: 1024px) {
    .purchase-mobile-list   { display: none; }
    .purchase-desktop-table { display: block; }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .purchase-mobile-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .purchase-product-name { max-width: 140px; }
    .purchase-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
}

/* ==================== DASHBOARD ACTIVITY LISTS (Carousel) ==================== */

.dashboard-list {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0.5rem 0.25rem 1rem 0.25rem;
    -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

.dashboard-list::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

.dashboard-list-item {
    flex: 0 0 85%; /* Mobile-first: show 85% of card */
    min-width: 280px;
    max-width: 400px;
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-snap-align: center;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
    .dashboard-list-item {
        flex: 0 0 calc(50% - 0.5rem); /* Table view: 2 cards */
    }
}

@media (min-width: 1024px) {
    .dashboard-list-item {
        flex: 0 0 calc(33.333% - 0.67rem); /* Desktop: 3 cards */
    }
}

.dashboard-list-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}


.item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

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

.item-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text);
    flex-shrink: 0;
}

/* ==================== DASHBOARD SECTION LAYOUT ==================== */
.dashboard-section-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.alert-card {
    border-radius: var(--radius-lg);
    background: #fff;
    border-left: 4px solid var(--gray-200);
}

.alert-card .card-header { border-bottom: none; padding-bottom: 0.5rem; }
.alert-card.overdue { border-left-color: var(--danger); }
.alert-card.warning { border-left-color: var(--warning); }
.alert-card.info { border-left-color: var(--primary); }

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-icon {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
}

.card-icon.red { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.card-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.card-icon.blue { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.card-icon.purple { background: rgba(168, 85, 247, 0.1); color: #a855f7; }

/* Activity Timeline Mini */
.activity-timeline-mini {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding: 0.5rem;
}

.activity-item-mini {
    position: relative;
    padding: 0 0 1rem 1.25rem;
    border-left: 2px solid var(--gray-100);
}

.activity-item-mini:last-child {
    border-left-color: transparent;
    padding-bottom: 0.5rem;
}

.activity-dot-mini {
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid #fff;
    z-index: 1;
}

.activity-content-mini {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.activity-header-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.activity-action-mini {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-900);
}

.activity-time-mini {
    font-size: 0.65rem;
    color: var(--sidebar-text);
    white-space: nowrap;
}

.activity-desc-mini {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .dashboard-section-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 2rem;
    }
    .dashboard-column { 
        flex: 1; 
        min-width: 0;
    }
    .dashboard-column.track-activity { flex: 1; }
}


.item-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
}

.item-actions-mini {
    display: flex;
    gap: 0.35rem;
}

.item-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    background: var(--bg-accent);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
}

/* ==================== SERVICE REPORT UI (PREMIUM) ==================== */
.service-report-card { background: #fff; }

.report-ticket-header {
    background: linear-gradient(135deg, var(--gray-900) 0%, #1e293b 100%);
    color: white; padding: 1.5rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: relative; overflow: hidden;
}

.report-ticket-header::after {
    content: ''; position: absolute;
    top: -20px; right: -20px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,0.05); border-radius: 50%;
}

.report-id-group { display: flex; flex-direction: column; gap: 4px; }
.report-title-top { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.report-id-val { font-size: 1.25rem; font-weight: 800; }

.report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; padding: 1.5rem; }
.report-field { display: flex; flex-direction: column; gap: 4px; }
.report-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
.report-value { font-size: 0.9rem; font-weight: 600; color: var(--gray-800); }
.report-field.full-width { grid-column: 1 / -1; }
.report-section-divider { grid-column: 1 / -1; height: 1px; background: var(--gray-100); margin: 0.5rem 0; }
.report-note-box { background: var(--bg-accent); border: 1px dashed var(--gray-200); border-radius: 8px; padding: 0.75rem; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

.report-footer {
    display: flex; justify-content: flex-end; gap: 0.75rem;
    padding: 1rem 1.5rem; background: var(--bg-accent);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}


.item-detail {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.item-detail-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.item-detail-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
}

.item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.item-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.item-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--primary);
    color: white;
}

.item-btn:hover {
    background: var(--primary-dark);
}

/* Plan card icons */
.plan-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.plan-icon-intro   { color: #6366f1; background: rgba(99, 102, 241, 0.1); }
.plan-icon-starter { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.plan-icon-basic   { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.plan-icon-premium { color: #a855f7; background: rgba(168, 85, 247, 0.1); }
.plan-icon-refurbished { color: #ec4899; background: rgba(236, 72, 153, 0.1); }
.plan-icon-custom  { color: #64748b; background: rgba(100, 116, 139, 0.1); }

/* ==================== OUT STOCK CARDS ==================== */
.outstock-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.outstock-card {
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.outstock-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.outstock-card.profit::before { background: var(--success); }
.outstock-card.loss::before { background: var(--danger); }
.outstock-card.neutral::before { background: var(--warning); }

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

.outstock-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
}

.outstock-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.outstock-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.outstock-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.outstock-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--sidebar-text);
    text-transform: uppercase;
}

.outstock-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.outstock-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.outstock-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.outstock-btn {
    padding: 0.625rem;
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.outstock-btn.edit {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.outstock-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.outstock-desktop-table {
    display: none;
}

@media (min-width: 640px) {
    .outstock-mobile-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .outstock-mobile-list {
        display: none;
    }
    .outstock-desktop-table {
        display: block;
    }
}

/* ==================== CUSTOMER MOBILE LIST ==================== */

.customer-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 2rem;
}

.customer-card {
    background: #fff;
    border-radius: var(--radius-lg);
    border-right: 5px solid var(--gray-300);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.customer-card.active { border-right-color: var(--success); }
.customer-card.cancelled { border-right-color: var(--danger); }
.customer-card.pending { border-right-color: var(--warning); }

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

.customer-info h4 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
}

.customer-card-id {
    font-size: 0.72rem;
    color: var(--sidebar-text);
    font-weight: 700;
}

.customer-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: var(--bg-accent);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.customer-stat-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.customer-stat-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.customer-stat-value {
    font-size: 0.82rem;
    color: var(--text-primary);
    font-weight: 700;
}

.customer-card-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.customer-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 800;
    border: 1px solid var(--gray-100);
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.customer-card-btn:active {
    transform: scale(0.95);
    background: var(--bg-accent);
}

.customer-card-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.customer-card-btn.primary:active {
    background: var(--primary-dark);
}

@media (min-width: 640px) {
    .customer-mobile-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .customer-mobile-list { display: none; }
    .customer-desktop-table { display: block; }
}

@media (max-width: 1023px) {
    .customer-desktop-table { display: none; }
}

/* ==================== PREMIUM CUSTOMER 360 VIEW ==================== */
.profile-premium-card {
    background: var(--white);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 4px 20px -5px rgba(0,0,0,0.05);
    border: 1px solid var(--gray-100);
    margin-bottom: 0.75rem;
}

.profile-header-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.profile-avatar {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; font-weight: 800;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.profile-title-group h3 { margin: 0; font-size: 1.15rem; color: var(--gray-900); }
.profile-badges { display: flex; gap: 6px; margin-top: 2px; }

.profile-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.pd-item { display: flex; flex-direction: column; gap: 2px; }
.pd-item.full { grid-column: span 2; }
.pd-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.pd-value { font-size: 0.85rem; color: var(--gray-800); font-weight: 600; }
.pd-value.highlight { color: var(--primary); font-weight: 800; }
.pd-value.success { color: var(--success); font-weight: 800; }

/* Timeline Design */
.history-timeline {
    position: relative;
    padding-left: 24px;
    margin-top: 1rem;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 0; bottom: 0;
    width: 2px;
    background: var(--gray-100);
}

.timeline-record {
    position: relative;
    margin-bottom: 1.25rem;
    cursor: pointer;
}

.tr-marker {
    position: absolute;
    left: -24px; top: 6px;
    width: 16px; height: 16px;
    background: var(--white);
    border: 3px solid var(--gray-200);
    border-radius: 50%;
    z-index: 1;
}

.tr-marker.service { border-color: var(--primary); }
.tr-marker.success { border-color: var(--success); }
.tr-marker.warning { border-color: var(--warning); }

.tr-content {
    background: var(--bg-accent);
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    transition: all 0.2s;
}

.timeline-record:hover .tr-content { background: var(--white); box-shadow: 0 4px 12px rgba(0,0,0,0.05); transform: translateX(4px); }

.tr-header { display: flex; justify-content: space-between; margin-bottom: 0.25rem; }
.tr-type { font-weight: 800; color: var(--gray-900); font-size: 0.85rem; }
.tr-date { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.tr-body { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; line-height: 1.4; }
.tr-footer { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.tr-cost { color: var(--gray-900); font-weight: 800; }

/* History Grid / Receipt Cards */
.history-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.history-card {
    background: var(--white);
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    cursor: pointer;
    transition: all 0.2s;
}

.history-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.05); transform: translateY(-2px); }

.hc-row { display: flex; justify-content: space-between; align-items: center; }
.hc-row.top { margin-bottom: 0.75rem; }
.hc-date { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; }
.hc-receipt-tag { font-size: 0.7rem; background: var(--bg-accent); color: var(--text-muted); padding: 2px 8px; border-radius: 6px; font-family: monospace; font-weight: 600; }

.hc-amount-main { font-weight: 800; color: var(--success); font-size: 1.15rem; letter-spacing: -0.02em; }
.hc-method-pill { font-size: 0.75rem; color: var(--primary); background: rgba(99, 102, 241, 0.1); padding: 4px 10px; border-radius: 8px; font-weight: 700; text-transform: uppercase; }

.history-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--sidebar-text);
    font-size: 0.85rem;
    font-weight: 600;
}

@media (min-width: 640px) {
    .history-grid { grid-template-columns: 1fr 1fr; }
}

/* ==================== PWA INSTALL BANNER (PREMIUM) ==================== */
.pwa-banner {
    position: fixed;
    bottom: -200px; /* Hidden far below */
    left: 1rem; right: 1rem;
    background: var(--white);
    padding: 1rem 1.25rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    border: 1px solid var(--gray-100);
    transition: bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    opacity: 0;
}

.pwa-banner.active { bottom: 80px; opacity: 1; }

.pwa-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, #444ce7 100%);
    color: white;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.pwa-content { flex: 1; }
.pwa-content h4 { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--gray-900); }
.pwa-content p { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.pwa-actions { display: flex; gap: 8px; }

.pwa-btn {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.pwa-btn.primary { background: var(--primary); color: white; }
.pwa-btn.secondary { background: var(--bg-accent); color: var(--text-secondary); }

@media (min-width: 1024px) {
    .pwa-banner { left: auto; width: 320px; bottom: -200px; }
    .pwa-banner.active { bottom: 1.5rem; }
}
/* ==================== PRELOADER ==================== */
.preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.preloader-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.4);
    animation: pulse-logo 2s infinite ease-in-out;
}

.preloader-logo svg {
    width: 40px;
    height: 40px;
}

.preloader-spinner {
    width: 40px;
    height: 2px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
}

.preloader-spinner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: var(--primary);
    animation: loader-slide 1.5s infinite ease-in-out;
}

.preloader-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); box-shadow: 0 12px 24px rgba(99, 102, 241, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 20px 40px rgba(99, 102, 241, 0.2); }
}

@keyframes loader-slide {
    0% { left: -30%; }
    100% { left: 100%; }
}
/* Custom Searchable Select Styles */
.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    min-height: 42px;
}

.custom-select-trigger:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.custom-select-trigger svg {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.custom-select-container.open .custom-select-trigger svg {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: none;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

.custom-select-container.open .custom-select-menu {
    display: block;
}

.custom-select-search {
    padding: 10px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--bg-accent);
}

.custom-select-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.custom-select-options {
    max-height: 250px;
    overflow-y: auto;
}

.custom-select-option {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: background 0.2s;
    border-bottom: 1px solid rgba(0,0,0,0.02);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.custom-select-option.selected {
    background: var(--primary);
    color: #fff;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== LOGIN SCREEN PWA OVERRIDES ==================== */
.login-page .pwa-banner.active {
    bottom: 1rem !important;
}
