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

/* ==========================================
   SAMYAK CRM - ApnaIndia Premium Design System
   Netflix-Red Theme
   ========================================== */

:root {
    /* Core Colors */
    --primary: #E50914;
    --primary-hover: #f40612;
    --primary-glow: rgba(229, 9, 20, 0.45);
    --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 12px 24px -6px rgba(229, 9, 20, 0.45), 0 8px 16px -4px rgba(229, 9, 20, 0.35);
    --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.35);
    --glass-bg: rgba(20, 20, 20, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --bg-card-hover: #1a1a1a;
    --bg-input: #1e1e1e;
    --bg-surface: #181818;
    --text-main: #FFFFFF;
    --text-secondary: #e5e5e5;
    --text-muted: #808080;
    --border-color: #262626;
    --border-hover: #333;
    --sidebar-bg: linear-gradient(180deg, #0d0d0d 0%, #000 100%);
    --login-brand-bg: linear-gradient(135deg, #0a0a0a 0%, #1a0000 50%, #0d0d0d 100%);
    --header-bg: rgba(10, 10, 10, 0.85);
    --header-border-glow: rgba(229, 9, 20, 0.14);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --btn-hover-bg: rgba(255, 255, 255, 0.03);
    --panel-highlight: linear-gradient(135deg, rgba(229, 9, 20, 0.08), rgba(255, 255, 255, 0.01));

    /* Status Colors */
    --success: #46d369;
    --success-bg: rgba(70, 211, 105, 0.12);
    --warning: #f5b914;
    --warning-bg: rgba(245, 185, 20, 0.12);
    --info: #2196F3;
    --info-bg: rgba(33, 150, 243, 0.12);
    --danger: #E50914;
    --danger-bg: rgba(229, 9, 20, 0.12);
    --purple: #b87cf7;
    --purple-bg: rgba(184, 124, 247, 0.12);
    --amber: #ff9800;
    --amber-bg: rgba(255, 152, 0, 0.12);
    --whatsapp: #25D366;
    --whatsapp-bg: rgba(37, 211, 102, 0.12);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --glow: 0 0 20px var(--primary-glow);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.5);
    --radius: 8px;
    --radius-sm: 5px;
    --radius-lg: 12px;
}

/* Light Theme Overrides */
[data-theme="light"] {
    --primary-glow: rgba(229, 9, 20, 0.2);
    --bg-dark: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --bg-input: #ffffff;
    --bg-surface: #ffffff;
    --text-main: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --sidebar-bg: #ffffff;
    --login-brand-bg: linear-gradient(135deg, #f8f9fa 0%, #ffe5e5 50%, #ffffff 100%);
    --header-bg: rgba(255, 255, 255, 0.85);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --btn-hover-bg: rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(229, 9, 20, 0.08), transparent 22%),
        radial-gradient(circle at left center, rgba(255, 255, 255, 0.03), transparent 18%),
        var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.42;
    font-size: 14px;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==========================================
   LAYOUT
   ========================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: var(--transition);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(229, 9, 20, 0.1), transparent 80%);
}

.logo {
    font-size: 1.32rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.5px;
}

.logo i {
    font-size: 1.3rem;
}

.logo-sub {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

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

.nav-section-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.9rem 1rem 0.45rem;
    font-weight: 600;
    opacity: 0.85;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-size: 0.88rem;
    font-weight: 500;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.nav-link:hover {
    background: var(--hover-bg);
    color: var(--text-secondary);
    transform: translateX(2px);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(229, 9, 20, 0.18), rgba(229, 9, 20, 0.05));
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(229, 9, 20, 0.12);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--primary), #ff5a5f);
    color: white;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.user-profile:hover {
    background: var(--hover-bg);
    border-color: var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

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

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    /* Important for flex children to allow shrinking */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent 220px);
}

/* ==========================================
   HEADER
   ========================================== */
.header {
    height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 0 var(--header-border-glow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.page-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb i {
    font-size: 0.6rem;
}

.header-search {
    position: relative;
    width: 340px;
    max-width: 100%;
}

@media (max-width: 1024px) {
    .header-search {
        width: 200px;
    }
}

@media (max-width: 768px) {
    /* Hide only the TOP-BAR search on mobile — NOT filter-card searches,
       which reuse the .header-search class and must stay visible. */
    .header > .header-search {
        display: none;
    }
}

/* ─── MOBILE list-page chrome: compact KPI counters + collapsible filters ──
   Applies to Walk-ins, Follow-ups, and any page using .hero-stats-inline /
   .filter-card. Desktop (>991px) unaffected — all inside the media query. */
.pc-filter-toggle { display: none; }   /* base: hidden on desktop */

@media (max-width: 991px) {
    /* Counters → one compact, horizontally-scrollable strip so the data
       table sits higher and more records are visible. !important is needed
       because the base .hero-stats-inline rule is defined later in the file
       (equal specificity → later wins without it). */
    .hero-stats-inline {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin-left: 0 !important;
        gap: 0.5rem !important;
        padding-bottom: 0.25rem;
    }
    .hero-stat-pill {
        min-width: 0 !important;
        flex: 0 0 auto !important;
        padding: 0.45rem 0.7rem !important;
        border-radius: 10px !important;
    }
    .hero-stat-label { font-size: 0.6rem !important; letter-spacing: 0.03em !important; }
    .hero-stat-label i { font-size: 0.68rem !important; }
    .hero-stat-value { font-size: 0.98rem !important; }

    /* WhatsApp Workflow-Rules summary cards — the fixed multi-column grid
       squeezes 6 cards into the phone width and clips their labels. Turn it
       into a compact horizontal scroll strip with readable card widths. */
    .wa-ops-summary-grid {
        display: flex !important;
        grid-template-columns: none !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem !important;
        padding-bottom: 0.25rem;
    }
    .wa-ops-summary-grid > .wa-ops-summary-card {
        flex: 0 0 auto !important;
        min-width: 124px;
    }
    .wa-ops-summary-head {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.1rem !important;
    }
    .wa-ops-summary-label {
        white-space: normal !important;
        font-size: 0.6rem !important;
        line-height: 1.2 !important;
    }

    /* Collapsible filter card — the toggle button is injected by footer.js.
       Card body hides when collapsed; search box stays visible + full width. */
    .filter-card { margin-bottom: 0.75rem; }
    .filter-card.is-collapsed > .card-body { display: none; }

    .pc-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.7rem 1rem;
        margin-bottom: 0.75rem;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--text-main);
        cursor: pointer;
    }
    .pc-filter-toggle .chev { transition: transform 0.2s ease; color: var(--text-muted); }
    .pc-filter-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

    /* Filter search must show on mobile (the top-bar hide rule is now scoped
       away from it) and span the full width. Stack filter controls neatly. */
    .filter-card .header-search {
        display: block !important;
        width: 100% !important;
        margin-bottom: 0.6rem;
    }
    .filter-card form {
        gap: 0.6rem !important;
    }
    .filter-card form .form-control,
    .filter-card form .btn,
    .filter-card form a.btn {
        width: 100%;
    }
}

.header-search input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.header-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

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

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    position: relative;
    font-size: 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.header-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-main);
    background: var(--btn-hover-bg);
    transform: translateY(-1px);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.12);
}

.notification-list {
    display: flex;
    flex-direction: column;
}

.notification-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 0.9rem;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.95rem;
}

.notification-item-icon.blue { background: var(--accent); }
.notification-item-icon.yellow { background: #d4a11d; }
.notification-item-icon.red { background: var(--danger); }
.notification-item-icon.green { background: var(--success); }

.notification-item-body {
    min-width: 0;
}

.notification-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.2rem;
}

.notification-item-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.notification-item-time,
.notification-item-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.notification-item-message {
    font-size: 0.88rem;
    margin-bottom: 0.2rem;
}

.notification-item-cta {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ==========================================
   PAGE CONTENT
   ========================================== */
.page-content {
    padding: 1.25rem 1.5rem;
    flex: 1;
}

.page-section {
    display: block;
    animation: fadeIn 0.35s ease-out;
}

/* ==========================================
   STAT CARDS
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
    margin-bottom: 1.35rem;
    align-items: stretch;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.95rem 1.05rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 70%),
        var(--bg-card);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: var(--transition);
}

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

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-icon.red {
    background: var(--danger-bg);
    color: var(--primary);
}

.stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.blue {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon.yellow {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.purple {
    background: var(--purple-bg);
    color: var(--purple);
}

.stat-label {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.15rem;
}

.stat-trend {
    font-size: 0.7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--primary);
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 40%);
}

.card-header {
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.05rem 1.1rem;
}

.card-body-np {
    padding: 0;
}

.filter-card {
    margin-bottom: 1.25rem;
}

.filter-card .card-body {
    padding: 0.95rem 1.1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.006));
}

.table-footer-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.table-empty {
    text-align: center;
    padding: 2.4rem 1rem;
    color: var(--text-muted);
}

.table-empty i {
    font-size: 1.9rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

/* ==========================================
   GRID & LAYOUTS
   ========================================== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.95rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.95rem;
}

.grid-7-3 {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 0.95rem;
}

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

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.35rem;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    padding: 0.48rem 0.9rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #ff4d4f);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-accent {
    background: linear-gradient(135deg, #FF1E1E, #B20710);
    color: white !important;
    border: none !important;
    font-weight: 800 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase;
    box-shadow: var(--shadow-accent);
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-accent:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 18px 36px -8px rgba(229, 9, 20, 0.6);
    filter: brightness(1.15);
}

.btn-accent:active {
    transform: translateY(0) scale(0.98);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
}

.btn-primary:active {
    transform: translateY(1px);
}
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--glow);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #000;
}

.btn-success:hover {
    filter: brightness(1.1);
}

.btn-whatsapp {
    background: var(--whatsapp);
    color: white;
}

.btn-whatsapp:hover {
    filter: brightness(1.1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-soft-info,
.btn-soft-success,
.btn-soft-warning {
    border: 1px solid transparent;
}

.btn-soft-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(54, 162, 235, 0.24);
}

.btn-soft-info:hover {
    border-color: var(--info);
    transform: translateY(-1px);
}

.btn-soft-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.24);
}

.btn-soft-success:hover {
    border-color: var(--success);
    transform: translateY(-1px);
}

.btn-soft-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(255, 193, 7, 0.24);
}

.btn-soft-warning:hover {
    border-color: var(--warning);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0.4rem 0.7rem;
}

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

.btn-sm {
    padding: 0.3rem 0.62rem;
    font-size: 0.74rem;
}

.btn-lg {
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-toolbar-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 0.25rem;
    color: var(--text-main);
}

.page-toolbar-subtitle {
    font-size: 0.84rem;
    color: var(--text-muted);
    max-width: 720px;
    line-height: 1.45;
}

.page-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.page-toolbar-actions .badge {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

/* ==========================================
   BADGES / PILLS
   ========================================== */
.badge {
    padding: 0.16rem 0.48rem;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.26rem;
    line-height: 1.15;
    white-space: nowrap;
}

.badge-new {
    background: var(--danger-bg);
    color: var(--primary);
}

.badge-attempted {
    background: var(--amber-bg);
    color: var(--amber);
}

.badge-connected {
    background: var(--info-bg);
    color: var(--info);
}

.badge-interested {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-enrolled {
    background: var(--success-bg);
    color: var(--success);
}

.badge-lost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.badge-demo {
    background: var(--purple-bg);
    color: var(--purple);
}

.badge-walkin {
    background: var(--amber-bg);
    color: var(--amber);
}

.badge-hot {
    background: var(--danger-bg);
    color: var(--primary);
    animation: pulse-glow 2s infinite;
}

.badge-warm {
    background: var(--amber-bg);
    color: var(--amber);
}

.badge-cold {
    background: var(--info-bg);
    color: var(--info);
}

.badge-verified {
    background: var(--success-bg);
    color: var(--success);
}

.badge-unverified {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 5px var(--primary-glow);
    }

    50% {
        box-shadow: 0 0 15px var(--primary-glow);
    }
}

/* Dot indicator for badges */
.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ==========================================
   TABLES
   ========================================== */
.table-container {
    overflow-x: auto;
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

thead th {
    text-align: left;
    padding: 0.68rem 0.9rem;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
    backdrop-filter: blur(8px);
}

tbody td {
    padding: 0.62rem 0.9rem;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

tbody tr {
    transition: var(--transition-fast);
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.012);
}

tbody tr:hover {
    background: linear-gradient(90deg, rgba(229, 9, 20, 0.045), transparent);
}

tbody tr.is-clickable-row {
    cursor: pointer;
}

tbody tr.is-clickable-row td:first-child,
tbody tr[onclick] td:first-child {
    position: relative;
}

tbody tr.is-clickable-row .lead-name-text,
tbody tr[onclick] .lead-name-text {
    transition: var(--transition-fast);
}

tbody tr.is-clickable-row .lead-name-text::after,
tbody tr[onclick] .lead-name-text::after {
    content: 'Open';
    display: inline-flex;
    align-items: center;
    margin-left: 0.45rem;
    padding: 0.08rem 0.38rem;
    border: 1px solid rgba(229, 9, 20, 0.22);
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--primary);
    background: rgba(229, 9, 20, 0.08);
    opacity: 0;
    transform: translateY(-1px);
    transition: var(--transition-fast);
}

tbody tr.is-clickable-row:hover .lead-name-text,
tbody tr[onclick]:hover .lead-name-text {
    color: var(--primary);
}

tbody tr.is-clickable-row:hover .lead-name-text::after,
tbody tr[onclick]:hover .lead-name-text::after {
    opacity: 1;
}

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

.table-container table th:last-child,
.table-container table td:last-child {
    width: 112px;
    min-width: 112px;
    vertical-align: top;
}

.table-lead-name {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.lead-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.66rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), #ff4444);
}

