/* ==========================================================================
   ENTERPRISE CTI & CRM DESIGN SYSTEM - MODERN SAAS CORE STYLES
   ========================================================================== */

:root,
[data-theme="light"] {
    /* Crisp Executive White/Light Theme Palette (Default) */
    --bg-canvas: #F4F6F9;
    --bg-main: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-surface-elevated: #F1F5F9;
    --bg-surface-hover: #E2E8F0;
    --bg-card: #FFFFFF;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --bg-input: #FFFFFF;
    --bg-muted: #E2E8F0;

    /* Primary Accent Color & Tints */
    --primary: #4F46E5;
    --primary-light: #4338CA;
    --primary-hover: #3730A3;
    --primary-active: #312E81;
    --primary-subtle: rgba(79, 70, 229, 0.08);
    --primary-glow: rgba(79, 70, 229, 0.12);

    /* Semantic Status Accents */
    --success: #059669;
    --success-hover: #047857;
    --success-subtle: rgba(5, 150, 105, 0.1);
    --warning: #D97706;
    --warning-hover: #B45309;
    --warning-subtle: rgba(217, 119, 6, 0.1);
    --danger: #DC2626;
    --danger-hover: #B91C1C;
    --danger-subtle: rgba(220, 38, 38, 0.1);
    --info: #0284C7;
    --info-hover: #0369A1;
    --info-subtle: rgba(2, 132, 199, 0.1);
    --purple: #7C3AED;
    --purple-subtle: rgba(124, 58, 237, 0.1);

    /* Typography & Contrast Colors */
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --text-disabled: #94A3B8;
    --text-inverse: #FFFFFF;

    /* Borders & Outlines */
    --border-subtle: #F1F5F9;
    --border-color: #E2E8F0;
    --border-strong: #CBD5E1;
    --border-focus: #4F46E5;

    /* Shadows (Clean & Subtle) */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-popover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Radii & Timing */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    --sidebar-width: 285px;
    --header-height: 64px;
    --transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Theme Palette (Obsidian Slate) */
    --bg-canvas: #090D16;
    --bg-main: #0B0F19;
    --bg-surface: #111827;
    --bg-surface-elevated: #182234;
    --bg-surface-hover: #1F2E44;
    --bg-card: rgba(17, 24, 39, 0.95);
    --bg-glass: rgba(11, 15, 25, 0.85);
    --bg-input: #151D2C;
    --bg-muted: #1E293B;

    /* Primary Accent Color & Tints (Executive Indigo) */
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-hover: #4338CA;
    --primary-active: #3730A3;
    --primary-subtle: rgba(79, 70, 229, 0.12);
    --primary-glow: rgba(99, 102, 241, 0.2);

    /* Semantic Status Accents */
    --success: #10B981;
    --success-hover: #059669;
    --success-subtle: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-hover: #D97706;
    --warning-subtle: rgba(245, 158, 11, 0.12);
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --danger-subtle: rgba(239, 68, 68, 0.12);
    --info: #0284C7;
    --info-hover: #0369A1;
    --info-subtle: rgba(2, 132, 199, 0.12);
    --purple: #8B5CF6;
    --purple-subtle: rgba(139, 92, 246, 0.12);

    /* Typography & Contrast Colors */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-disabled: #475569;
    --text-inverse: #090D16;

    /* Borders & Outlines */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-color: #243042;
    --border-strong: #334155;
    --border-focus: #6366F1;

    /* Shadows (Crisp & Subtle) */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-popover: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   RESET & BASE TYPOGRAPHY
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16.5px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* SVG Line Icons Support */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Global Select & Dropdown Styling (Fix Vertical Clipping) */
select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    font-family: inherit;
    line-height: normal !important;
    vertical-align: middle;
    background-color: var(--bg-input, #ffffff);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 13px 13px;
    padding-right: 1.85rem !important;
    padding-left: 0.65rem !important;
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
}

select option {
    background-color: var(--bg-surface, #ffffff);
    color: var(--text-primary, #0f172a);
    padding: 0.35rem 0.5rem;
}

/* ==========================================================================
   BUTTON SYSTEM (Modern, Clean, Responsive)
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 38px;
    padding: 0 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    transition: var(--transition);
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary);
}

.btn:active {
    transform: translateY(1px) scale(0.99);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
}

/* Professional Soft / Light-Theme Button Styles */

/* Primary Button (Soft Indigo / Light Blue) */
.btn-primary {
    background-color: rgba(99, 102, 241, 0.12);
    color: #4338CA;
    border: 1px solid rgba(99, 102, 241, 0.35);
    font-weight: 600;
}

[data-theme="dark"] .btn-primary {
    background-color: rgba(99, 102, 241, 0.18);
    color: #A5B4FC;
    border-color: rgba(99, 102, 241, 0.40);
}

.btn-primary:hover {
    background-color: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.55);
    color: #312E81;
}

[data-theme="dark"] .btn-primary:hover {
    background-color: rgba(99, 102, 241, 0.28);
    border-color: rgba(99, 102, 241, 0.65);
    color: #C7D2FE;
}

.btn-primary:active {
    background-color: rgba(99, 102, 241, 0.30);
}

/* TCS iON Visual Assistant & Soft Blue Button */
.btn-tcs-light {
    background-color: rgba(99, 102, 241, 0.10);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.30);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 11px;
    border-radius: var(--radius-sm, 6px);
    font-size: 0.8125rem;
    white-space: nowrap;
    transition: all 0.18s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .btn-tcs-light {
    background-color: rgba(99, 102, 241, 0.16);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.38);
}

.btn-tcs-light:hover:not(:disabled) {
    background-color: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.50);
    color: #312e81;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .btn-tcs-light:hover:not(:disabled) {
    background-color: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.60);
    color: #c7d2fe;
}

/* Secondary / Neutral Soft Button */
.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-secondary:active {
    background-color: var(--bg-muted);
}

/* Success Button (Soft Light Green) */
.btn-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-weight: 600;
}

[data-theme="dark"] .btn-success {
    background-color: rgba(16, 185, 129, 0.18);
    color: #6EE7B7;
    border-color: rgba(16, 185, 129, 0.40);
}

.btn-success:hover {
    background-color: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.55);
    color: #064E3B;
}

[data-theme="dark"] .btn-success:hover {
    background-color: rgba(16, 185, 129, 0.28);
    border-color: rgba(16, 185, 129, 0.65);
    color: #A7F3D0;
}

/* Warning Button (Soft Light Yellow / Orange) */
.btn-warning {
    background-color: rgba(245, 158, 11, 0.12);
    color: #B45309;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-weight: 600;
}

[data-theme="dark"] .btn-warning {
    background-color: rgba(245, 158, 11, 0.18);
    color: #FCD34D;
    border-color: rgba(245, 158, 11, 0.40);
}

.btn-warning:hover {
    background-color: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.55);
    color: #78350F;
}

[data-theme="dark"] .btn-warning:hover {
    background-color: rgba(245, 158, 11, 0.28);
    color: #FDE68A;
}

/* Danger / Delete Button (Soft Light Red) */
.btn-danger {
    background-color: rgba(239, 68, 68, 0.10);
    color: #B91C1C;
    border: 1px solid rgba(239, 68, 68, 0.30);
    font-weight: 600;
}

[data-theme="dark"] .btn-danger {
    background-color: rgba(239, 68, 68, 0.16);
    color: #FCA5A5;
    border-color: rgba(239, 68, 68, 0.38);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.20);
    border-color: rgba(239, 68, 68, 0.50);
    color: #7F1D1D;
}

[data-theme="dark"] .btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.26);
    color: #FECACA;
}

/* Info Button (Soft Sky Blue) */
.btn-info {
    background-color: rgba(14, 165, 233, 0.12);
    color: #0369A1;
    border: 1px solid rgba(14, 165, 233, 0.35);
    font-weight: 600;
}

[data-theme="dark"] .btn-info {
    background-color: rgba(14, 165, 233, 0.18);
    color: #7DD3FC;
    border-color: rgba(14, 165, 233, 0.40);
}

.btn-info:hover {
    background-color: rgba(14, 165, 233, 0.22);
    border-color: rgba(14, 165, 233, 0.55);
    color: #075985;
}

/* Outline Button */
.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

/* Ghost Button */
.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Button Sizes */
.btn-xs {
    height: 28px;
    padding: 0 0.6rem;
    font-size: 0.78rem;
    border-radius: var(--radius-xs);
    gap: 0.3rem;
}

.btn-sm {
    height: 34px;
    padding: 0 0.85rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    gap: 0.35rem;
}

.btn-md {
    height: 40px;
    padding: 0 1.15rem;
    font-size: 0.92rem;
}

.btn-lg {
    height: 46px;
    padding: 0 1.45rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
    gap: 0.5rem;
}

/* Icon-Only Buttons */
.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

.btn-icon:focus-visible {
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary);
}

.btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   APP SHELL LAYOUT & NAVIGATION
   ========================================================================== */

#app-root {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 100;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}

.sidebar-header {
    height: 88px;
    min-height: 88px;
    max-height: 88px;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 0 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-img {
    height: 60px !important;
    width: auto !important;
    max-width: 140px !important;
    object-fit: contain !important;
    border-radius: var(--radius-md);
    background: #FFFFFF;
    padding: 4px 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.sidebar-brand-img:hover {
    transform: scale(1.04);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nav-section {
    padding: 1.25rem 0.85rem;
    flex: 1;
    overflow-y: auto;
}

.nav-group-title {
    font-size: 0.8125rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0 0.85rem 0.65rem;
}

.nav-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 550;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 700;
    border-color: rgba(79, 70, 229, 0.25);
}

.nav-link svg,
.nav-link .icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: inherit;
}

.nav-badge {
    margin-left: auto;
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.nav-badge.danger {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.25);
}

.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
}

.user-profile-widget {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #FFFFFF;
    font-size: 0.875rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.user-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    display: inline-block;
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.05rem 0.35rem;
    border-radius: var(--radius-xs);
}

/* ==========================================================================
   MAIN WORKSPACE & STICKY HEADER
   ========================================================================== */

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
    height: 100vh;
    background-color: var(--bg-canvas);
}

/* Top App Header */
.top-header {
    height: var(--header-height);
    min-height: var(--header-height);
    max-height: var(--header-height);
    box-sizing: border-box;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

/* Mobile Sidebar Toggle Button */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}

/* Global Search Command Bar */
.global-search-container {
    flex: 1;
    max-width: 540px;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
    width: 16px;
    height: 16px;
}

.global-search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 3.5rem 0.6rem 2.5rem;
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    outline: none;
    transition: var(--transition);
}

.global-search-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-surface);
}

.search-shortcut-hint {
    position: absolute;
    right: 0.75rem;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.kbd-badge {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-xs);
    font-family: inherit;
}

/* Search Dropdown Results Container */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 600px;
    width: max(100%, 600px);
    max-width: min(760px, calc(100vw - 32px));
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.15), 0 3px 10px rgba(0, 0, 0, 0.06);
    z-index: 1050;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.search-results-dropdown.show {
    display: flex;
    animation: searchDropdownFadeIn 0.15s ease-out;
}

@keyframes searchDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dropdown Header */
.search-results-header {
    padding: 0.55rem 1rem;
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

/* Scrollable Results List */
#search-results-list {
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Individual Search Result Item Card */
.search-result-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.12s ease;
    background: transparent;
    text-decoration: none;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
    background: var(--bg-surface-hover);
}

.search-result-item.selected {
    border-left: 3px solid var(--primary);
}

/* Left Avatar / Initials badge */
.search-item-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Middle Content Layout */
.search-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
}

.search-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-party-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
}

.search-code-badge {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-weight: 600;
    font-size: 0.725rem;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-xs);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.search-category-pill {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-xs);
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
    flex-shrink: 0;
    text-transform: uppercase;
}

.search-rating-stars {
    font-size: 0.725rem;
    color: #f59e0b;
    font-weight: 600;
    flex-shrink: 0;
}

/* Second Row: Structured Metadata */
.search-item-meta {
    font-size: 0.76rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem 0.75rem;
    flex-wrap: wrap;
}

.search-phone-highlight {
    color: var(--primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* Right Side Actions & Reason Tag */
.search-item-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.search-match-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
    white-space: nowrap;
}

.search-match-tag.code-match {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
    border-color: rgba(99, 102, 241, 0.25);
}

.search-match-tag.phone-match {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.3);
}

.search-match-tag.city-match {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.25);
}

.search-action-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    max-width: 26px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.search-action-btn svg {
    width: 12px !important;
    height: 12px !important;
    max-width: 12px !important;
    max-height: 12px !important;
}