.lead-name-text {
    font-weight: 700;
    font-size: 0.82rem;
}

.lead-phone {
    font-size: 0.71rem;
    color: var(--text-muted);
}

.table-actions {
    display: flex;
    gap: 0.3rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    max-width: none;
}

.table-action-btn {
    width: 27px;
    height: 27px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.table-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--danger-bg);
    transform: translateY(-1px);
}

.table-action-btn.whatsapp {
    color: var(--whatsapp) !important;
    border-color: rgba(37, 211, 102, 0.3);
    background: var(--whatsapp-bg);
}

.table-action-btn.whatsapp i {
    color: var(--whatsapp) !important;
}

.table-action-btn.whatsapp:hover {
    border-color: var(--whatsapp);
    background: rgba(37, 211, 102, 0.22);
}

.table-action-btn.call {
    color: var(--success) !important;
    border-color: rgba(70, 211, 105, 0.3);
    background: var(--success-bg);
}

.table-action-btn.call i {
    color: var(--success) !important;
}

.table-action-btn.call:hover {
    border-color: var(--success);
    background: rgba(70, 211, 105, 0.22);
}

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

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ==========================================
   FORMS
   ========================================== */
.form-group {
    margin-bottom: 0.95rem;
}

.form-label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.56rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.82rem;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.form-control:hover {
    border-color: var(--border-hover);
}

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

.form-control::placeholder {
    color: #555;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23808080' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.8rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-lg {
    max-width: 900px;
}

.modal-xl {
    max-width: 1100px;
}

.modal-header {
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-title {
    font-size: 0.96rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

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

.modal-body {
    padding: 1.05rem 1.1rem;
}

.modal-footer {
    padding: 0.85rem 1.1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   TABS
   ========================================== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs button.tab {
    flex-shrink: 0;
}

.tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.tab {
    padding: 0.58rem 0.9rem;
    color: var(--text-muted);
    font-size: 0.79rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
    border-radius: 8px 8px 0 0;
    position: relative;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab:hover {
    color: var(--text-main);
    text-decoration: none;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: linear-gradient(180deg, rgba(229, 9, 20, 0.09), transparent 85%);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

.tab-content > .card + .card,
.tab-content > .grid-2 + .card,
.tab-content > .grid-7-3 + .card,
.tab-content > .grid-3 + .card {
    margin-top: 1rem;
}

/* ==========================================
   KANBAN BOARD
   ========================================== */
.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    min-width: 250px;
    max-width: 270px;
    flex-shrink: 0;
}

.kanban-column-header {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-size: 0.74rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-column-header .count {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

.kanban-column-body {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 0.6rem;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.kanban-empty-state {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.kanban-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.68rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.kanban-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.kanban-card-name {
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}

.kanban-card-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.45rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.kanban-card-score {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.kanban-column-footer {
    margin-top: auto;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.kanban-column-progress {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.kanban-load-more {
    width: 100%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.58rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.kanban-load-more:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(229, 9, 20, 0.06);
}

.kanban-load-more:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Kanban column colors */
.col-new .kanban-column-header {
    background: var(--danger-bg);
    color: var(--primary);
    border: 1px solid rgba(229, 9, 20, 0.15);
}

.col-attempted .kanban-column-header {
    background: var(--amber-bg);
    color: var(--amber);
    border: 1px solid rgba(255, 152, 0, 0.15);
}

.col-connected .kanban-column-header {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(33, 150, 243, 0.15);
}

.col-interested .kanban-column-header {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 185, 20, 0.15);
}

.col-demo .kanban-column-header {
    background: var(--purple-bg);
    color: var(--purple);
    border: 1px solid rgba(184, 124, 247, 0.15);
}

.col-enrolled .kanban-column-header {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(70, 211, 105, 0.15);
}

/* ==========================================
   LEAD DETAIL PAGE
   ========================================== */
.lead-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.05rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.lead-detail-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff4444);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.lead-detail-info {
    flex: 1;
}

.lead-detail-name {
    font-size: 1.08rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.lead-detail-contact {
    color: var(--text-muted);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.4rem;
}

.lead-detail-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lead-detail-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.15rem;
}

.detail-field {
    min-width: 0;
}

.detail-field.span-2 {
    grid-column: 1 / -1;
}

.detail-field-label {
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.28rem;
    letter-spacing: 0.05em;
}

.detail-field-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.45;
}

.detail-field-value.muted {
    color: var(--text-muted);
    font-weight: 500;
}

.detail-note-box {
    font-size: 0.84rem;
    color: var(--text-main);
    background: var(--bg-input);
    padding: 0.8rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    line-height: 1.55;
}

#ivrDetailModal .modal {
    width: min(92vw, 760px);
    max-width: 760px;
    max-height: min(82vh, 700px);
    overflow: hidden;
}

#ivrDetailModal .modal-header {
    padding: 0.9rem 1rem;
}

#ivrDetailModal .modal-title {
    font-size: 0.92rem;
    font-weight: 800;
}

#ivrDetailModal .modal-body {
    padding: 0.95rem 1rem 0.85rem;
    overflow-y: auto;
}

#ivrDetailModal .modal-footer {
    padding: 0.75rem 1rem;
}

#ivrDetailModal .modal-form-section {
    margin: 0;
}

#ivrDetailModal .modal-section-title {
    font-size: 0.72rem;
    margin-bottom: 0.4rem;
    letter-spacing: 0.05em;
}

#ivrDetailModal .detail-info-grid {
    gap: 0.85rem 1rem;
}

#ivrDetailModal .detail-field-label {
    font-size: 0.66rem;
    margin-bottom: 0.16rem;
}

#ivrDetailModal .detail-field-value {
    font-size: 0.82rem;
    line-height: 1.4;
}

#ivrDetailModal .detail-note-box {
    padding: 0.7rem 0.8rem;
    font-size: 0.8rem;
}

.ivr-detail-modal {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.ivr-detail-summary {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
    padding: 0.8rem 0.9rem;
    background: linear-gradient(180deg, rgba(229, 9, 20, 0.06), rgba(229, 9, 20, 0.02));
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.ivr-detail-summary-copy {
    min-width: 0;
}

.ivr-detail-summary-kicker {
    font-size: 0.64rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.18rem;
    font-weight: 700;
}

.ivr-detail-summary-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.35;
    word-break: break-word;
}

.ivr-detail-summary-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 0.16rem;
}

.ivr-detail-summary-badges {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ivr-detail-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 29px;
    padding: 0.24rem 0.62rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.ivr-detail-badge.info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(30, 136, 229, 0.18);
}

.ivr-detail-badge.success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(40, 167, 69, 0.18);
}

.ivr-detail-badge.muted {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-muted);
    border-color: rgba(108, 117, 125, 0.16);
}

.ivr-detail-recording {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 48px;
}

#ivrDetailModal .ivr-detail-recording .btn {
    min-height: 34px;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
}

@media (max-width: 640px) {
    .ivr-detail-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .ivr-detail-summary-badges {
        justify-content: flex-start;
    }

    #ivrDetailModal .detail-info-grid {
        grid-template-columns: 1fr;
    }
}

.detail-action-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.mini-stat-card .card-body {
    text-align: center;
    padding: 1rem;
}

.mini-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.mini-stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.lead-score-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.score-hot {
    background: var(--danger-bg);
    color: var(--primary);
    border: 2px solid rgba(229, 9, 20, 0.3);
}

.score-warm {
    background: var(--warning-bg);
    color: var(--warning);
    border: 2px solid rgba(245, 185, 20, 0.3);
}

.score-cold {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 2px solid var(--border-color);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
}

.timeline-item.call::before {
    border-color: var(--success);
    background: var(--success-bg);
}

.timeline-item.whatsapp::before {
    border-color: var(--whatsapp);
    background: var(--whatsapp-bg);
}

.timeline-item.note::before {
    border-color: var(--warning);
    background: var(--warning-bg);
}

.timeline-item.status::before {
    border-color: var(--primary);
    background: var(--danger-bg);
}

.timeline-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.timeline-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.timeline-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================
   WHATSAPP CHAT UI
   ========================================== */
.chat-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 560px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.chat-list {
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.chat-list-header {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-list-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.chat-list-search {
    padding: 0.65rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-list-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.8rem;
    outline: none;
}

.chat-contact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.72rem 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.chat-contact:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chat-contact.active {
    background: var(--danger-bg);
}

.chat-contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--whatsapp), #128c7e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.chat-contact-info {
    flex: 1;
    min-width: 0;
}

.chat-contact-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.chat-contact-last {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-contact-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    align-self: flex-start;
    margin-top: 2px;
}

.chat-main {
    display: flex;
    flex-direction: column;
    background: #0d0d0d;
}

.chat-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
}

.chat-header-name {
    font-weight: 600;
    font-size: 0.92rem;
}

.chat-header-status {
    font-size: 0.72rem;
    color: var(--whatsapp);
}

.chat-messages {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    max-width: 70%;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    position: relative;
}

.chat-message.sent {
    align-self: flex-end;
    background: #005c4b;
    border-bottom-right-radius: 4px;
}

.chat-message.received {
    align-self: flex-start;
    background: var(--bg-card);
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
    margin-top: 0.25rem;
}

.chat-input-bar {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
}

.chat-input-bar input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
}

.chat-input-bar input:focus {
    border-color: var(--whatsapp);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--whatsapp);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.chat-send-btn:hover {
    filter: brightness(1.15);
}

/* ==========================================
   FILTER BAR
   ========================================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    padding: 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.filter-bar .form-control {
    width: auto;
    min-width: 160px;
    padding: 0.45rem 0.68rem;
    font-size: 0.78rem;
}

.search-input-wrap {
    position: relative;
    flex: 1 1 220px;
}

.search-input-wrap i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.search-input-wrap input {
    padding-left: 2.25rem !important;
}

/* ==========================================
   CHART PLACEHOLDERS
   ========================================== */
.chart-placeholder {
    height: 280px;
    background: linear-gradient(135deg, rgba(229, 9, 20, 0.05), rgba(229, 9, 20, 0.02));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--text-muted);
}

.chart-placeholder i {
    font-size: 2rem;
    color: var(--primary);
    opacity: 0.5;
}

/* Simple bar chart */
.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
}

.mini-bar {
    width: 8px;
    border-radius: 2px;
    background: var(--primary);
    transition: var(--transition);
    opacity: 0.6;
}

.mini-bar:hover {
    opacity: 1;
}

/* ==========================================
   PROGRESS BARS
   ========================================== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-fill.red {
    background: var(--primary);
}

.progress-fill.green {
    background: var(--success);
}

.progress-fill.blue {
    background: var(--info);
}

.progress-fill.yellow {
    background: var(--warning);
}

/* ==========================================
   FLOATING ACTION BAR
   ========================================== */
.fab-bar {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 0.5rem;
    z-index: 1500;
}

.floating-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.floating-btn:hover {
    transform: scale(1.1);
}

.floating-btn-primary {
    background: var(--primary);
}

.floating-btn-whatsapp {
    background: var(--whatsapp);
}

.floating-btn-call {
    background: var(--success);
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.8rem;
    line-height: 1.6;
}

.empty-state.compact {
    padding: 1.15rem 1rem;
}

.empty-state.compact i {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.page-intro-card .card-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-intro-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ==========================================
   LEADERBOARD
   ========================================== */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.leaderboard-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #000;
}