.search-action-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.search-action-btn.call-btn:hover {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    padding: 0 0.85rem;
    height: 34px;
    box-sizing: border-box;
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

/* Professional User / Account Quick Switcher */
.user-switcher-dropdown {
    position: relative;
    display: inline-block;
}

.user-switcher-trigger {
    height: 34px;
    padding: 0 0.85rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: var(--transition);
    box-sizing: border-box;
    white-space: nowrap;
}

.user-switcher-trigger:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.user-switcher-icon {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
}

.user-switcher-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.user-switcher-dropdown.open .user-switcher-chevron {
    transform: rotate(180deg);
}

.user-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 420px;
    max-width: calc(100vw - 1.5rem);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(16px);
    animation: fadeInScale 0.15s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-switcher-menu-header {
    padding: 0.6rem 0.85rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-switcher-menu-list {
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.35rem 0;
}

.user-switcher-group-label {
    padding: 0.5rem 0.85rem 0.25rem 0.85rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.user-switcher-item {
    padding: 0.55rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    min-width: 0;
    cursor: pointer;
    transition: background 0.15s ease;
    border-left: 2px solid transparent;
}

.user-switcher-item:hover {
    background: var(--bg-surface-hover);
}

.user-switcher-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-left-color: var(--primary);
}

.user-switcher-user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.user-switcher-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    color: #FFFFFF;
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-switcher-avatar.admin {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
}

.user-switcher-avatar.staff {
    background: linear-gradient(135deg, #0EA5E9, #059669);
}

.user-switcher-meta {
    min-width: 0;
}

.user-switcher-name {
    font-size: 0.78125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-switcher-sub {
    font-size: 0.6875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

/* Team performance table: full view without scrolling clipping or cut-off text */
.team-performance-table-container {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none !important;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

#admin-team-table {
    width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

#admin-team-table th,
#admin-team-table td {
    box-sizing: border-box;
    padding: 0.65rem 0.6rem;
    vertical-align: middle;
}

#admin-team-table th {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bg-surface-elevated);
    border-bottom: 1.5px solid var(--border-color);
}

#admin-team-table th:first-child {
    border-top-left-radius: var(--radius-md);
}

#admin-team-table th:last-child {
    border-top-right-radius: var(--radius-md);
}

#admin-team-table td {
    font-size: 0.92rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    transition: background 0.15s ease;
    overflow-wrap: break-word;
    word-break: normal;
}

#admin-team-table tbody tr:hover td {
    background: var(--bg-surface-hover);
}

#admin-team-table tbody tr:last-child td {
    border-bottom: none;
}

#admin-team-table .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 4px;
}

/* ==========================================================================
   GLOBAL DESIGN SYSTEM: TYPOGRAPHY HIERARCHY & SUB-TEXT STANDARD (13–14px)
   Applied across all tabs, cards, tables, lists, forms, modals & components.
   ========================================================================== */

/* 1. Base Workspace Content Body */
.content-body {
    padding: 1.5rem;
    flex: 1;
    font-size: 1rem;
}

/* 2. Standardized Sub-text / Secondary Typography Classes (13–14px) */
.subtext,
.sub-text,
.secondary-text,
.helper-text,
.meta-text,
.meta-info,
.meta-subtitle,
.table-subtext,
.form-hint,
.form-text,
.form-label-hint,
.text-muted,
.text-secondary {
    font-size: 0.875rem !important; /* Exactly 13.125px (13–14px standard) */
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: normal;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* 3. Global Tables Hierarchy: Fully Responsive & Intelligent Column Auto-Fit */
.table-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto;
    overflow-y: visible;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    font-size: 0.94rem;
    table-layout: auto;
    box-sizing: border-box;
    margin: 0;
}

.table th {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase;
    color: var(--text-muted) !important;
    padding: 0.65rem 0.6rem !important;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.25 !important;
    vertical-align: middle;
    box-sizing: border-box;
}

.table td {
    padding: 0.65rem 0.6rem !important;
    font-size: 0.94rem !important;
    color: var(--text-primary);
    vertical-align: middle;
    line-height: 1.35;
    overflow-wrap: break-word;
    word-break: normal;
    box-sizing: border-box;
}

/* Primary text in table cells */
.table td strong,
.table td b,
.table td .primary-text,
.table td a,
.table td div[style*="font-weight: 600"],
.table td div[style*="font-weight: 700"] {
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-break: normal;
}

/* Secondary / sub-text in any table cell across all tabs */
/* (e.g. Employee role, department, DID, email, city/state, timestamps, notes) */
.table td small,
.table td .subtext,
.table td .sub-text,
.table td .secondary-text,
.table td .table-subtext,
.table td .text-muted,
.table td .text-secondary,
.table td div[style*="var(--text-muted)"],
.table td span[style*="var(--text-muted)"],
.table td div[style*="var(--text-secondary)"],
.table td span[style*="var(--text-secondary)"],
.table td div[style*="#64748b"],
.table td span[style*="#64748b"],
.table td div[style*="#94a3b8"],
.table td span[style*="#94a3b8"],
.table td div[style*="color: #64748B"],
.table td span[style*="color: #64748B"] {
    font-size: 0.83rem !important; /* ~13.7px standard at 16.5px root */
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    line-height: 1.3 !important;
    margin-top: 1px !important;
    overflow-wrap: break-word;
    word-break: normal;
}