.rank-2 {
    background: linear-gradient(135deg, #C0C0C0, #9E9E9E);
    color: #000;
}

.rank-3 {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    color: white;
}

.rank-default {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.leaderboard-stat {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================
   AUTOMATION RULES
   ========================================== */
.rule-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: var(--transition-fast);
}

.rule-card:hover {
    border-color: var(--border-hover);
}

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

.rule-name {
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rule-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    min-width: 40px;
    flex: 0 0 40px;
    vertical-align: middle;
}

.rule-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.rule-toggle .slider {
    position: absolute;
    display: block;
    cursor: pointer;
    inset: 0;
    background: #333;
    border-radius: 22px;
    transition: var(--transition);
}

.rule-toggle .slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.rule-toggle input:checked+.slider {
    background: var(--success);
}

.rule-toggle input:checked+.slider::before {
    transform: translateX(18px);
}

.rule-conditions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.rule-pill {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.rule-if {
    background: var(--info-bg);
    color: var(--info);
}

.rule-then {
    background: var(--success-bg);
    color: var(--success);
}

.rule-arrow {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

/* ==========================================
   TOAST / ALERTS
   ========================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.25rem;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-elevated);
    animation: slideInRight 0.3s ease;
    transition: var(--transition);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--primary);
}

.toast.info {
    border-left: 3px solid var(--info);
}

.toast-icon {
    font-size: 1.1rem;
}

.toast-message {
    font-size: 0.85rem;
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.4s ease-out forwards;
}

.stagger-1 {
    animation-delay: 0.05s;
    opacity: 0;
}

.stagger-2 {
    animation-delay: 0.1s;
    opacity: 0;
}

.stagger-3 {
    animation-delay: 0.15s;
    opacity: 0;
}

.stagger-4 {
    animation-delay: 0.2s;
    opacity: 0;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-7-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        max-width: none;
    }

    .chat-container {
        grid-template-columns: 1fr;
    }

    .chat-list {
        display: none;
    }

    .page-content {
        padding: 1rem;
    }

    .header {
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .header-left {
        gap: 0.75rem;
        min-width: 0;          /* allow the title to shrink instead of pushing icons off-screen */
        flex: 1 1 auto;
    }

    /* Truncate the in-header page title to a single line on mobile. The same
       title is also shown as the <h1> below the header, so clipping it here
       loses no information and stops it from pushing the action icons (and
       the avatar) off the right edge → no more horizontal page scroll. */
    .page-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    /* Keep the action-icon cluster intact and pinned to the right. */
    .header-right {
        flex: 0 0 auto;
        gap: 0.35rem;
    }

    .lead-detail-header {
        flex-direction: column;
        align-items: stretch;
    }

    .lead-detail-actions {
        flex-wrap: wrap;
    }

    .card-header,
    .flex-between {
        align-items: flex-start;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.85rem;
    }

    .filter-bar .form-control {
        width: 100%;
    }

    .btn-group {
        width: 100%;
    }

    .btn {
        justify-content: center;
    }

    table {
        min-width: 640px;
    }

    thead th,
    tbody td {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .table-actions {
        gap: 0.25rem;
    }

    /* Mobile table → COMPACT, HORIZONTALLY-SCROLLABLE TABLE (not cards).
       Matches the .table-stack treatment so every list page is consistent. */
    table.mobile-cards {
        display: table;
        width: 100%;
        min-width: 0;          /* defeat global table{min-width:760}; scroll if wider */
    }

    table.mobile-cards thead { display: table-header-group; }
    table.mobile-cards thead th {
        padding: 0.55rem 0.6rem;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        white-space: nowrap;
        background: var(--bg-surface);
    }

    table.mobile-cards tbody { display: table-row-group; }

    table.mobile-cards tbody tr {
        display: table-row;
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: 0;
        background: transparent;
    }

    table.mobile-cards tbody td {
        display: table-cell;
        width: auto;
        max-width: none;
        min-width: 0;
        padding: 0.55rem 0.6rem;
        text-align: left;
        vertical-align: middle;
        border: 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Drop the card-style "LABEL:" pseudo-elements in table mode */
    table.mobile-cards tbody td::before { content: none !important; display: none !important; }

    #leadsTable.mobile-cards tbody td:nth-child(1)::before { content: "Select"; }
    #leadsTable.mobile-cards tbody td:nth-child(2)::before { content: "Lead"; }
    #leadsTable.mobile-cards tbody td:nth-child(3)::before { content: "Source"; }
    #leadsTable.mobile-cards tbody td:nth-child(4)::before { content: "Course"; }
    #leadsTable.mobile-cards tbody td:nth-child(5)::before { content: "Status"; }
    #leadsTable.mobile-cards tbody td:nth-child(6)::before { content: "Assigned"; }
    #leadsTable.mobile-cards tbody td:nth-child(7)::before { content: "Created"; }
    #leadsTable.mobile-cards tbody td:nth-child(8)::before { content: "Actions"; }

    #demosTable.mobile-cards tbody td:nth-child(1)::before { content: "Lead"; }
    #demosTable.mobile-cards tbody td:nth-child(2)::before { content: "Phone"; }
    #demosTable.mobile-cards tbody td:nth-child(3)::before { content: "Course"; }
    #demosTable.mobile-cards tbody td:nth-child(4)::before { content: "Date"; }
    #demosTable.mobile-cards tbody td:nth-child(5)::before { content: "Time"; }
    #demosTable.mobile-cards tbody td:nth-child(6)::before { content: "Faculty"; }
    #demosTable.mobile-cards tbody td:nth-child(7)::before { content: "Mode"; }
    #demosTable.mobile-cards tbody td:nth-child(8)::before { content: "Status"; }
    #demosTable.mobile-cards tbody td:nth-child(9)::before { content: "Actions"; }

    /* Follow-ups page — three tabs, three tables, mobile-card labels */
    #followupsTodayTable.mobile-cards tbody td:nth-child(1)::before { content: "Lead"; }
    #followupsTodayTable.mobile-cards tbody td:nth-child(2)::before { content: "Phone"; }
    #followupsTodayTable.mobile-cards tbody td:nth-child(3)::before { content: "Follow-up Time"; }
    #followupsTodayTable.mobile-cards tbody td:nth-child(4)::before { content: "Type"; }
    #followupsTodayTable.mobile-cards tbody td:nth-child(5)::before { content: "Assigned To"; }
    #followupsTodayTable.mobile-cards tbody td:nth-child(6)::before { content: "Status"; }
    #followupsTodayTable.mobile-cards tbody td:nth-child(7)::before { content: "Actions"; }

    #followupsOverdueTable.mobile-cards tbody td:nth-child(1)::before { content: "Select"; }
    #followupsOverdueTable.mobile-cards tbody td:nth-child(2)::before { content: "Lead"; }
    #followupsOverdueTable.mobile-cards tbody td:nth-child(3)::before { content: "Phone"; }
    #followupsOverdueTable.mobile-cards tbody td:nth-child(4)::before { content: "Was Due"; }
    #followupsOverdueTable.mobile-cards tbody td:nth-child(5)::before { content: "Type"; }
    #followupsOverdueTable.mobile-cards tbody td:nth-child(6)::before { content: "Assigned To"; }
    #followupsOverdueTable.mobile-cards tbody td:nth-child(7)::before { content: "Overdue"; }
    #followupsOverdueTable.mobile-cards tbody td:nth-child(8)::before { content: "Actions"; }

    #followupsUpcomingTable.mobile-cards tbody td:nth-child(1)::before { content: "Lead"; }
    #followupsUpcomingTable.mobile-cards tbody td:nth-child(2)::before { content: "Phone"; }
    #followupsUpcomingTable.mobile-cards tbody td:nth-child(3)::before { content: "Scheduled For"; }
    #followupsUpcomingTable.mobile-cards tbody td:nth-child(4)::before { content: "Type"; }
    #followupsUpcomingTable.mobile-cards tbody td:nth-child(5)::before { content: "Assigned To"; }
    #followupsUpcomingTable.mobile-cards tbody td:nth-child(6)::before { content: "Actions"; }

    #studentsTable.mobile-cards tbody td:nth-child(1)::before { content: "Select"; }
    #studentsTable.mobile-cards tbody td:nth-child(2)::before { content: "Student"; }
    #studentsTable.mobile-cards tbody td:nth-child(3)::before { content: "Roll No."; }
    #studentsTable.mobile-cards tbody td:nth-child(4)::before { content: "Course"; }
    #studentsTable.mobile-cards tbody td:nth-child(5)::before { content: "Batch"; }
    #studentsTable.mobile-cards tbody td:nth-child(6)::before { content: "Branch"; }
    #studentsTable.mobile-cards tbody td:nth-child(7)::before { content: "Fee Status"; }
    #studentsTable.mobile-cards tbody td:nth-child(8)::before { content: "Join Date"; }
    #studentsTable.mobile-cards tbody td:nth-child(9)::before { content: "Actions"; }

    #feesTable.mobile-cards tbody td:nth-child(1)::before { content: "Select"; }
    #feesTable.mobile-cards tbody td:nth-child(2)::before { content: "Student"; }
    #feesTable.mobile-cards tbody td:nth-child(3)::before { content: "Receipt"; }
    #feesTable.mobile-cards tbody td:nth-child(4)::before { content: "Course"; }
    #feesTable.mobile-cards tbody td:nth-child(5)::before { content: "Amount"; }
    #feesTable.mobile-cards tbody td:nth-child(6)::before { content: "Mode"; }
    #feesTable.mobile-cards tbody td:nth-child(7)::before { content: "Date"; }
    #feesTable.mobile-cards tbody td:nth-child(8)::before { content: "Balance"; }
    #feesTable.mobile-cards tbody td:nth-child(9)::before { content: "Next Due"; }
    #feesTable.mobile-cards tbody td:nth-child(10)::before { content: "Status"; }
    #feesTable.mobile-cards tbody td:nth-child(11)::before { content: "Actions"; }

    #walkinsTable.mobile-cards tbody td:nth-child(1)::before { content: "Select"; }
    #walkinsTable.mobile-cards tbody td:nth-child(2)::before { content: "Visitor"; }
    #walkinsTable.mobile-cards tbody td:nth-child(3)::before { content: "Time"; }
    #walkinsTable.mobile-cards tbody td:nth-child(4)::before { content: "Course"; }
    #walkinsTable.mobile-cards tbody td:nth-child(5)::before { content: "Source"; }
    #walkinsTable.mobile-cards tbody td:nth-child(6)::before { content: "Counselor"; }
    #walkinsTable.mobile-cards tbody td:nth-child(7)::before { content: "Purpose"; }
    #walkinsTable.mobile-cards tbody td:nth-child(8)::before { content: "Outcome"; }
    #walkinsTable.mobile-cards tbody td:nth-child(9)::before { content: "Actions"; }

    #admissionsTable.mobile-cards tbody td:nth-child(1)::before { content: "Select"; }
    #admissionsTable.mobile-cards tbody td:nth-child(2)::before { content: "Student"; }
    #admissionsTable.mobile-cards tbody td:nth-child(3)::before { content: "Roll No."; }
    #admissionsTable.mobile-cards tbody td:nth-child(4)::before { content: "Course"; }
    #admissionsTable.mobile-cards tbody td:nth-child(5)::before { content: "Mode"; }
    #admissionsTable.mobile-cards tbody td:nth-child(6)::before { content: "Batch"; }
    #admissionsTable.mobile-cards tbody td:nth-child(7)::before { content: "Fee Paid"; }
    #admissionsTable.mobile-cards tbody td:nth-child(8)::before { content: "Balance"; }
    #admissionsTable.mobile-cards tbody td:nth-child(9)::before { content: "Admission Date"; }
    #admissionsTable.mobile-cards tbody td:nth-child(10)::before { content: "Actions"; }

    #teamTable.mobile-cards tbody td:nth-child(1)::before { content: "User"; }
    #teamTable.mobile-cards tbody td:nth-child(2)::before { content: "Email"; }
    #teamTable.mobile-cards tbody td:nth-child(3)::before { content: "Role"; }
    #teamTable.mobile-cards tbody td:nth-child(4)::before { content: "Branch"; }
    #teamTable.mobile-cards tbody td:nth-child(5)::before { content: "Status"; }
    #teamTable.mobile-cards tbody td:nth-child(6)::before { content: "Last Active"; }
    #teamTable.mobile-cards tbody td:nth-child(7)::before { content: "Actions"; }

    #tab-fu-today table.mobile-cards tbody td:nth-child(1)::before { content: "Lead"; }
    #tab-fu-today table.mobile-cards tbody td:nth-child(2)::before { content: "Phone"; }
    #tab-fu-today table.mobile-cards tbody td:nth-child(3)::before { content: "Follow-up"; }
    #tab-fu-today table.mobile-cards tbody td:nth-child(4)::before { content: "Type"; }
    #tab-fu-today table.mobile-cards tbody td:nth-child(5)::before { content: "Assigned"; }
    #tab-fu-today table.mobile-cards tbody td:nth-child(6)::before { content: "Status"; }
    #tab-fu-today table.mobile-cards tbody td:nth-child(7)::before { content: "Actions"; }

    #tab-fu-overdue table.mobile-cards tbody td:nth-child(1)::before { content: "Lead"; }
    #tab-fu-overdue table.mobile-cards tbody td:nth-child(2)::before { content: "Phone"; }
    #tab-fu-overdue table.mobile-cards tbody td:nth-child(3)::before { content: "Was Due"; }
    #tab-fu-overdue table.mobile-cards tbody td:nth-child(4)::before { content: "Type"; }
    #tab-fu-overdue table.mobile-cards tbody td:nth-child(5)::before { content: "Assigned"; }
    #tab-fu-overdue table.mobile-cards tbody td:nth-child(6)::before { content: "Status"; }
    #tab-fu-overdue table.mobile-cards tbody td:nth-child(7)::before { content: "Actions"; }

    #tab-fu-upcoming table.mobile-cards tbody td:nth-child(1)::before { content: "Lead"; }
    #tab-fu-upcoming table.mobile-cards tbody td:nth-child(2)::before { content: "Phone"; }
    #tab-fu-upcoming table.mobile-cards tbody td:nth-child(3)::before { content: "Scheduled"; }
    #tab-fu-upcoming table.mobile-cards tbody td:nth-child(4)::before { content: "Type"; }
    #tab-fu-upcoming table.mobile-cards tbody td:nth-child(5)::before { content: "Assigned"; }
    #tab-fu-upcoming table.mobile-cards tbody td:nth-child(6)::before { content: "Actions"; }
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-body {
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 100vh;
}

.login-brand {
    background: var(--login-brand-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 3rem;
}

.login-brand-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(229, 9, 20, 0.15), transparent 60%);
}

.login-brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.login-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-logo i {
    margin-right: 0.5rem;
}

.login-logo-sub {
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.login-tagline {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.login-tagline span {
    color: var(--primary);
}

.login-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-feature i {
    color: var(--success);
    font-size: 0.8rem;
}

.login-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg-card);
}

.login-form-inner {
    width: 100%;
    max-width: 420px;
}

.login-form-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.login-form-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 2rem;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i:first-child {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.input-icon-wrap .form-control {
    padding-left: 2.5rem;
}

.input-icon-right {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
}

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

.login-forgot {
    color: var(--primary);
    font-size: 0.82rem;
    text-decoration: none;
    font-weight: 500;
}

.login-forgot:hover {
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    font-size: 0.95rem;
}

.login-footer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 2rem;
}

.otp-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.otp-box {
    width: 50px;
    height: 54px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

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

@media (max-width: 768px) {
    .login-container {
        grid-template-columns: 1fr;
    }

    .login-brand {
        display: none;
    }
}

/* ==========================================
   PROFILE DROPDOWN
   ========================================== */
.profile-dropdown-wrap {
    position: relative;
}

.header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: white;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevated);
    z-index: 2000;
    display: none;
    animation: fadeIn 0.2s ease;
    overflow: hidden;
}

.profile-dropdown.active {
    display: block;
}

.profile-dropdown-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.profile-dropdown-item:hover {
    background: var(--hover-bg);
    color: var(--text-main);
}

.profile-dropdown-item.text-danger {
    color: var(--primary);
}

.profile-dropdown-item.text-danger:hover {
    background: var(--danger-bg);
}

.profile-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
}

/* ==========================================
   HAMBURGER / MOBILE MENU
   ========================================== */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* PWA in-app Back button (shown by pc-back.js, mainly in standalone PWA
   and on mobile where there is no browser back chrome). */
.header-back-btn {
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.header-back-btn:hover { border-color: var(--brand-plum-light, #9D4C8A); }
.header-back-btn:active { transform: translateY(1px); }
.header-back-btn i { font-size: 0.85rem; }
/* On very narrow screens drop the text label, keep the chevron. */
@media (max-width: 480px) {
    .header-back-btn .header-back-label { display: none; }
    .header-back-btn { padding: 0.4rem 0.55rem; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

@media (max-width: 991px) {
    /* Hamburger needs to appear whenever the sidebar is auto-hidden.
       The sidebar slides off at 991px (see "MOBILE & RESPONSIVE REFINEMENTS" block
       around line 4774) — without this rule, 769–991px viewports (e.g. 150% zoom
       on 1440-wide laptops) had no way to re-open the menu. */
    .hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

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

    .sidebar.open {
        transform: translateX(0);
        z-index: 1000;
    }
}

/* ==========================================
   DOCUMENT CARDS
   ========================================== */
.doc-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    text-align: center;
    transition: var(--transition-fast);
}

.doc-card:hover {
    border-color: var(--border-hover);
}

.doc-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.doc-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.doc-status {
    font-size: 0.72rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.doc-status.uploaded {
    color: var(--success);
}

.doc-status.pending {
    color: var(--warning);
}

/* ==========================================
   STAGE LIST (DRAG REORDER)
   ========================================== */
.stage-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stage-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: var(--transition-fast);
}

.stage-item:hover {
    border-color: var(--border-hover);
}

.stage-item.dragging {
    opacity: 0.4;
    border-style: dashed;
}

.stage-drag {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stage-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.stage-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
}

.stage-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--hover-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

/* ==========================================
   PERMISSION MATRIX
   ========================================== */
.permission-matrix td,
.permission-matrix th {
    text-align: center;
    padding: 0.7rem 0.85rem;
}

.permission-matrix td:first-child,
.permission-matrix th:first-child {
    text-align: left;
    min-width: 160px;
}

.permission-matrix input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ==========================================
   UX REFINEMENT PASS
   ========================================== */
:root {
    --shell-glow: radial-gradient(circle at top left, rgba(229, 9, 20, 0.1), transparent 28%);
    --shell-glow-secondary: radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.05), transparent 20%);
    --glass-border: rgba(255, 255, 255, 0.06);
    --card-shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.24);
    --card-shadow-strong: 0 20px 48px rgba(0, 0, 0, 0.36);
    --radius-xl: 18px;
}

[data-theme="light"] {
    --glass-border: rgba(15, 23, 42, 0.08);
    --card-shadow-soft: 0 14px 34px rgba(15, 23, 42, 0.08);
    --card-shadow-strong: 0 20px 48px rgba(15, 23, 42, 0.12);
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 28%),
        var(--shell-glow),
        var(--shell-glow-secondary);
    z-index: -1;
}

a,
button,
.btn,
.tab,
.nav-link,
.table-action-btn,
.header-btn,
.modal-close,
.chat-contact,
.stage-item,
.user-profile {
    transition: var(--transition-fast);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.tab:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid rgba(229, 9, 20, 0.4);
    outline-offset: 2px;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 12%),
        linear-gradient(180deg, #0b0b0c 0%, #101012 48%, #070708 100%);
    box-shadow: 22px 0 42px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .sidebar {
    background:
        linear-gradient(180deg, rgba(229, 9, 20, 0.04), transparent 14%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 18px 0 36px rgba(15, 23, 42, 0.08);
}

.sidebar-header {
    padding: 1.4rem 1.25rem 1.2rem;
    background:
        linear-gradient(180deg, rgba(229, 9, 20, 0.16), rgba(229, 9, 20, 0.03) 55%, transparent 100%);
}

.logo {
    gap: 0.75rem;
}

.logo i {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(229, 9, 20, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-menu {
    padding: 1rem 0.85rem;
}

.nav-section-label {
    padding-top: 1.1rem;
    padding-bottom: 0.5rem;
}

.nav-link {
    min-height: 44px;
    border: 1px solid transparent;
}

.nav-link:hover {
    transform: translateX(4px);
    border-color: var(--glass-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    border-color: rgba(229, 9, 20, 0.22);
    box-shadow: 0 10px 24px rgba(229, 9, 20, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-badge {
    box-shadow: 0 6px 18px rgba(229, 9, 20, 0.22);
}

.user-profile {
    padding: 0.75rem 0.85rem;
    border: 1px solid transparent;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.user-profile:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.main-content {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 240px),
        linear-gradient(135deg, rgba(255, 255, 255, 0.01), transparent 48%),
        transparent;
}

.header {
    height: 72px;
    padding: 0 1.5rem 0 1.35rem;
    border-bottom-color: var(--glass-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.header-left {
    gap: 1rem;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.header-search input {
    min-height: 42px;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        var(--bg-input);
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        rgba(255, 255, 255, 0.015);
}

.header-btn:hover {
    box-shadow: var(--shadow-card);
}

.profile-dropdown {
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow-strong);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(18px);
}

.page-content {
    padding: 1.35rem 1.5rem 1.6rem;
}

.page-section {
    display: block;
}

.stats-grid,
.grid-2,
.grid-3,
.grid-7-3,
.mini-stats-grid {
    gap: 1rem;
}

.card {
    position: relative;
    border-radius: 16px;
    border-color: var(--glass-border);
    box-shadow: var(--card-shadow-soft);
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 32%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.012), transparent 55%),
        var(--bg-card);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    pointer-events: none;
}

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

.card-header {
    padding: 1rem 1.15rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.card-title {
    font-size: 0.98rem;
    font-weight: 800;
}

.card-body {
    padding: 1.15rem;
}

.page-intro-card .card-body,
.filter-card .card-body {
    background:
        linear-gradient(135deg, rgba(229, 9, 20, 0.06), rgba(255, 255, 255, 0.015) 48%, transparent 100%);
}

.stat-card {
    min-height: 132px;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    border-color: var(--glass-border);
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -18px;
    bottom: -26px;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.09), transparent 68%);
    opacity: 0.45;
    pointer-events: none;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stat-value {
    font-size: 1.55rem;
}

.page-toolbar {
    margin-bottom: 1.15rem;
}

.page-toolbar-title {
    font-size: 1.28rem;
}

.page-toolbar-subtitle {
    font-size: 0.87rem;
    max-width: 760px;
}

.btn {
    min-height: 38px;
    padding: 0.56rem 0.98rem;
    border-radius: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    box-shadow: 0 12px 24px rgba(229, 9, 20, 0.2);
}

.btn-outline,
.btn-ghost,
.btn-soft-info,
.btn-soft-success,
.btn-soft-warning {
    border-color: var(--glass-border);
}

.tabs {
    gap: 0.5rem;
    padding: 0.35rem;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        var(--bg-card);
    margin-bottom: 1rem;
    box-shadow: var(--card-shadow-soft);
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

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

.tab {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.7rem 1rem;
    flex: 0 0 auto;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: var(--glass-border);
}

.tab.active {
    border-bottom-color: transparent;
    border-color: rgba(229, 9, 20, 0.18);
    box-shadow: 0 10px 20px rgba(229, 9, 20, 0.1);
    background:
        linear-gradient(135deg, rgba(229, 9, 20, 0.16), rgba(229, 9, 20, 0.04) 65%, transparent 100%);
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 18px;
    border-color: var(--glass-border);
    box-shadow: var(--card-shadow-soft);
    background:
        linear-gradient(135deg, rgba(229, 9, 20, 0.05), rgba(255, 255, 255, 0.02) 45%, transparent 100%),
        var(--bg-card);
}

.filter-bar .search-input-wrap {
    grid-column: span 2;
}

.filter-bar .form-control {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    border-radius: 12px;
}

.filter-bar .btn,
.filter-bar a.btn {
    justify-content: center;
}

.form-label {
    margin-bottom: 0.42rem;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.form-control {
    min-height: 42px;
    border-radius: 12px;
    border-color: var(--glass-border);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        var(--bg-input);
}

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

textarea.form-control {
    min-height: 112px;
}

.table-container {
    border-radius: 0 0 16px 16px;
}

table {
    min-width: 760px;
}

thead th {
    padding: 0.78rem 0.9rem;
    border-bottom-color: var(--glass-border);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

tbody td {
    padding: 0.72rem 0.9rem;
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.018);
}

tbody tr:hover {
    background:
        linear-gradient(90deg, rgba(229, 9, 20, 0.06), rgba(255, 255, 255, 0.02) 56%, transparent);
}

.table-actions {
    gap: 0.35rem;
}

.table-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border-color: var(--glass-border);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        rgba(255, 255, 255, 0.015);
}

.table-action-btn:hover {
    box-shadow: 0 10px 18px rgba(229, 9, 20, 0.12);
}

.lead-avatar,
.chat-contact-avatar,
.header-avatar,
.user-avatar {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 18px rgba(0, 0, 0, 0.16);
}

.timeline {
    padding-left: 1.8rem;
}

.timeline::before {
    left: 8px;
    background: linear-gradient(180deg, rgba(229, 9, 20, 0.22), var(--border-color));
}

.timeline-item {
    padding-left: 1.7rem;
}

.timeline-item::before {
    left: -1.48rem;
    width: 14px;
    height: 14px;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.015);
}

.chat-container,
.rule-card,
.stage-item {
    border-color: var(--glass-border);
    box-shadow: var(--card-shadow-soft);
}

.modal-overlay {
    background: rgba(2, 6, 23, 0.68);
    backdrop-filter: blur(10px);
}

.modal {
    border-radius: 20px;
    border-color: var(--glass-border);
    box-shadow: var(--card-shadow-strong);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 22%),
        var(--bg-card);
}

.modal-header {
    padding: 1.05rem 1.2rem;
    background:
        linear-gradient(135deg, rgba(229, 9, 20, 0.08), rgba(255, 255, 255, 0.015) 45%, transparent 100%);
}

.modal-title {
    font-size: 1rem;
    font-weight: 800;
}

.modal-body {
    padding: 1.15rem 1.2rem;
}

.modal-footer {
    padding: 0.95rem 1.2rem;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
}

.empty-state {
    padding: 3.4rem 1.25rem;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 800;
}

.login-body {
    background:
        radial-gradient(circle at top left, rgba(229, 9, 20, 0.14), transparent 28%),
        linear-gradient(135deg, #09090b 0%, #111113 46%, #070708 100%);
}

.login-brand {
    background:
        radial-gradient(circle at 22% 30%, rgba(229, 9, 20, 0.18), transparent 32%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05), transparent 24%),
        var(--login-brand-bg);
}

.login-brand-content {
    max-width: 470px;
}

.login-tagline {
    font-size: 2.45rem;
    letter-spacing: -0.04em;
}

.login-form-wrap {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 22%),
        var(--bg-card);
}

.login-form-inner {
    max-width: 440px;
    padding: 2rem;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--card-shadow-strong);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 20%),
        var(--bg-surface);
}

.login-form-title {
    font-size: 1.75rem;
    letter-spacing: -0.03em;
}

.login-form-subtitle {
    line-height: 1.6;
}

#loginMessage {
    border: 1px solid var(--glass-border);
}

@media (max-width: 1200px) {
    .filter-bar .search-input-wrap {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .header {
        height: 68px;
        padding: 0 0.95rem;
    }

    .page-content {
        padding: 1rem 0.95rem 1.25rem;
    }

    .tabs {
        padding: 0.3rem;
        gap: 0.35rem;
    }

    .tab {
        width: 100%;
        text-align: center;
    }

    .filter-bar {
        grid-template-columns: 1fr;
        padding: 0.85rem;
    }

    .filter-bar .search-input-wrap {
        grid-column: span 1;
    }

    .login-brand {
        min-height: 42vh;
        padding: 2rem 1.25rem;
    }

    .login-form-wrap {
        padding: 1.1rem;
    }

    .login-form-inner {
        padding: 1.35rem;
        border-radius: 18px;
    }
}

/* ==========================================
   CLASSIC ENTERPRISE UI OVERRIDES
   ========================================== */
:root {
    --primary: #c62828;
    --primary-hover: #b71c1c;
    --primary-glow: rgba(198, 40, 40, 0.14);
    --bg-dark: #f3f5f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --bg-surface: #f8fafc;
    --text-main: #111827;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #d9e2ec;
    --border-hover: #c5d0dd;
    --sidebar-bg: linear-gradient(180deg, #17212f 0%, #111827 100%);
    --header-bg: rgba(255, 255, 255, 0.94);
    --hover-bg: rgba(15, 23, 42, 0.04);
    --btn-hover-bg: rgba(15, 23, 42, 0.04);
    --panel-highlight: linear-gradient(180deg, rgba(198, 40, 40, 0.04), transparent 70%);
    --glass-border: rgba(15, 23, 42, 0.06);
    --card-shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
    --card-shadow-strong: 0 14px 34px rgba(15, 23, 42, 0.1);
    --success: #15803d;
    --success-bg: rgba(21, 128, 61, 0.08);
    --warning: #b45309;
    --warning-bg: rgba(180, 83, 9, 0.1);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 235, 0.08);
    --danger: #c62828;
    --danger-bg: rgba(198, 40, 40, 0.08);
    --purple: #6d28d9;
    --purple-bg: rgba(109, 40, 217, 0.08);
    --amber: #d97706;
    --amber-bg: rgba(217, 119, 6, 0.1);
}

[data-theme="dark"] {
    --primary: #ef4444;
    --primary-hover: #dc2626;
    --primary-glow: rgba(239, 68, 68, 0.16);
    --bg-dark: #0f172a;
    --bg-card: #111827;
    --bg-card-hover: #172033;
    --bg-input: #0f172a;
    --bg-surface: #172033;
    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #243244;
    --border-hover: #334155;
    --sidebar-bg: linear-gradient(180deg, #0b1220 0%, #111827 100%);
    --header-bg: rgba(15, 23, 42, 0.9);
    --hover-bg: rgba(255, 255, 255, 0.04);
    --btn-hover-bg: rgba(255, 255, 255, 0.035);
    --panel-highlight: linear-gradient(180deg, rgba(239, 68, 68, 0.06), transparent 70%);
    --glass-border: rgba(255, 255, 255, 0.06);
    --card-shadow-soft: 0 10px 26px rgba(2, 6, 23, 0.32);
    --card-shadow-strong: 0 16px 38px rgba(2, 6, 23, 0.44);
}

body {
    background: var(--bg-dark);
}

body::before {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.015), transparent 26%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: auto, 32px 32px, 32px 32px;
    opacity: 0.28;
}

.sidebar {
    background: var(--sidebar-bg);
    box-shadow: 16px 0 30px rgba(15, 23, 42, 0.12);
}

.sidebar-header {
    background: transparent;
    padding-bottom: 1rem;
}

.logo i {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.nav-link,
.user-profile {
    border-radius: 10px;
}

.nav-link:hover {
    border-color: transparent;
    box-shadow: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: transparent;
    box-shadow: none;
}

.nav-badge {
    box-shadow: none;
}

.header {
    height: 68px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(14px);
}

.header-btn,
.header-search input,
.form-control,
.table-action-btn,
.btn,
.tab,
.modal-close {
    box-shadow: none;
}

.main-content {
    background: transparent;
}

.card,
.filter-bar,
.tabs,
.rule-card,
.stage-item,
.chat-container,
.modal,
.login-form-inner {
    box-shadow: var(--card-shadow-soft);
}

.card,
.filter-bar,
.tabs,
.modal,
.login-form-inner {
    background-image: none;
}

.card {
    border-radius: 14px;
}

.card::before,
.stat-card::after {
    display: none;
}

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

.card-header,
.modal-header {
    background: var(--bg-card);
}

.page-intro-card .card-body,
.filter-card .card-body {
    background:
        linear-gradient(135deg, rgba(229, 9, 20, 0.05), rgba(255, 255, 255, 0.02) 48%, transparent 100%),
        var(--bg-card);
}

.stat-card {
    background: var(--bg-card);
    min-height: 124px;
}

.stat-icon,
.lead-avatar,
.chat-contact-avatar,
.header-avatar,
.user-avatar {
    box-shadow: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: none;
}

.btn-outline {
    background: var(--bg-card);
}

.tabs {
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 12px;
}

.tab {
    border-radius: 10px;
    padding: 0.68rem 0.95rem;
}

.tab.active {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.03);
    text-decoration: none;
}

[data-theme="dark"] .card-title,
[data-theme="dark"] .card-header,
[data-theme="dark"] .table-empty,
[data-theme="dark"] .table-footer-note {
    color: var(--text-main);
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .page-intro-card .card-body,
[data-theme="dark"] .filter-card .card-body,
[data-theme="dark"] .table-footer-note {
    background: var(--bg-card) !important;
}

[data-theme="dark"] .table-empty,
[data-theme="dark"] .table-footer-note,
[data-theme="dark"] .page-toolbar-subtitle,
[data-theme="dark"] .hero-stat-meta {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .nav-badge {
    color: #fff !important;
}

[data-theme="dark"] .hero-stat-pill,
[data-theme="dark"] .filter-card,
[data-theme="dark"] .table-container {
    background: var(--bg-card);
}

[data-theme="dark"] .tabs {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .tab:not(.active) {
    color: var(--text-muted);
}

[data-theme="dark"] .tab.active {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-main);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.filter-bar {
    border-radius: 14px;
    background: var(--bg-card);
}

thead th {
    background: #f8fafc;
}

[data-theme="dark"] thead th {
    background: #162133;
}

tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.015);
}

[data-theme="dark"] tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

[data-theme="dark"] tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.table-action-btn {
    background: var(--bg-card);
}

.modal-overlay {
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(6px);
}

.modal {
    border-radius: 16px;
}

.modal-footer {
    background: transparent;
}

.timeline::before {
    background: var(--border-color);
}

.login-body {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

[data-theme="light"] .login-brand {
    background:
        linear-gradient(180deg, #f7f9fc 0%, #eef3f8 62%, #e9eff6 100%);
    border-right: 1px solid rgba(148, 163, 184, 0.18);
}

[data-theme="light"] .login-brand-bg {
    background:
        radial-gradient(circle at 22% 22%, rgba(198, 40, 40, 0.12), transparent 36%),
        radial-gradient(circle at 78% 76%, rgba(37, 99, 235, 0.06), transparent 34%),
        linear-gradient(180deg, rgba(198, 40, 40, 0.03), transparent 72%);
}

[data-theme="light"] .login-logo-sub {
    color: #64748b;
}

[data-theme="light"] .login-tagline {
    color: #0f172a;
}

[data-theme="light"] .login-desc {
    color: #475569;
}

[data-theme="light"] .login-feature {
    color: #334155;
}

[data-theme="light"] .login-form-wrap {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

[data-theme="light"] .login-form-inner {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(217, 226, 236, 0.85);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .login-body {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

.login-brand {
    background: linear-gradient(180deg, #1f2937 0%, #17212f 100%);
}

.login-brand-bg {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 70%);
}

.login-form-wrap {
    background: transparent;
}

.login-form-inner {
    border-radius: 16px;
}

/* ==========================================
   PAGE-SPECIFIC ENTERPRISE LAYER
   ========================================== */
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workspace-toolbar-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 36px;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.summary-chip i {
    color: var(--primary);
    font-size: 0.8rem;
}

.summary-chip.success {
    border-color: rgba(21, 128, 61, 0.18);
    background: var(--success-bg);
    color: var(--success);
}

.summary-chip.success i {
    color: var(--success);
}

.page-intro-card {
    border-style: solid;
}

.hero-title {
    margin-bottom: 0.35rem;
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.hero-subtitle {
    max-width: 760px;
    color: var(--text-muted);
    font-size: 0.87rem;
    line-height: 1.6;
}

.hero-stats-inline {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.hero-stat-pill {
    min-width: 132px;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.hero-stat-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.hero-stat-label i {
    color: var(--primary);
    font-size: 0.85rem;
}

.hero-stat-value {
    color: var(--text-main);
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hero-stat-meta {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.35;
}

.dashboard-hero-card .card-body,
.page-intro-card .card-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

#reportFilterForm {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#reportFilterForm .form-control {
    min-height: 38px;
    min-width: 130px;
}

.permission-matrix {
    min-width: 920px;
}

.permission-matrix thead th {
    position: sticky;
    top: 0;
}

.permission-matrix td:first-child {
    color: var(--text-main);
    font-weight: 700;
}

.stage-list {
    gap: 0.75rem;
}

.stage-item {
    background: var(--bg-card);
    border-radius: 12px;
}

.stage-item:hover {
    background: var(--bg-card-hover);
}

.detail-hero-card {
    border-radius: 16px;
}

.detail-hero-card .lead-detail-header {
    padding: 1.15rem 1.2rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.02), transparent);
}

[data-theme="dark"] .detail-hero-card .lead-detail-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.detail-hero-card .lead-detail-actions .btn {
    min-height: 36px;
}

.modal-form-section {
    margin: 0.2rem 0 0.9rem;
    padding-top: 0.1rem;
}

.modal-section-title {
    margin-bottom: 0.22rem;
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.modal-section-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.55;
}

#tab-set-general .form-row,
#tab-set-integrations .form-row,
#tab-set-notifications .form-row,
#tab-set-automation .form-row {
    margin-bottom: 0.15rem;
}

#tab-set-general .btn,
#tab-set-roles .btn,
#tab-set-stages .btn,
#tab-set-integrations .btn,
#tab-set-notifications .btn,
#tab-set-automation .btn,
#tab-set-courses .btn,
#tab-set-sources .btn,
#tab-set-batches .btn {
    min-height: 40px;
}

/* ==========================================
   MOBILE & RESPONSIVE REFINEMENTS
   ========================================== */

@media (max-width: 991px) {
    /* SIDEBAR DRAWER */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 20px 0 80px rgba(0,0,0,0.4);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .header {
        padding: 0 1rem;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 950;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

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

    /* DATA TABLE → COMPACT, HORIZONTALLY-SCROLLABLE TABLE ON MOBILE.
       Product direction: list pages (Leads, Walk-ins, Follow-ups, Demos, …)
       show a real compact table on phones instead of one-card-per-row, so
       many records are visible at a glance. The table keeps its natural
       column widths and scrolls sideways inside its .table-container.
       Desktop (>991px) is unaffected — these rules live in a mobile @media. */
    .table-container,
    .card-body-np.table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-stack {
        display: table;
        width: 100%;
        min-width: 0;          /* defeat global table{min-width:760}; scroll if content is wider */
        border: 0;
    }
    .table-stack thead { display: table-header-group; }
    .table-stack thead th {
        padding: 0.55rem 0.6rem;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        white-space: nowrap;
        background: var(--bg-surface);
    }
    .table-stack tbody { display: table-row-group; }
    .table-stack tbody tr {
        display: table-row;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }
    .table-stack tbody td {
        display: table-cell;
        position: static;
        width: auto;
        max-width: none;
        padding: 0.55rem 0.6rem;
        text-align: left;
        vertical-align: middle;
        min-height: 0;
        border: 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 0.78rem;
        line-height: 1.4;
        white-space: nowrap;
    }
    /* No more card-style "LABEL" pseudo-elements in table mode */
    .table-stack td::before { content: none !important; display: none !important; }

    /* Pills / chips compact inside the table cell */
    .table-stack td .lead-service-pill,
    .table-stack td [class*="pill"],
    .table-stack td [class*="chip"],
    .table-stack td [class*="badge"] {
        max-width: 160px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }

    /* Actions cell stays a normal table cell; buttons in one horizontal row.
       (Overrides the previous flex-column behaviour that inflated row height.) */
    .table-stack td.actions-col,
    .table-stack td:last-child {
        display: table-cell !important;
        text-align: left;
        background: transparent;
    }
    .table-stack .table-actions {
        display: inline-flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0.4rem !important;
        max-width: none !important;
        width: auto !important;
        margin: 0 !important;
        justify-content: flex-start !important;
    }
    .table-stack .table-action-btn {
        width: 34px !important;
        height: 34px !important;
        border-radius: 9px !important;
        font-size: 0.82rem !important;
        flex-shrink: 0 !important;
    }
    /* Name + avatar inline, left-aligned in the cell */
    .table-stack .table-lead-name {
        display: inline-flex !important;
        align-items: center;
        gap: 0.5rem;
        justify-content: flex-start;
    }

    /* BULK ACTION BAR MOBILE */
    .bulk-action-bar.glass-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        margin: 0 !important;
        padding: 1.25rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        z-index: 2000;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        display: flex !important; /* Managed by ID visibility but structure is flex-column */
    }

    .bulk-action-bar.active {
        transform: translateY(0);
    }

    .bulk-action-bar select, 
    .bulk-action-bar input {
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* GRID FIXES */
    .grid-2, .grid-3, .grid-7-3 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .page-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-toolbar-actions {
        width: 100%;
    }

    .tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .tab {
        flex: 1;
        white-space: nowrap;
    }
}

/* ==========================================================================
   GLOBAL TABLE OVERFLOW GUARD (mobile data tables)
   Many section pages (reports, followups, fees, team, tickets, …) render
   plain <table>s that are wider than a phone screen, so columns get clipped
   and "data doesn't show". The pc-table-scroll wrapper — injected
   automatically by the auto-wrapper script in footer.php — gives those
   tables a horizontal scroll track instead of clipping. Tables that already
   reflow to cards (.table-stack) are deliberately skipped by the script.
   ========================================================================== */
.pc-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;   /* momentum scroll on iOS */
    overscroll-behavior-x: contain;
}
.pc-table-scroll > table {
    min-width: max-content;              /* keep columns at natural width, scroll instead of squish */
    margin-bottom: 0;
}
/* Subtle hint that the table scrolls sideways (fades the right edge) */
@media (max-width: 768px) {
    .pc-table-scroll {
        background:
            linear-gradient(90deg, var(--bg-card) 30%, rgba(0,0,0,0)) left / 24px 100% no-repeat,
            linear-gradient(270deg, var(--bg-card) 30%, rgba(0,0,0,0)) right / 24px 100% no-repeat;
        background-attachment: local, local;
    }
}

/* ==========================================================================
   PERFECTCONSULTANCY BRAND THEME
   Plum + Ink palette derived from the corporate logo.
   This block is the FINAL :root override — later rules win, so every
   variable redefined here propagates through the existing design system
   without touching any earlier rule.
   ==========================================================================
   Palette anchors:
     Brand plum  #6E1F5A   (logo "P", letterforms)
     Brand ink   #0F0F12   (logo bracket frame)
   ========================================================================== */

:root {
    /* Brand anchors — referenced by other tokens */
    --brand-plum: #6E1F5A;
    --brand-plum-dark: #4E1640;
    --brand-plum-deeper: #2E0C26;
    --brand-plum-light: #9D4C8A;
    --brand-plum-soft: #F4EBF1;
    --brand-ink: #0F0F12;
    --brand-ink-soft: #1C1820;

    /* Core */
    --primary: #6E1F5A;
    --primary-hover: #581846;
    --primary-glow: rgba(110, 31, 90, 0.18);
    --primary-gradient: linear-gradient(135deg, #7A2367 0%, #4E1640 100%);
    --primary-gradient-soft: linear-gradient(135deg, rgba(110, 31, 90, 0.10), rgba(78, 22, 64, 0.04));

    /* Surfaces */
    --bg-dark: #F7F4F8;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FBF7FB;
    --bg-input: #FFFFFF;
    --bg-surface: #FBF7FB;

    /* Text */
    --text-main: #16131A;
    --text-secondary: #4A434F;
    --text-muted: #827B89;

    /* Lines */
    --border-color: #E9E3EB;
    --border-hover: #D8CFDB;

    /*
     * Sidebar — light theme runs a WHITE sidebar with dark text. Dark theme
     * keeps the wine-to-ink gradient via its own [data-theme="dark"] block.
     *
     * Active state stays plum-on-white (the brand color reads as a clean
     * primary chip), hover gets a subtle plum tint so the nav rows don't
     * feel dead. Text is the same primary-ink we use everywhere else for
     * consistency with the canvas.
     */
    --sidebar-bg: #FFFFFF;
    --sidebar-text: #16131A;
    --sidebar-text-muted: #6B6571;
    --sidebar-active-bg: linear-gradient(135deg, rgba(110, 31, 90, 0.95) 0%, rgba(78, 22, 64, 0.95) 100%);
    --sidebar-hover-bg: rgba(110, 31, 90, 0.06);

    /* Header */
    --header-bg: rgba(255, 255, 255, 0.96);
    --header-border-glow: rgba(110, 31, 90, 0.12);

    /* Interaction surfaces */
    --hover-bg: rgba(110, 31, 90, 0.05);
    --btn-hover-bg: rgba(110, 31, 90, 0.05);
    --panel-highlight: linear-gradient(180deg, rgba(110, 31, 90, 0.04), transparent 70%);
    --glass-border: rgba(15, 15, 18, 0.06);

    /* Status — retuned so they don't collide with the plum primary */
    --success: #15803D;
    --success-bg: rgba(21, 128, 61, 0.08);
    --warning: #B45309;
    --warning-bg: rgba(180, 83, 9, 0.10);
    --info: #1E40AF;
    --info-bg: rgba(30, 64, 175, 0.08);
    --danger: #B91C1C;
    --danger-bg: rgba(185, 28, 28, 0.08);
    --purple: #7A2367;
    --purple-bg: rgba(122, 35, 103, 0.10);
    --amber: #D97706;
    --amber-bg: rgba(217, 119, 6, 0.10);

    /* Softer SaaS-style elevation */
    --shadow-card: 0 1px 2px rgba(15, 15, 18, 0.04), 0 6px 16px rgba(110, 31, 90, 0.06);
    --shadow-elevated: 0 4px 12px rgba(15, 15, 18, 0.08), 0 16px 36px rgba(110, 31, 90, 0.10);
    --shadow-premium: 0 12px 28px rgba(15, 15, 18, 0.10), 0 4px 8px rgba(15, 15, 18, 0.06);
    --shadow-accent: 0 10px 24px rgba(110, 31, 90, 0.22), 0 4px 10px rgba(110, 31, 90, 0.18);
    --shadow-glow: 0 0 0 4px rgba(110, 31, 90, 0.12);
    --card-shadow-soft: 0 1px 2px rgba(15, 15, 18, 0.04), 0 6px 16px rgba(110, 31, 90, 0.06);
    --card-shadow-strong: 0 4px 12px rgba(15, 15, 18, 0.08), 0 16px 36px rgba(110, 31, 90, 0.10);

    /* Radii — slightly more generous for a SaaS feel */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Background ambience */
    --shell-glow: radial-gradient(circle at 8% 6%, rgba(110, 31, 90, 0.07), transparent 36%);
    --shell-glow-secondary: radial-gradient(circle at 92% 12%, rgba(15, 15, 18, 0.04), transparent 30%);
}

/* Dark mode — sidebar already dark, so we just retune the canvas */
[data-theme="dark"] {
    --primary: #B670A4;
    --primary-hover: #9D4C8A;
    --primary-glow: rgba(182, 112, 164, 0.20);
    --primary-gradient: linear-gradient(135deg, #9D4C8A 0%, #6E1F5A 100%);

    --bg-dark: #14101A;
    --bg-card: #1C1722;
    --bg-card-hover: #221C29;
    --bg-input: #1C1722;
    --bg-surface: #221C29;
    --text-main: #F4EBF1;
    --text-secondary: #C8BED0;
    --text-muted: #8E8493;
    --border-color: #2D2536;
    --border-hover: #3D3447;

    --sidebar-bg: linear-gradient(180deg, #0F0815 0%, #050308 100%);
    --header-bg: rgba(20, 16, 26, 0.92);
    --hover-bg: rgba(182, 112, 164, 0.08);
    --btn-hover-bg: rgba(182, 112, 164, 0.06);
    --panel-highlight: linear-gradient(180deg, rgba(182, 112, 164, 0.06), transparent 70%);
    --glass-border: rgba(244, 235, 241, 0.06);
    --card-shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.36);
    --card-shadow-strong: 0 16px 38px rgba(0, 0, 0, 0.48);
    --shell-glow: radial-gradient(circle at 8% 6%, rgba(182, 112, 164, 0.10), transparent 36%);
    --shell-glow-secondary: radial-gradient(circle at 92% 12%, rgba(244, 235, 241, 0.03), transparent 30%);
}

/* ---------- Typography polish ---------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
    color: var(--text-main);
}

h1, h2, h3, h4, h5, h6,
.page-title, .login-tagline, .login-form-title,
.section-title, .card-title, .modal-title {
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.page-title {
    font-weight: 700;
}

.nav-section-label {
    letter-spacing: 0.10em;
    font-size: 0.66rem;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    padding: 1.1rem 1.25rem 0.4rem;
    font-weight: 600;
}

/* ---------- Sidebar polish ----------
   The original stylesheet defines `[data-theme="light"] .sidebar` with a
   WHITE background at line ~3597, plus a `body::before` overlay grid at
   line ~4236. Both win against the plain `.sidebar` / plain `body::before`
   selectors below. Re-declare with the same higher specificity so our
   dark plum-black sidebar and plum ambient glow actually paint. */

/*
 * Sidebar shell — split light vs dark. Dark inherits the legacy heavy shadow
 * and ink border. Light gets a soft gray right border + subtle elevation so
 * the sidebar reads as a clean panel against the off-white canvas, not as a
 * harsh column with a black hairline.
 */
[data-theme="dark"] .sidebar,
.sidebar {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid rgba(15, 15, 18, 0.4) !important;
    box-shadow: 20px 0 38px rgba(15, 15, 18, 0.18) !important;
    color: var(--sidebar-text) !important;
}

[data-theme="light"] .sidebar {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--border-color) !important;
    box-shadow: 1px 0 0 rgba(15, 15, 18, 0.02), 6px 0 20px rgba(15, 15, 18, 0.04) !important;
    color: var(--sidebar-text) !important;
}

.sidebar .nav-link,
.sidebar .nav-item > a {
    color: var(--sidebar-text);
    border-radius: var(--radius);
    margin: 0.15rem 0.6rem;
    padding: 0.62rem 0.85rem;
    font-weight: 500;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar .nav-link i,
.sidebar .nav-item > a i {
    color: var(--sidebar-text-muted);
    transition: color 0.18s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-item > a:hover {
    background: var(--sidebar-hover-bg);
    color: #FFFFFF;
}

.sidebar .nav-link:hover i,
.sidebar .nav-item > a:hover i {
    color: var(--brand-plum-light);
}

.sidebar .nav-link.active,
.sidebar .nav-item > a.active {
    background: var(--sidebar-active-bg);
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(110, 31, 90, 0.35);
}

.sidebar .nav-link.active i,
.sidebar .nav-item > a.active i {
    color: #FFFFFF;
}

.sidebar .sidebar-header {
    padding: 1rem 0.85rem 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* The brand logo SVG carries dark-ink wordmark glyphs that would disappear
   against the dark plum-black sidebar. Wrap it in a white chip — mirrors
   the treatment used on the login screen so the brand reads cleanly. */
.sidebar .sidebar-brand-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 52px !important;
    height: auto !important;
    object-fit: contain;
    background: #FFFFFF;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius);
    border: 1px solid rgba(244, 235, 241, 0.16);
    box-shadow: 0 4px 12px rgba(15, 15, 18, 0.32);
}

.sidebar .logo,
.sidebar .sidebar-brand-mark {
    color: #FFFFFF;
    width: 100%;
}

.sidebar .logo-sub {
    color: var(--sidebar-text-muted);
    letter-spacing: 0.20em;
    font-size: 0.62rem;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar .nav-badge {
    background: var(--brand-plum);
    color: #FFFFFF;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    font-size: 0.66rem;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(110, 31, 90, 0.4);
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-footer .user-profile {
    border-radius: var(--radius);
    transition: background 0.18s ease;
}

.sidebar-footer .user-profile:hover {
    background: var(--sidebar-hover-bg);
}

.sidebar-footer .user-name,
.sidebar-footer .user-info > div:first-child {
    color: #FFFFFF;
}

.sidebar-footer .user-role,
.sidebar-footer .user-info > div:last-child {
    color: var(--sidebar-text-muted);
}

.sidebar-footer .user-avatar {
    background: var(--primary-gradient);
    color: #FFFFFF;
    font-weight: 700;
}

/*
 * ---------- Light theme sidebar overrides ----------
 *
 * The block above this section hardcodes white text and dark-only borders
 * (`color: #FFFFFF`, `border: rgba(255,255,255,0.05)`, white-chip on the
 * brand image, etc.) — all of which assume a dark sidebar background.
 *
 * In light theme the sidebar is now WHITE, so each of those hardcoded
 * decisions has to flip. Rather than touch every original rule, we
 * override them here under `[data-theme="light"]` for clean separation —
 * dark mode keeps the original wine-on-ink palette unchanged.
 *
 * Active state (plum gradient → white text) stays the same in both themes
 * because the contrast works against any background.
 */
[data-theme="light"] .sidebar .nav-link,
[data-theme="light"] .sidebar .nav-item > a {
    color: var(--sidebar-text);
}
[data-theme="light"] .sidebar .nav-link i,
[data-theme="light"] .sidebar .nav-item > a i {
    color: var(--sidebar-text-muted);
}
[data-theme="light"] .sidebar .nav-link:hover,
[data-theme="light"] .sidebar .nav-item > a:hover {
    background: var(--sidebar-hover-bg);
    color: var(--brand-plum-dark, #6E1F5A);
}
[data-theme="light"] .sidebar .nav-link:hover i,
[data-theme="light"] .sidebar .nav-item > a:hover i {
    color: var(--brand-plum, #9D4C8A);
}
/* Active = plum gradient pill, white text — same in both themes.
 * Re-assert the gradient background here because the light-theme :hover
 * rule above has the same selector weight and its source order would
 * otherwise let the light-pink hover tint paint OVER the active pill
 * when the cursor sits on the current page's nav item (white text on
 * light-pink → label disappears). */
[data-theme="light"] .sidebar .nav-link.active,
[data-theme="light"] .sidebar .nav-item > a.active,
[data-theme="light"] .sidebar .nav-link.active:hover,
[data-theme="light"] .sidebar .nav-item > a.active:hover {
    background: var(--sidebar-active-bg);
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(110, 31, 90, 0.35);
}
[data-theme="light"] .sidebar .nav-link.active i,
[data-theme="light"] .sidebar .nav-item > a.active i,
[data-theme="light"] .sidebar .nav-link.active:hover i,
[data-theme="light"] .sidebar .nav-item > a.active:hover i {
    color: #FFFFFF;
}

/* Header / footer dividers — visible on white. */
[data-theme="light"] .sidebar .sidebar-header {
    border-bottom: 1px solid var(--border-color);
}
[data-theme="light"] .sidebar-footer {
    border-top: 1px solid var(--border-color);
}

/*
 * Brand logo chip — in dark mode it's painted on a white pad so the dark-ink
 * wordmark reads. On a white sidebar the white pad is invisible and the
 * dark shadow looks heavy; strip both and let the SVG sit flat with a
 * subtle neutral border for definition.
 */
[data-theme="light"] .sidebar .sidebar-brand-image {
    background: transparent;
    border: 1px solid var(--border-color);
    box-shadow: none;
}

/* Logo wordmark + sub-text on a white panel. */
[data-theme="light"] .sidebar .logo,
[data-theme="light"] .sidebar .sidebar-brand-mark {
    color: var(--brand-plum-dark, #6E1F5A);
}
[data-theme="light"] .sidebar .logo-sub {
    color: var(--sidebar-text-muted);
}

/* User profile area in the footer — name was white, swap to dark ink. */
[data-theme="light"] .sidebar-footer .user-name,
[data-theme="light"] .sidebar-footer .user-info > div:first-child {
    color: var(--text-main);
}
[data-theme="light"] .sidebar-footer .user-role,
[data-theme="light"] .sidebar-footer .user-info > div:last-child {
    color: var(--text-muted);
}

/* ---------- Header polish ---------- */
.header {
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(15, 15, 18, 0.02);
}

.header-search {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.header-search:focus-within {
    border-color: var(--brand-plum-light);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.header-search input {
    color: var(--text-main);
}

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

.header-btn {
    border-radius: var(--radius);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.header-btn:hover {
    background: var(--btn-hover-bg);
    border-color: var(--border-hover);
    color: var(--brand-plum);
}

.header-avatar {
    background: var(--primary-gradient);
    color: #FFFFFF;
    font-weight: 700;
}

.notification-dot {
    background: var(--brand-plum);
    box-shadow: 0 0 0 3px var(--bg-card);
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: var(--radius);
    font-weight: 600;
    letter-spacing: -0.005em;
    transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary-gradient);
    border: 1px solid var(--brand-plum-dark);
    color: #FFFFFF;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 4px 10px rgba(110, 31, 90, 0.22);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6E1F5A 0%, #3D1233 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 8px 20px rgba(110, 31, 90, 0.32);
    color: #FFFFFF;
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-glow), 0 8px 20px rgba(110, 31, 90, 0.28);
}

.btn-outline {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--brand-plum-light);
    background: var(--brand-plum-soft);
    color: var(--brand-plum-dark);
}

/* `.btn-accent` is used for primary CTAs in the original theme (Add Lead,
   Run Campaign, etc.) and previously rendered as a Netflix-red gradient
   with a red glow. Re-tint to brand plum so it reads as a "stronger
   primary" instead of an angry alert. */
.btn-accent {
    background: linear-gradient(135deg, var(--brand-plum-light) 0%, var(--brand-plum) 55%, var(--brand-plum-dark) 100%) !important;
    color: #FFFFFF !important;
    border: 1px solid var(--brand-plum-dark) !important;
    text-transform: uppercase;
    letter-spacing: 0.08em !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 6px 16px rgba(110, 31, 90, 0.28) !important;
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--brand-plum) 0%, var(--brand-plum-dark) 60%, #3D1233 100%) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 10px 22px rgba(110, 31, 90, 0.38) !important;
    transform: translateY(-1px);
    filter: none;
}

.btn-accent:active {
    transform: translateY(0);
}

.btn-accent:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-glow), 0 6px 16px rgba(110, 31, 90, 0.32) !important;
}

/* ---------- Form controls ---------- */
.form-control,
input.form-control,
textarea.form-control,
select.form-control {
    border-radius: var(--radius);
    border-color: var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

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

.form-label {
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.01em;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.input-icon-wrap i {
    color: var(--text-muted);
}

.input-icon-wrap:focus-within i {
    color: var(--brand-plum);
}

/* ---------- Cards / panels ---------- */
.card,
.panel,
.dashboard-card,
.stat-card,
.summary-card,
.module-card,
.section-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--card-shadow-soft);
    transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}

.card:hover,
.dashboard-card:hover,
.stat-card:hover,
.summary-card:hover,
.module-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--card-shadow-strong);
}

/* ---------- Tabs ---------- */
.tab {
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
}

.tab.active {
    color: var(--brand-plum);
    border-bottom-color: var(--brand-plum);
    background: transparent;
}

/* ---------- Tables ---------- */
table th {
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
}

table tbody tr:hover {
    background: var(--brand-plum-soft);
}

/* ---------- Badges / chips ---------- */
.badge-primary,
.chip-primary {
    background: var(--brand-plum-soft);
    color: var(--brand-plum-dark);
    border: 1px solid rgba(110, 31, 90, 0.18);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(110, 31, 90, 0.22);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(110, 31, 90, 0.38);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* ---------- Login screen polish ----------
   Earlier rules in this stylesheet (around line 4490) target
   `[data-theme="light"] .login-brand` etc. with higher specificity, so the
   plain-class form below would not win. We match their specificity by
   prefixing every login selector with both `[data-theme="light"]` and
   `[data-theme="dark"]` (the login script defaults to "light" if no theme
   has been saved, so the light branch is always present).
   ----------------------------------------- */

[data-theme="light"] .login-body,
[data-theme="dark"] .login-body,
.login-body {
    background:
        radial-gradient(circle at 12% 18%, rgba(110, 31, 90, 0.12), transparent 38%),
        radial-gradient(circle at 88% 82%, rgba(15, 15, 18, 0.06), transparent 38%),
        var(--bg-dark);
}

[data-theme="light"] .login-brand,
[data-theme="dark"] .login-brand,
.login-brand {
    background:
        radial-gradient(circle at 24% 28%, rgba(157, 76, 138, 0.30), transparent 50%),
        radial-gradient(circle at 78% 78%, rgba(15, 15, 18, 0.55), transparent 55%),
        linear-gradient(135deg, #2E0C26 0%, #1A0F18 55%, #08050A 100%);
    color: #F4EBF1;
    border-right: 1px solid rgba(15, 15, 18, 0.6);
}

[data-theme="light"] .login-brand-bg,
[data-theme="dark"] .login-brand-bg,
.login-brand-bg {
    background:
        radial-gradient(circle at 22% 22%, rgba(157, 76, 138, 0.22), transparent 38%),
        radial-gradient(circle at 78% 76%, rgba(110, 31, 90, 0.18), transparent 40%),
        linear-gradient(180deg, rgba(244, 235, 241, 0.04), transparent 72%);
}

[data-theme="light"] .login-brand-content,
[data-theme="dark"] .login-brand-content,
.login-brand-content {
    color: #F4EBF1;
}

[data-theme="light"] .login-tagline,
[data-theme="dark"] .login-tagline,
.login-tagline {
    color: #FFFFFF;
}

[data-theme="light"] .login-tagline span,
[data-theme="dark"] .login-tagline span,
.login-tagline span {
    color: var(--brand-plum-light);
}

[data-theme="light"] .login-desc,
[data-theme="dark"] .login-desc,
.login-desc {
    color: rgba(244, 235, 241, 0.78);
}

[data-theme="light"] .login-feature,
[data-theme="dark"] .login-feature,
.login-feature {
    color: rgba(244, 235, 241, 0.88);
}

[data-theme="light"] .login-feature i,
[data-theme="dark"] .login-feature i,
.login-feature i {
    color: var(--brand-plum-light);
}

[data-theme="light"] .login-logo,
[data-theme="dark"] .login-logo,
.login-logo {
    color: #FFFFFF;
}

[data-theme="light"] .login-logo i,
[data-theme="dark"] .login-logo i,
.login-logo i {
    color: var(--brand-plum-light);
}

[data-theme="light"] .login-logo-sub,
[data-theme="dark"] .login-logo-sub,
.login-logo-sub {
    color: rgba(244, 235, 241, 0.55);
    letter-spacing: 0.22em;
}

/* Logo image cell — give it more room and let the SVG render at its
   natural aspect ratio without being squashed by max-width. */
.login-logo-image {
    max-width: 320px !important;
    max-height: 80px !important;
    width: auto !important;
    height: auto !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
    background: rgba(255, 255, 255, 0.92);
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(244, 235, 241, 0.18);
}

[data-theme="light"] .login-form-wrap,
[data-theme="dark"] .login-form-wrap,
.login-form-wrap {
    background: var(--bg-card);
}

[data-theme="light"] .login-form-inner,
[data-theme="dark"] .login-form-inner,
.login-form-inner {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow-soft);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .login-form-title,
[data-theme="dark"] .login-form-title,
.login-form-title {
    color: var(--text-main);
}

[data-theme="light"] .login-form-subtitle,
[data-theme="dark"] .login-form-subtitle,
.login-form-subtitle {
    color: var(--text-secondary);
}

.login-btn {
    width: 100%;
    padding: 0.95rem 1.1rem;
    font-size: 0.95rem;
}

[data-theme="light"] .login-footer-text,
[data-theme="dark"] .login-footer-text,
.login-footer-text {
    color: var(--text-muted);
}

[data-theme="light"] .login-forgot,
[data-theme="dark"] .login-forgot,
.login-forgot {
    color: var(--brand-plum);
    font-weight: 600;
}

[data-theme="light"] .login-forgot:hover,
[data-theme="dark"] .login-forgot:hover,
.login-forgot:hover {
    color: var(--brand-plum-dark);
}

/* ---------- Page background ambience ----------
   Overrides the grid-pattern body::before defined earlier at ~line 4236.
   The opacity reset is important — earlier rule sets opacity 0.28 which
   would mute our plum glow. */
body::before {
    background:
        var(--shell-glow),
        var(--shell-glow-secondary) !important;
    background-size: auto, auto !important;
    opacity: 1 !important;
}

/* ---------- Focus state, app-wide ---------- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ---------- Theme-toggle button on the login screen ----------
   This button sits over the WHITE form half, so it needs a dark/ink chip
   with enough contrast to be visible against white. The earlier inline
   style on the login.php button uses var(--bg-surface) + var(--text-main)
   which now resolve to near-white-on-near-white — override here. */
.login-body #btnThemeToggle {
    background: var(--brand-ink) !important;
    border-color: var(--brand-ink-soft) !important;
    color: var(--brand-plum-light) !important;
    box-shadow: 0 6px 18px rgba(15, 15, 18, 0.18) !important;
}

.login-body #btnThemeToggle:hover {
    background: var(--brand-plum-dark) !important;
    border-color: var(--brand-plum-dark) !important;
    color: #FFFFFF !important;
}

/* ---------- Profile dropdown ---------- */
.profile-dropdown {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-elevated);
    background: var(--bg-card);
}

.profile-dropdown-item:hover {
    background: var(--brand-plum-soft);
    color: var(--brand-plum-dark);
}

.profile-dropdown-item.text-danger:hover {
    background: rgba(185, 28, 28, 0.08);
    color: var(--danger);
}

/* ---------- Modals ---------- */
.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-elevated);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    color: var(--text-main);
    font-weight: 700;
}

/* ---------- Honor existing dark-theme overrides on inputs ---------- */
[data-theme="dark"] .form-control,
[data-theme="dark"] input.form-control,
[data-theme="dark"] textarea.form-control,
[data-theme="dark"] select.form-control {
    background: var(--bg-input);
    color: var(--text-main);
    border-color: var(--border-color);
}

[data-theme="dark"] table tbody tr:hover {
    background: rgba(182, 112, 164, 0.08);
}

[data-theme="dark"] .header-btn:hover {
    color: var(--brand-plum-light);
}