/* Table Actions, Buttons & Badges Fluid Auto-Fit */
.table td .btn,
.table td button {
    padding: 0.2rem 0.45rem !important;
    font-size: 0.78rem !important;
    height: auto !important;
    min-height: 24px !important;
    white-space: nowrap !important;
    gap: 3px !important;
}

.table td .badge {
    padding: 0.15rem 0.45rem !important;
    font-size: 0.78rem !important;
    white-space: nowrap !important;
    max-width: 100%;
}

.table td > div[style*="display: flex"],
.table-action-group {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0.25rem !important;
}

.table td code,
.table td span[style*="monospace"] {
    font-size: 0.78rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 115px;
    display: inline-block;
    vertical-align: middle;
}

.table td strong[style*="tabular-nums"],
.table td span[style*="tabular-nums"] {
    white-space: nowrap !important;
    font-variant-numeric: tabular-nums;
}

/* 4. Card Sub-texts & Supporting Information */
.kpi-subtitle,
.kpi-subtitle span,
.kpi-subtitle div {
    font-size: 0.86rem !important; /* 13.8–14.2px supporting info */
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    line-height: 1.4 !important;
}

.card-subtitle,
.card-desc,
.card-header-desc {
    font-size: 0.86rem !important;
    color: var(--text-muted) !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
}

/* 5. Calling Performance Highlights Supporting Stats (13–14px) */
#calling-perf-highlights-grid > div > div:last-child,
#calling-perf-highlights-grid > div > div:last-child span,
#calling-perf-highlights-grid > div > div:last-child div {
    font-size: 0.86rem !important; /* ~14px */
    line-height: 1.45 !important;
    font-weight: 500;
}

/* 6. Lists, Follow-ups, Call Logs, Profiles & Search Sub-texts */
.fu-meta,
.fu-meta strong,
.fu-meta span {
    font-size: 0.875rem !important;
    color: var(--text-muted) !important;
    line-height: 1.4 !important;
}

.call-item-meta,
.search-item-meta,
.search-results-header {
    font-size: 0.875rem !important;
    color: var(--text-muted) !important;
    line-height: 1.4 !important;
}

/* 7. Form Field Hints, Labels & Modal Meta */
.form-label-hint,
.form-hint,
.form-text {
    font-size: 0.875rem !important;
    color: var(--text-muted) !important;
    line-height: 1.4 !important;
    margin-top: 0.25rem;
}

.meta-field .meta-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.meta-field .meta-subtext,
.meta-field .meta-hint {
    font-size: 0.875rem !important;
    color: var(--text-muted) !important;
    line-height: 1.4 !important;
}

.modal-subtitle,
.modal-header p,
.modal-meta-text {
    font-size: 0.875rem !important;
    color: var(--text-muted) !important;
    line-height: 1.45 !important;
}

/* Grid Layout Systems */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    min-width: 0;
    max-width: 100%;
}

.grid-4>* {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    min-width: 0;
    max-width: 100%;
}

.grid-2>* {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Direct Laptop Softphone & DTMF Dialpad */
.dtmf-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: all 0.15s ease;
    user-select: none;
}

.dtmf-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.dtmf-btn:active {
    transform: translateY(1px);
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

/* Professional Outbound VID Dropdown Popover */
.vid-picker-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vid-picker-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.vid-picker-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vid-picker-avatar.admin {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
}

.vid-picker-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.vid-picker-dropdown.open .vid-picker-chevron {
    transform: rotate(180deg);
}

.vid-picker-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    z-index: 1050;
    overflow: hidden;
    backdrop-filter: blur(16px);
    animation: fadeInScale 0.15s ease-out;
}

.vid-picker-menu-header {
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vid-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.12s ease;
}

.vid-picker-item:last-child {
    border-bottom: none;
}

.vid-picker-item:hover {
    background: var(--bg-surface-hover);
}

.vid-picker-item.active {
    background: rgba(16, 185, 129, 0.08);
}

/* Spinner Animation */
.spinner-sm {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.65s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   ENTERPRISE RESPONSIVE SYSTEM - ALL DEVICE BREAKPOINTS (320px to 1440px+)
   ========================================================================== */

/* 1. Large Desktops & Widescreens (1440px+) */
@media (min-width: 1440px) {
    .content-body {
        padding: 1.75rem 2.25rem;
        max-width: 1920px;
        margin: 0 auto;
        width: 100%;
    }

    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }

    .global-search-container {
        max-width: 600px;
    }
}

/* 2. Laptops & Standard Desktops (1024px – 1439px) */
@media (max-width: 1439px) and (min-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .grid-2 {
        grid-template-columns: 1.8fr 1.2fr;
    }
}

/* 3. Tablets & Small Laptops (768px – 1023px) */
@media (max-width: 1023px) {
    .grid-2 {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 1.25rem !important;
    }

    .grid-2>* {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }

    .content-body {
        padding: 1.25rem;
    }

    .drawer-panel {
        width: 720px;
        max-width: 95vw;
    }
}

/* 4. Medium Tablets & Mobile Transition (max-width: 900px) */
@media (max-width: 900px) {
    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-popover);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .top-header {
        padding: 0 1rem;
        gap: 0.65rem;
    }
}

/* 5. Mobile Phones & Phablets (max-width: 767px) */
@media (max-width: 767px) {
    :root {
        --header-height: auto;
    }

    .top-header {
        display: grid !important;
        grid-template-columns: auto 1fr !important;
        grid-template-rows: auto auto !important;
        grid-template-areas:
            "brand actions"
            "search search" !important;
        padding: 0.65rem 0.85rem !important;
        gap: 0.55rem 0.5rem !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        background: var(--bg-surface) !important;
        border-bottom: 1px solid var(--border-color) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        box-sizing: border-box !important;
    }

    .top-header-left {
        grid-area: brand !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.45rem !important;
    }

    .mobile-header-brand {
        display: inline-flex !important;
    }

    .header-actions {
        grid-area: actions !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0.35rem !important;
        margin: 0 !important;
        flex-wrap: nowrap !important;
    }

    /* Make top action buttons compact circular/pill icon buttons on mobile */
    .header-actions .btn {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        padding: 0 !important;
        border-radius: var(--radius-full) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    .header-actions .btn span {
        display: none !important;
    }

    .header-actions .btn svg,
    .header-actions .btn .icon {
        margin: 0 !important;
        width: 15px !important;
        height: 15px !important;
        display: block !important;
    }

    /* Hide Logout on phone navbar as requested (available in sidebar) */
    #btn-logout {
        display: none !important;
    }

    /* Simulation button hidden on mobile to prioritize real telephony controls */
    #btn-open-simulate-call {
        display: none !important;
    }

    /* Theme Toggle Button on Mobile */
    .theme-toggle-btn {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        padding: 0 !important;
        border-radius: var(--radius-full) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .theme-toggle-btn #theme-toggle-label {
        display: none !important;
    }

    .theme-toggle-btn svg {
        margin: 0 !important;
        width: 14px !important;
        height: 14px !important;
    }

    /* User Switcher on Mobile (Compact & Sleek) */
    .user-switcher-trigger {
        height: 32px !important;
        padding: 0 0.4rem !important;
        border-radius: var(--radius-full) !important;
        gap: 0.2rem !important;
        background: var(--bg-surface-elevated) !important;
        border: 1px solid var(--border-color) !important;
    }

    .user-switcher-icon svg {
        width: 13px !important;
        height: 13px !important;
    }

    .user-switcher-chevron {
        width: 10px !important;
        height: 10px !important;
    }

    .user-switcher-current-name {
        max-width: 48px !important;
        font-size: 0.6875rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .user-switcher-menu {
        position: fixed !important;
        left: 0.75rem !important;
        right: 0.75rem !important;
        top: 56px !important;
        width: auto !important;
        max-width: calc(100vw - 1.5rem) !important;
        box-shadow: var(--shadow-popover) !important;
        z-index: 1050 !important;
    }

    /* Dedicated Full-Width Search Command Bar on Row 2 */
    .global-search-container {
        grid-area: search !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        position: relative !important;
    }

    .search-input-wrapper {
        width: 100% !important;
        position: relative !important;
        display: flex !important;
        align-items: center !important;
    }

    .global-search-input {
        width: 100% !important;
        height: 38px !important;
        padding: 0.4rem 2.2rem 0.4rem 2.3rem !important;
        font-size: 0.8125rem !important;
        border-radius: var(--radius-full) !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    }

    .search-shortcut-hint {
        display: none !important;
    }

    .search-results-dropdown {
        position: absolute !important;
        top: calc(100% + 4px) !important;
        left: 0 !important;
        right: 0 !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 60vh !important;
        z-index: 1050 !important;
        box-shadow: var(--shadow-popover) !important;
    }

    .search-result-item {
        padding: 0.65rem 0.75rem !important;
        gap: 0.6rem !important;
    }

    .content-body {
        padding: 0.75rem;
    }

    .grid-4 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Cards & Headers */
    .card {
        padding: 0.85rem;
        border-radius: var(--radius-md);
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .card-header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 0.6rem !important;
        padding-bottom: 0.6rem;
    }

    .card-title {
        font-size: 0.95rem;
    }

    /* Team and Administration Table Responsive Enhancements */
    #admin-team-table-body td,
    #admin-audit-table-body td,
    #smartflo-token-table-body td {
        font-size: 0.78rem;
    }

    #reassign-customer-checklist {
        max-height: 160px !important;
        padding: 0.65rem !important;
    }

    #reassign-customer-checklist label {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        padding: 0.25rem 0.15rem !important;
        font-size: 0.8125rem !important;
        cursor: pointer;
    }

    /* Highlights grid */
    #calling-perf-highlights-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    /* Full-screen Drawer on Mobile */
    .drawer-panel {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        border-left: none !important;
    }

    .drawer-header {
        padding: 0.75rem 1rem;
    }

    .drawer-tabs-nav {
        padding: 0 0.5rem;
    }

    .drawer-tab-btn {
        padding: 0.5rem 0.65rem;
        font-size: 0.78rem;
    }

    /* Floating CTI Call Cards on Mobile */
    #cti-live-calls-container {
        left: 0.5rem !important;
        right: 0.5rem !important;
        bottom: 0.5rem !important;
        width: auto !important;
        max-width: 100% !important;
    }

    .cti-call-card {
        width: 100% !important;
        padding: 0.75rem !important;
    }

    /* Modals Responsive on Mobile */
    .modal-overlay {
        padding: 0.5rem !important;
        align-items: flex-end !important;
    }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh !important;
        margin: 0 auto !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .modal-header {
        padding: 0.85rem 1rem !important;
    }

    .modal-body {
        padding: 0.85rem 1rem !important;
        max-height: calc(92vh - 130px) !important;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        padding: 0.75rem 1rem !important;
        flex-direction: column-reverse !important;
        gap: 0.5rem !important;
    }

    .modal-footer button {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Form Controls on Mobile (Prevent iOS Auto-zoom) */
    .form-control,
    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Tables Touch Scrolling */
    .table-container {
        border-radius: var(--radius-sm);
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        overflow-x: auto;
        border: 1px solid var(--border-color);
        background: var(--bg-surface);
    }

    .table th,
    .table td {
        padding: 0.55rem 0.5rem;
        font-size: 0.8rem;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }

    /* Pagination Responsive on Mobile */
    .pagination-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
        padding: 0.75rem 0.85rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .pagination-info-group {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        font-size: 0.75rem !important;
    }

    .pagination-controls,
    #call-logs-pagination-controls {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        gap: 0.2rem !important;
        flex-wrap: nowrap !important;
    }

    .btn-pag-nav {
        min-width: 28px !important;
        height: 28px !important;
        padding: 0 5px !important;
        font-size: 0.75rem !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .btn-pag-nav .pag-text {
        display: none !important;
    }

    /* Standalone Login Screen */
    #view-login {
        padding: 1rem;
    }

    #view-login .card {
        padding: 1.5rem 1.15rem !important;
    }
}

/* 6. Compact Mobile Phones (320px – 480px) */
@media (max-width: 480px) {
    .kpi-card {
        padding: 0.85rem;
    }

    .kpi-value {
        font-size: 1.35rem;
    }

    .kpi-icon-box {
        width: 36px;
        height: 36px;
    }

    .kpi-icon-box svg {
        width: 18px;
        height: 18px;
    }

    .user-switcher-trigger {
        padding: 0 0.4rem;
    }

    .user-switcher-menu {
        width: 280px;
        max-width: 92vw;
    }
}

/* ============================================================
   PREMIUM INTUITIVE SEGMENTED TAB CONTROL SYSTEM
   ============================================================ */
.cust-tabs-nav,
.intel-tabs-nav,
.segmented-tabs-track {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-elevated, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-lg, 10px);
    padding: 4px;
    gap: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cust-subtab-btn,
.intel-tab-btn,
.segmented-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    background: transparent;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-lg, 10px) - 3px);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
    position: relative;
    text-decoration: none;
}

.cust-subtab-btn:hover,
.intel-tab-btn:hover,
.segmented-tab-btn:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .cust-subtab-btn:hover,
[data-theme="dark"] .intel-tab-btn:hover,
[data-theme="dark"] .segmented-tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

/* Active Elevated Segmented Tab */
.cust-subtab-btn.active,
.intel-tab-btn.active,
.segmented-tab-btn.active {
    color: var(--primary, #4f46e5) !important;
    background: var(--bg-surface, #ffffff) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    font-weight: 700 !important;
}

[data-theme="dark"] .cust-subtab-btn.active,
[data-theme="dark"] .intel-tab-btn.active,
[data-theme="dark"] .segmented-tab-btn.active {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

/* Active tab micro-accent bottom border */
.cust-subtab-btn.active::after,
.intel-tab-btn.active::after,
.segmented-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 15%;
    right: 15%;
    height: 2px;
    background: var(--primary, #4f46e5);
    border-radius: 2px;
}

/* Tab Badges */
.cust-subtab-btn .badge,
.intel-tab-btn .intel-tab-badge,
.segmented-tab-btn .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    min-width: 20px;
    transition: all 0.2s ease;
}

/* Inactive Badge */
.cust-subtab-btn:not(.active) .badge,
.intel-tab-btn:not(.active) .intel-tab-badge {
    background: rgba(0, 0, 0, 0.06) !important;
    color: var(--text-muted) !important;
    border: 1px solid transparent !important;
}

[data-theme="dark"] .cust-subtab-btn:not(.active) .badge,
[data-theme="dark"] .intel-tab-btn:not(.active) .intel-tab-badge {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-muted) !important;
}

/* Active Badge */
.cust-subtab-btn.active .badge,
.intel-tab-btn.active .intel-tab-badge {
    background: rgba(99, 102, 241, 0.15) !important;
    color: var(--primary, #4f46e5) !important;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
}

.cust-subtab-btn.active #nav-badge-assigned-focus {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #d97706 !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

/* ==========================================================================
   RESPONSIVE TABLES & CONTAINER OVERFLOW CONTROL (ACROSS ENTIRE CRM)
   Guarantees no horizontal scrollbars on laptops/desktops with fluid auto-fit
   ========================================================================== */

/* Standard Laptops & 13-15" Displays (1024px - 1440px) */
@media screen and (max-width: 1440px) {
    .table th,
    .table td {
        padding: 0.55rem 0.45rem !important;
    }
    .table th {
        font-size: 0.79rem !important;
    }
    .table td {
        font-size: 0.90rem !important;
    }
    .table td .btn,
    .table td button {
        padding: 0.18rem 0.35rem !important;
        font-size: 0.75rem !important;
    }
    .table td .badge {
        padding: 0.12rem 0.38rem !important;
        font-size: 0.75rem !important;
    }
}

/* Compact Laptop Screens & Tablets (768px - 1200px) */
@media screen and (max-width: 1200px) {
    .table th,
    .table td {
        padding: 0.5rem 0.4rem !important;
    }
    .table th {
        font-size: 0.76rem !important;
        letter-spacing: 0.02em !important;
    }
    .table td {
        font-size: 0.88rem !important;
    }
    .table td small,
    .table td .subtext,
    .table td .table-subtext,
    .table td .text-muted,
    .table td .text-secondary {
        font-size: 0.80rem !important;
    }
}

/* ==========================================================================
   CALL ANALYTICS & AUTOMATED EMAIL REPORT STYLES
   ========================================================================== */
.analytics-period-btn {
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-surface, #ffffff);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.analytics-period-btn:hover {
    background: var(--bg-surface-elevated, #f8fafc);
    color: var(--text-primary, #1e293b);
    border-color: var(--border-strong, #cbd5e1);
}

.analytics-period-btn.active {
    background: var(--primary, #0284c7) !important;
    color: #ffffff !important;
    border-color: var(--primary, #0284c7) !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.28);
}

[data-theme="dark"] .analytics-period-btn {
    background: var(--bg-surface, #1e293b);
    border-color: var(--border-color, #334155);
    color: var(--text-secondary, #94a3b8);
}

[data-theme="dark"] .analytics-period-btn:hover {
    background: var(--bg-surface-elevated, #334155);
    color: var(--text-primary, #f8fafc);
    border-color: var(--border-strong, #475569);
}

[data-theme="dark"] .analytics-period-btn.active {
    background: var(--primary, #38bdf8) !important;
    color: #0f172a !important;
    border-color: var(--primary, #38bdf8) !important;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.35);
}

.analytics-kpi-card {
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 10px);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.analytics-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
}

.analytics-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.spinning {
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}