/* ============================================
   OneCRM Dark Theme
   A refined, industrial dark mode design
   ============================================ */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&family=JetBrains+Mono:wght@400;500&display=swap');

/* LineIcons Import */
@import url('https://cdn.lineicons.com/4.0/lineicons.css');

/* ============================================
   CSS Variables - Theme Foundation
   ============================================ */
:root,
[data-theme="dark"] {
    /* Spacing - Shared across themes */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Typography - Shared across themes */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Transitions - Shared across themes */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Accent Colors - Shared across themes */
    --accent-primary: #0ea5e9;
    --accent-primary-hover: #0284c7;
    --accent-primary-muted: rgba(14, 165, 233, 0.15);
    --accent-primary-glow: rgba(14, 165, 233, 0.4);

    /* Status Colors - Shared across themes */
    --status-success: #22c55e;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    --status-info: #3b82f6;

    /* Background Colors - Dark Theme */
    --bg-base: #0c0e12;
    --bg-surface: #12151a;
    --bg-elevated: #1a1e24;
    --bg-overlay: #222730;
    --bg-hover: #2a303a;

    /* Text Colors - Dark Theme */
    --text-primary: #f1f3f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-inverse: #0c0e12;
    --text-link: var(--text-primary);
    --text-link-hover: var(--accent-primary);

    /* Status Backgrounds - Dark Theme */
    --status-success-bg: rgba(34, 197, 94, 0.15);
    --status-warning-bg: rgba(245, 158, 11, 0.15);
    --status-danger-bg: rgba(239, 68, 68, 0.15);
    --status-info-bg: rgba(59, 130, 246, 0.15);

    /* Border Colors - Dark Theme */
    --border-default: #2a303a;
    --border-subtle: #1f242d;
    --border-hover: #3b4455;

    /* Shadows - Dark Theme */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px var(--accent-primary-glow);

    /* Form select arrow - Dark Theme */
    --select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* ============================================
   Light Theme
   ============================================ */
[data-theme="light"] {
    /* Background Colors - Light Theme */
    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-elevated: #f8fafc;
    --bg-overlay: #e2e8f0;
    --bg-hover: #e2e8f0;

    /* Text Colors - Light Theme */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    --text-link: var(--text-primary);
    --text-link-hover: var(--accent-primary);

    /* Status Backgrounds - Light Theme */
    --status-success-bg: rgba(34, 197, 94, 0.15);
    --status-warning-bg: rgba(245, 158, 11, 0.15);
    --status-danger-bg: rgba(239, 68, 68, 0.15);
    --status-info-bg: rgba(59, 130, 246, 0.15);

    /* Border Colors - Light Theme */
    --border-default: #cbd5e1;
    --border-subtle: #e2e8f0;
    --border-hover: #94a3b8;

    /* Shadows - Light Theme */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.2);

    /* Form select arrow - Light Theme */
    --select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

DIV[nordpass-icon]
{
    display:none !important;
    z-index:-999;
}

/* ============================================
   Base Styles
   ============================================ */
html {
    font-size: 15px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Layout Structure
   ============================================ */
#wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
}

/* Sidebar */
#sidebar-wrapper {
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 100%) !important;
    border-right: 1px solid var(--border-subtle);
    width: 260px !important;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

#sidebar-wrapper::-webkit-scrollbar {
    width: 6px;
}

#sidebar-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 3px;
}

.sidebar-heading {
    padding: 1.5rem 1.25rem !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--border-subtle) !important;
}

.sidebar-heading a {
    color: var(--text-primary) !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Sidebar Logo */
.sidebar-logo {
    width: 32px;
    height: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    filter: blur(0);
}

/* Navigation Items */
#sidebar-wrapper .list-group {
    padding: 0.75rem 0.75rem;
}

#sidebar-wrapper .list-group-item {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    padding: 0.7rem 1rem !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#sidebar-wrapper .list-group-item i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    opacity: 0.7;
    transition: all var(--transition-base);
}

#sidebar-wrapper .list-group-item:hover {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
}

#sidebar-wrapper .list-group-item:hover i {
    opacity: 1;
    color: var(--accent-primary);
}

#sidebar-wrapper hr {
    border-color: var(--border-subtle) !important;
    margin: 0.75rem 0.5rem !important;
    opacity: 1;
}

/* Active Navigation Item */
#sidebar-wrapper .list-group-item.active {
    background: var(--accent-primary-muted) !important;
    color: var(--accent-primary) !important;
}

#sidebar-wrapper .list-group-item.active i {
    opacity: 1;
    color: var(--accent-primary);
}

/* Sub Navigation Items */
#sidebar-wrapper .nav-sub-items {
    padding-left: 1rem;
    margin-bottom: 0.5rem;
}

#sidebar-wrapper .nav-sub-item {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
    border-left: 2px solid var(--border-subtle);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    margin-left: 0.75rem;
    margin-bottom: 0;
}

#sidebar-wrapper .nav-sub-item:hover {
    border-left-color: var(--accent-primary);
    color: var(--text-secondary) !important;
}

#sidebar-wrapper .nav-sub-item.nav-current {
    border-left-color: var(--accent-primary);
    color: var(--accent-primary) !important;
    background: transparent !important;
    cursor: default;
}

#sidebar-wrapper .nav-sub-item i {
    font-size: 0.9rem;
    width: 1.25rem;
}

/* Page Content Wrapper */
#page-content-wrapper {
    flex: 1;
    margin-left: 260px;
    height: 100vh;
    background: var(--bg-base);
    width: calc(100% - 260px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content {
    flex: 1;
    overflow-y: auto;
}

/* Top Navigation Bar */
#page-content-wrapper > .navbar {
    background: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    padding: 0.75rem 1.5rem !important;
    min-height: auto;
    flex-shrink: 0;
    z-index: 100;
}

#page-content-wrapper > .navbar .container-fluid {
    padding: 0 !important;
    min-height: auto;
}

.navbar-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
}

.navbar-title.visible {
    opacity: 1;
    transform: translateX(0);
}

#page-content-wrapper > .navbar .navbar-text {
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#page-content-wrapper > .navbar .text-muted {
    color: var(--text-secondary) !important;
    font-size: 0.9rem;
}

/* Navigation Progress Bar */
.nav-progress-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1030;
    background: linear-gradient(90deg, transparent, var(--accent-primary), #8b5cf6, var(--accent-primary), transparent);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.nav-progress-bar.active {
    opacity: 1;
    animation: navProgress 2.5s linear infinite;
}

@keyframes navProgress {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Main Content Area */
.container-fluid {
    padding: 2rem !important;
    max-width: 100%;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; font-weight: 600; }
h6 { font-size: 0.875rem; font-weight: 600; }

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-link-hover);
}

/* ============================================
   Page Header Component
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   Card Component
   ============================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary) 0%, #8b5cf6 50%, #ec4899 100%);
    z-index: 1;
}

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

.card-header {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    padding: 1.25rem 1.5rem !important;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-header .fw-bold {
    font-size: 1.05rem;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
}

.card-header .btn {
    margin-left: auto;
}

.card-header-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--accent-primary-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.card-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.card-header-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.card-body {
    padding: 1.25rem !important;
    --bs-card-color: var(--text-primary);
    color: var(--text-primary);
}

.card-footer {
    background: var(--bg-elevated) !important;
    border-top: 1px solid var(--border-subtle) !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card-text {
    color: var(--text-secondary);
}

/* Card with table - no padding so tables consume full width */
.card-table .card-body {
    padding: 0 !important;
}

.card-table .table {
    margin-bottom: 0;
}

/* When card-table has a header, table header doesn't need top radius */
.card-table .card-header + .card-body .table thead th:first-child,
.card-table .card-header + .card-body .table thead th:last-child {
    border-radius: 0;
}

/* Card with accent border */
.card-accent {
    border-left: 3px solid var(--accent-primary);
}

.card-accent-danger {
    border-left: 3px solid var(--status-danger);
}

.card-accent-success {
    border-left: 3px solid var(--status-success);
}

/* Danger Card - for alerts/warnings */
.card-danger::before {
    background: linear-gradient(90deg, var(--status-danger) 0%, #f97316 100%);
}

.card-header-icon-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger);
}

/* ============================================
   Stat Cards
   ============================================ */
.stat-card {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

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

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

.stat-value {
    font-size: 2.5rem !important;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem !important;
    font-weight: 500;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Stat card color variants */
.stat-card .text-primary {
    color: var(--accent-primary) !important;
}

.stat-card .text-success {
    color: var(--status-success) !important;
}

.stat-card .text-danger {
    color: var(--status-danger) !important;
}

.stat-card .text-warning {
    color: var(--status-warning) !important;
}

/* ============================================
   Tables
   ============================================ */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-color: var(--text-primary);
    color: var(--text-primary);
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.875rem 1.25rem;
    color: var(--text-primary);
}

.table td, .table th {
    color: var(--text-primary);
}

.table tbody td {
    color: var(--text-primary);
}

.table thead th {
    background: #0f1216 !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle) !important;
}


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

/* Rounded corners for table cells to match card border-radius */
.card .table tbody tr:last-child td:first-child {
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
}

.card .table tbody tr:last-child td:last-child {
    border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}

/* Table header gets top radius when card has no header */
.card-table > .card-body:first-child .table thead th:first-child {
    border-top-left-radius: calc(var(--radius-lg) - 1px);
}

.card-table > .card-body:first-child .table thead th:last-child {
    border-top-right-radius: calc(var(--radius-lg) - 1px);
}

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

.table-hover tbody tr:hover {
    background: var(--bg-hover) !important;
    --bs-table-hover-bg: var(--bg-hover);
}

/* Table status rows */
.table-danger {
    --bs-table-bg: var(--status-danger-bg) !important;
    --bs-table-color: var(--text-primary);
    background: var(--status-danger-bg) !important;
}

.table-warning {
    --bs-table-bg: var(--status-warning-bg) !important;
    --bs-table-color: var(--text-primary);
    background: var(--status-warning-bg) !important;
}

.table-success {
    --bs-table-bg: var(--status-success-bg) !important;
    --bs-table-color: var(--text-primary);
    background: var(--status-success-bg) !important;
}

/* Action buttons in tables */
.btn-actions {
    white-space: nowrap;
}

.btn-actions .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Table Row Icons (Products, Services) */
.product-icon,
.service-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.product-icon.category-m365 { background: rgba(0, 120, 212, 0.15); color: #0078d4; }
.product-icon.category-hardware { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.product-icon.category-software { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.product-icon.category-support { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.product-icon.category-connectivity { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; }
.product-icon.category-security { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.product-icon.category-backup { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.product-icon.category-default { background: var(--bg-elevated); color: var(--text-muted); }

/* Sortable Table Headers */
.sort-header {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    padding: 0.2rem 0.4rem;
    margin: -0.2rem -0.4rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.sort-header:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sort-header.active {
    color: var(--accent-primary);
}

.sort-header.active:hover {
    background: var(--accent-primary-muted);
}

.sort-header i {
    font-size: 0.65rem;
    transition: transform var(--transition-fast);
    opacity: 0.4;
}

.sort-header:hover i {
    opacity: 0.7;
}

.sort-header.active i {
    opacity: 1;
    color: var(--accent-primary);
}

/* Non-clickable sort-header (span) */
span.sort-header {
    cursor: default;
}

span.sort-header:hover {
    background: none;
    color: var(--text-muted);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    font-family: var(--font-sans);
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn i,
.btn .lni {
    line-height: 1;
}

.btn:focus {
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

/* Primary Button */
.btn-primary {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    color: var(--text-inverse);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 20px var(--accent-primary-glow);
}

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

/* Outline Buttons */
.btn-outline-primary {
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    background: transparent;
}

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

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

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-outline-danger {
    border: 1px solid var(--status-danger);
    color: var(--status-danger);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--status-danger-bg);
    border-color: var(--status-danger);
    color: var(--status-danger);
}

.btn-outline-warning {
    border: 1px solid var(--status-warning);
    color: var(--status-warning);
    background: transparent;
}

.btn-outline-warning:hover {
    background: var(--status-warning-bg);
    border-color: var(--status-warning);
    color: var(--status-warning);
}

.btn-outline-success {
    border: 1px solid var(--status-success);
    color: var(--status-success);
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--status-success-bg);
    border-color: var(--status-success);
    color: var(--status-success);
}

.btn-outline-info {
    border: 1px solid var(--status-info);
    color: var(--status-info);
    background: transparent;
}

.btn-outline-info:hover {
    background: var(--status-info-bg);
    border-color: var(--status-info);
    color: var(--status-info);
}

/* Small Buttons */
.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* Icon-only small button — match exact height of .btn-sm text buttons */
.btn-sm.btn-icon {
    padding: 0 0.55rem;
    height: calc(0.8rem * 1.6 + 0.8rem);
}

/* Danger Button */
.btn-danger {
    background: var(--status-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(239, 68, 68, 0.4);
}

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

/* Warning Button */
.btn-warning {
    background: var(--status-warning);
    color: #1c1917;
}

.btn-warning:hover {
    background: #d97706;
    color: #1c1917;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(245, 158, 11, 0.4);
}

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

/* Success Button */
.btn-success {
    background: var(--status-success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(34, 197, 94, 0.4);
}

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

/* Info Button */
.btn-info {
    background: var(--status-info);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(59, 130, 246, 0.4);
}

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

/* ============================================
   Badges
   ============================================ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.4em 0.75em;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
}

.bg-primary {
    background: var(--accent-primary-muted) !important;
    color: var(--accent-primary) !important;
}

.bg-secondary {
    background: var(--bg-overlay) !important;
    color: var(--text-secondary) !important;
}

.bg-success {
    background: var(--status-success-bg) !important;
    color: var(--status-success) !important;
}

.bg-danger {
    background: var(--status-danger-bg) !important;
    color: var(--status-danger) !important;
}

.bg-warning {
    background: var(--status-warning-bg) !important;
    color: var(--status-warning) !important;
}

.bg-info {
    background: var(--status-info-bg) !important;
    color: var(--status-info) !important;
}

/* ============================================
   Forms
   ============================================ */
.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.form-control {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.form-select {
    background-color: var(--bg-elevated);
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.7rem 2.5rem 0.7rem 1rem;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

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

.form-control:focus {
    background: var(--bg-overlay);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
    color: var(--text-primary);
}

.form-select:focus {
    background-color: var(--bg-overlay);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
    color: var(--text-primary);
}

.form-control:disabled {
    background: var(--bg-surface);
    color: var(--text-muted);
    opacity: 0.7;
}

.form-select:disabled {
    background-color: var(--bg-surface);
    color: var(--text-muted);
    opacity: 0.7;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

/* Date inputs */
input[type="date"].form-control,
input[type="datetime-local"].form-control {
    color-scheme: dark;
}

[data-theme="light"] input[type="date"].form-control,
[data-theme="light"] input[type="datetime-local"].form-control {
    color-scheme: light;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator,
input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator {
    filter: var(--date-icon-filter, invert(1) brightness(0.8));
    cursor: pointer;
}

[data-theme="light"] input[type="date"].form-control::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator {
    filter: none;
}

/* Checkbox and radio labels */
.form-check-label {
    color: var(--text-primary);
}

.form-check-input {
    background-color: var(--bg-elevated);
    border-color: var(--border-default);
}

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

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

.input-group-text {
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-right: none;
    color: var(--text-muted);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .form-control {
    border-left: none;
}

.input-group .form-control:focus {
    border-left: none;
}

/* Validation */
.text-danger {
    color: var(--status-danger) !important;
    font-size: 0.8rem;
}

.is-invalid {
    border-color: var(--status-danger) !important;
}

.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--status-danger-bg) !important;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    border: none;
}

.alert-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger);
    border-left: 3px solid var(--status-danger);
}

.alert-success {
    background: var(--status-success-bg);
    color: var(--status-success);
    border-left: 3px solid var(--status-success);
}

.alert-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning);
    border-left: 3px solid var(--status-warning);
}

.alert-info {
    background: var(--status-info-bg);
    color: var(--status-info);
    border-left: 3px solid var(--status-info);
}

/* ============================================
   Conditional Fields (Forms)
   ============================================ */
.conditional-fields {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.conditional-fields h5 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ============================================
   Modals
   ============================================ */
.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-secondary);
}

.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 1rem 1.5rem;
}

.modal-dialog.modal-lg {
    width: 800px;
    max-width: 90vw;
}

.modal-dialog.modal-xl {
    width: 1140px;
    max-width: 95vw;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.5;
}

[data-theme="dark"] .btn-close:hover {
    opacity: 1;
}

[data-theme="light"] .btn-close {
    opacity: 0.5;
}

[data-theme="light"] .btn-close:hover {
    opacity: 1;
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.theme-toggle {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.6rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.theme-toggle .lni-sun {
    display: none;
}

.theme-toggle .lni-night {
    display: inline-block;
}

[data-theme="light"] .theme-toggle .lni-sun {
    display: inline-block;
}

[data-theme="light"] .theme-toggle .lni-night {
    display: none;
}

/* ============================================
   Description Lists (Details pages)
   ============================================ */
dl.row {
    margin-bottom: 0;
}

dl.row dt {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
}

dl.row dd {
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* ============================================
   Horizontal Rules
   ============================================ */
hr {
    border-color: var(--border-subtle);
    opacity: 1;
}

/* ============================================
   List Groups (for search results)
   ============================================ */
.list-group-item {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background: var(--bg-hover);
    color: var(--text-primary);
}

#groupResults {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

#groupResults .list-group-item {
    border-color: var(--border-subtle);
    border-left: none;
    border-right: none;
    padding: 0.875rem 1rem;
}

#groupResults .list-group-item:first-child {
    border-top: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

#groupResults .list-group-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 5px;
    border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-muted {
    color: var(--text-muted) !important;
}

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

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

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

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

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

.border-secondary {
    border-color: var(--border-subtle) !important;
}

.border-bottom {
    border-bottom-color: var(--border-subtle) !important;
}

.bg-light {
    background: var(--bg-elevated) !important;
}

.bg-dark {
    background: var(--bg-surface) !important;
}

/* ============================================
   Progress Bars (for licence usage)
   ============================================ */
.progress {
    background: var(--bg-overlay);
    border-radius: var(--radius-sm);
    height: 6px;
    overflow: hidden;
}

.progress-bar {
    background: var(--accent-primary);
    transition: width var(--transition-slow);
}

.progress-bar.bg-success {
    background: var(--status-success) !important;
}

.progress-bar.bg-warning {
    background: var(--status-warning) !important;
}

.progress-bar.bg-danger {
    background: var(--status-danger) !important;
}

/* ============================================
   Row Highlight Utilities
   ============================================ */
.row-highlight {
    position: relative;
}

.row-highlight::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.row-highlight:hover::before {
    opacity: 1;
}

/* ============================================
   Table Search & Filter Controls
   Standardised inputs for filtering tables
   ============================================ */
.table-search,
.table-filter {
    position: relative;
}

.table-search {
    width: 220px;
}

.table-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.875rem;
}

.table-search input,
.table-filter select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

.table-search input {
    padding-left: 2.25rem;
}

.table-filter select {
    padding-right: 2rem;
    cursor: pointer;
    appearance: none;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.75rem;
}

.table-search input:focus,
.table-filter select:focus {
    outline: none;
    background: var(--bg-surface);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

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

/* Breadcrumbs */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

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

.breadcrumb-nav a:hover {
    color: var(--text-link-hover);
}

.breadcrumb-nav .breadcrumb-separator {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.breadcrumb-nav .breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Table Links - Standardised link styles for tables */
.table-link {
    color: var(--text-link);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.table-link:hover {
    color: var(--text-link-hover);
}

.table-link-secondary {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.table-link-secondary:hover {
    color: var(--text-link);
}

/* Status Indicator Dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.status-dot-danger {
    background: var(--status-danger);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulseDanger 2s ease-in-out infinite;
}

.status-dot-warning {
    background: var(--status-warning);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: pulseWarning 2.5s ease-in-out infinite;
}

.status-dot-success {
    background: var(--status-success);
}

@keyframes pulseDanger {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes pulseWarning {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* Table cell with status dot */
.table-cell-status {
    display: flex;
    align-items: center;
}

/* ============================================
   Animation Utilities
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        position: fixed;
        left: -260px;
        transition: left var(--transition-base);
    }

    #sidebar-wrapper.show {
        left: 0;
    }

    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .container-fluid {
        padding: 1rem !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

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

/* ============================================
   Light Theme Specific Overrides
   ============================================ */

/* Sidebar */
[data-theme="light"] #sidebar-wrapper {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    border-right: 1px solid var(--border-default) !important;
}

[data-theme="light"] .sidebar-heading {
    border-bottom: 1px solid var(--border-default) !important;
}

[data-theme="light"] #sidebar-wrapper .list-group-item {
    color: var(--text-secondary) !important;
}

[data-theme="light"] #sidebar-wrapper .list-group-item:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] #sidebar-wrapper hr {
    border-color: var(--border-default) !important;
}

[data-theme="light"] #sidebar-wrapper .list-group-item.active {
    background: var(--accent-primary-muted) !important;
    color: var(--accent-primary) !important;
}

[data-theme="light"] #sidebar-wrapper .nav-sub-item {
    color: var(--text-muted) !important;
    border-left-color: var(--border-default);
}

[data-theme="light"] #sidebar-wrapper .nav-sub-item:hover {
    color: var(--text-secondary) !important;
}

[data-theme="light"] #sidebar-wrapper .nav-sub-item.nav-current {
    color: var(--accent-primary) !important;
}

/* Cards */
[data-theme="light"] .card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .card::before {
    opacity: 0.9;
}

[data-theme="light"] .card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%) !important;
    border-bottom: 1px solid var(--border-default) !important;
    color: var(--text-primary);
}

[data-theme="light"] .stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border-default);
}

[data-theme="light"] .stat-card::before {
    background: linear-gradient(90deg, var(--accent-primary), transparent);
}

/* Table Search & Filter */
[data-theme="light"] .table-search input,
[data-theme="light"] .table-filter select {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

[data-theme="light"] .table-search input:focus,
[data-theme="light"] .table-filter select:focus {
    background: var(--bg-surface);
}

/* Tables */
[data-theme="light"] .table {
    color: var(--text-primary);
}

[data-theme="light"] .table > :not(caption) > * > * {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-default);
}

[data-theme="light"] .table thead th {
    background: #f1f5f9 !important;
    color: var(--text-secondary) !important;
    border-bottom: 1px solid var(--border-default) !important;
}

[data-theme="light"] .table td,
[data-theme="light"] .table th,
[data-theme="light"] .table tbody td {
    color: var(--text-primary);
}

[data-theme="light"] .table-hover tbody tr:hover {
    background: var(--bg-hover) !important;
}

/* Forms */
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}

[data-theme="light"] .form-control:focus {
    background: var(--bg-surface);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

[data-theme="light"] .form-select:focus {
    background-color: var(--bg-surface);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

[data-theme="light"] .form-control::placeholder {
    color: var(--text-muted);
}

[data-theme="light"] .form-label {
    color: var(--text-secondary);
}

[data-theme="light"] .input-group-text {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

/* Buttons */
[data-theme="light"] .btn-primary {
    color: #ffffff;
}

[data-theme="light"] .btn-primary:hover {
    color: #ffffff;
    box-shadow: var(--shadow-md), 0 0 20px rgba(14, 165, 233, 0.25);
}

[data-theme="light"] .btn-outline-secondary {
    border-color: var(--border-default);
    color: var(--text-secondary);
}

[data-theme="light"] .btn-outline-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Navbar */
[data-theme="light"] #page-content-wrapper > .navbar {
    background: color-mix(in srgb, var(--bg-surface) 85%, transparent) !important;
    border-bottom: 1px solid var(--border-default) !important;
}

/* Conditional Fields */
[data-theme="light"] .conditional-fields {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
}

/* Modals */
[data-theme="light"] .modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
}

[data-theme="light"] .modal-header {
    border-bottom: 1px solid var(--border-default);
}

[data-theme="light"] .modal-footer {
    border-top: 1px solid var(--border-default);
}

.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1040;
    animation: backdropFadeIn 0.2s ease forwards;
}

.modal-backdrop-custom.closing {
    animation: backdropFadeOut 0.2s ease forwards;
}

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

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

.modal.show-custom {
    animation: modalFadeIn 0.25s ease forwards;
}

.modal.show-custom.closing {
    animation: modalFadeOut 0.2s ease forwards;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes modalFadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

/* List Groups / Search Results */
[data-theme="light"] .list-group-item {
    background: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-primary);
}

[data-theme="light"] .list-group-item-action:hover,
[data-theme="light"] .list-group-item-action:focus {
    background: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="light"] #groupResults {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
}

/* Scrollbars */
[data-theme="light"]::-webkit-scrollbar-track {
    background: var(--bg-base);
}

[data-theme="light"]::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border: 2px solid var(--bg-base);
}

[data-theme="light"]::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Theme Toggle */
[data-theme="light"] .theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

[data-theme="light"] .theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   Multi-Select Component
   A reusable tag-based multi-select dropdown
   ============================================ */
.multi-select {
    position: relative;
}

.multi-select-trigger {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    min-height: 42px;
    padding: 0.375rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.multi-select-trigger:hover {
    border-color: var(--border-hover);
}

.multi-select-trigger:focus-within,
.multi-select.open .multi-select-trigger {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.multi-select-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}

.multi-select-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    max-width: 200px;
    animation: tagEnter 0.15s ease-out;
}

@keyframes tagEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.multi-select-tag-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--accent-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.multi-select-tag-remove:hover {
    background: var(--accent-primary);
    color: white;
}

.multi-select-tag-remove i {
    font-size: 0.625rem;
    line-height: 1;
}

.multi-select-placeholder {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.multi-select-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: auto;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.multi-select.open .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1060;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

/* Ensure dropdown works inside modals */
.modal .multi-select-dropdown {
    z-index: 1070;
}

.multi-select.open .multi-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.multi-select-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.multi-select-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.multi-select-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-surface);
}

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

.multi-select-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.5rem;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.multi-select-option:hover {
    background: var(--bg-elevated);
}

.multi-select-option.selected {
    background: var(--accent-primary-muted);
}

.multi-select-option-checkbox {
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.multi-select-option-checkbox input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.multi-select-option-checkbox .checkbox-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--bg-surface);
    border: 2px solid var(--border-default);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.multi-select-option-checkbox input:checked + .checkbox-visual {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.multi-select-option-checkbox .checkbox-visual i {
    font-size: 0.625rem;
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition-fast);
}

.multi-select-option-checkbox input:checked + .checkbox-visual i {
    opacity: 1;
    transform: scale(1);
}

.multi-select-option-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.multi-select-option.hidden {
    display: none;
}

.multi-select-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.multi-select-actions {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.multi-select-actions button {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.multi-select-clear {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.multi-select-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.multi-select-done {
    background: var(--accent-primary);
    border: none;
    color: white;
}

.multi-select-done:hover {
    background: var(--accent-primary-hover);
}

/* Light theme adjustments */
[data-theme="light"] .multi-select-tag {
    background: rgba(14, 165, 233, 0.12);
}

[data-theme="light"] .multi-select-option.selected {
    background: rgba(14, 165, 233, 0.08);
}

/* ============================================
   Navigation Ribbon
   A reusable tab/pill navigation component
   ============================================ */
.nav-ribbon {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.nav-ribbon-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-ribbon-item:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-ribbon-item.active {
    color: var(--accent-primary);
    background: var(--accent-primary-muted);
}

.nav-ribbon-item i {
    font-size: 1rem;
}

/* ============================================
   Customer Switcher
   ============================================ */
.customer-switcher {
    position: relative;
    flex-shrink: 0;
}

.customer-switcher.open {
    z-index: 1050;
}

.customer-switcher-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.customer-switcher-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

.customer-switcher-btn i:first-child {
    font-size: 0.9rem;
}

.customer-switcher-chevron {
    font-size: 0.65rem !important;
    transition: transform var(--transition-fast);
    margin-left: 0.25rem;
}

.customer-switcher-chevron.open {
    transform: rotate(180deg);
}

/* Transparent overlay to catch outside clicks */
.customer-switcher-overlay {
    position: fixed;
    inset: 0;
    z-index: 1049;
}

/* Dropdown panel */
.customer-switcher-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    z-index: 1050;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: switcherDropIn 0.15s ease-out;
}

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

/* Search input */
.customer-switcher-search {
    position: relative;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.customer-switcher-search i {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.customer-switcher-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.customer-switcher-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

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

/* Scrollable customer list */
.customer-switcher-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 0.375rem;
}

/* Individual customer item */
.customer-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    text-align: left;
    font-family: var(--font-sans);
}

.customer-switcher-item:hover {
    background: var(--bg-elevated);
}

.customer-switcher-item.active {
    background: var(--accent-primary-muted);
}

.customer-switcher-item-name {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-switcher-item.active .customer-switcher-item-name {
    color: var(--accent-primary);
}

.customer-switcher-item .badge {
    flex-shrink: 0;
    font-size: 0.7rem;
}

/* Empty / loading state */
.customer-switcher-empty {
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Light theme adjustments */
[data-theme="light"] .customer-switcher-btn {
    background: var(--bg-surface);
    border-color: var(--border-default);
}

[data-theme="light"] .customer-switcher-btn:hover {
    background: var(--bg-hover);
}

[data-theme="light"] .customer-switcher-dropdown {
    border-color: var(--border-default);
}

[data-theme="light"] .customer-switcher-search input {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

[data-theme="light"] .customer-switcher-search input:focus {
    background: var(--bg-surface);
}

/* ============================================
   Dashboard Hero Search
   ============================================ */
.dashboard-hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.dashboard-hero-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.375rem;
    letter-spacing: -0.03em;
}

.dashboard-hero-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1.75rem;
}

/* Backdrop overlay - dims everything when search is active */
.dashboard-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    animation: backdropIn 0.2s ease-out;
    cursor: pointer;
    backdrop-filter:blur(15px);
}

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

/* Search container - centers and constrains width */
.dashboard-search-container {
    max-width: 640px;
    margin: 0 auto;
    position: relative;
}

.dashboard-search-container.has-results {
    z-index: 91;
}

/* Search input wrapper */
.dashboard-search {
    position: relative;
}

.dashboard-search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.dashboard-search input {
    width: 100%;
    padding: 1rem 3rem 1rem 3.5rem;
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    outline: none;
}

.dashboard-search input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.dashboard-search input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-primary-muted), var(--shadow-md);
    background: var(--bg-surface);
}

.dashboard-search input:focus ~ .dashboard-search-icon {
    color: var(--accent-primary);
}

/* Hack: icon color on focus via sibling - icon is before input so we use parent */
.dashboard-search:focus-within .dashboard-search-icon {
    color: var(--accent-primary);
}

.dashboard-search-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dashboard-search-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Search results dropdown */
.dashboard-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 92;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: dashboardResultsIn 0.15s ease-out;
}

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

.dashboard-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.dashboard-results-list {
    max-height: 440px;
    overflow-y: auto;
}

/* Individual result item */
.dashboard-result-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.dashboard-result-item:last-child {
    border-bottom: none;
}

.dashboard-result-item:hover,
.dashboard-result-item.selected {
    background: var(--bg-elevated);
    color: inherit;
}

.dashboard-result-item.selected {
    background: var(--accent-primary-muted);
}

/* Result avatar */
.dashboard-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Result info */
.dashboard-result-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.dashboard-result-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-result-name mark {
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    padding: 0.05em 0.15em;
    border-radius: 3px;
    font-weight: 700;
}

.dashboard-result-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.2rem;
}

.dashboard-result-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dashboard-result-location i {
    font-size: 0.75rem;
}

.dashboard-result-code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-overlay);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
}

.dashboard-result-arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.dashboard-result-item:hover .dashboard-result-arrow,
.dashboard-result-item.selected .dashboard-result-arrow {
    opacity: 1;
    transform: translateX(2px);
}

/* Empty results state */
.dashboard-results-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dashboard-results-empty i {
    font-size: 1.1rem;
    opacity: 0.5;
}

.dashboard-results-empty strong {
    color: var(--text-secondary);
}

/* Light theme adjustments */
[data-theme="light"] .dashboard-search input {
    background: var(--bg-surface);
    border-color: var(--border-default);
}

[data-theme="light"] .dashboard-search input:focus {
    background: var(--bg-surface);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-primary-muted), var(--shadow-md);
}

[data-theme="light"] .dashboard-results {
    border-color: var(--border-default);
}

[data-theme="light"] .dashboard-results-header {
    background: var(--bg-elevated);
}

[data-theme="light"] .dashboard-result-item:hover,
[data-theme="light"] .dashboard-result-item.selected {
    background: var(--bg-elevated);
}

[data-theme="light"] .dashboard-result-item.selected {
    background: var(--accent-primary-muted);
}

[data-theme="light"] .dashboard-result-name mark {
    background: rgba(14, 165, 233, 0.15);
    color: #0284c7;
}

/* Keyboard shortcut hint */
@media (min-width: 768px) {
    .dashboard-search input {
        padding-right: 3rem;
    }
}

/* ============================================
   Login Page
   ============================================ */
.login-layout {
    min-height: 100vh;
    background: var(--bg-base);
    position: relative;
}

.login-theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Ambient glow effects */
.login-bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    opacity: 0.35;
}

.login-bg-glow--top {
    width: 500px;
    height: 500px;
    background: var(--accent-primary);
    top: -200px;
    right: -100px;
    opacity: 0.12;
}

.login-bg-glow--bottom {
    width: 400px;
    height: 400px;
    background: #8b5cf6;
    bottom: -150px;
    left: -100px;
    opacity: 0.08;
}

/* Card */
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem 1.5rem;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

/* Branding */
.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
}

.login-logo svg {
    width: 100%;
    height: 100%;
    display: block;
}

.login-title {
    font-family: var(--font-sans);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    letter-spacing: -0.025em;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* Divider */
.login-divider {
    height: 1px;
    background: var(--border-default);
    margin: 0 -2rem 1.5rem;
}

/* Body */
.login-body {
    margin-bottom: 1.5rem;
}

.login-prompt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.25rem;
}

/* Microsoft sign-in button */
.login-btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.login-btn-microsoft:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: var(--text-primary);
}

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

.login-ms-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Secondary button (for error states) */
.login-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.login-btn-secondary:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Error box */
.login-error-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--status-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Footer */
.login-footer {
    text-align: center;
    padding-top: 0.5rem;
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   Sub Tabs (reusable within-page tabs)
   ============================================ */
.sub-tabs {
    border-bottom: 2px solid var(--border-subtle);
    margin-bottom: 1.5rem;
}

.sub-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    transition: color var(--transition-fast);
    background: transparent;
    position: relative;
}

.sub-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

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

.sub-tabs .nav-link:hover::after {
    transform: scaleX(1);
}

.sub-tabs .nav-link.active {
    color: var(--accent-primary);
    border-bottom-color: transparent;
    background: transparent;
}

.sub-tabs .nav-link.active::after {
    background: var(--accent-primary);
    transform: scaleX(1);
}

/* ============================================
   Contact Cards
   ============================================ */
.contact-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.contact-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    cursor: pointer;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.contact-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.contact-card-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.contact-card-body {
    flex: 1;
    min-width: 0;
}

.contact-card-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.contact-card-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

.contact-card-details {
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.contact-card-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.contact-card-detail i {
    font-size: 0.8rem;
    width: 14px;
    text-align: center;
    color: var(--text-muted);
}

.contact-card-detail a {
    color: var(--text-secondary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-card-detail a:hover {
    color: var(--accent-primary);
}

/* ============================================
   SuperOps Button
   ============================================ */
.btn-superops {
    color: #e91e63 !important;
    border: 1px solid #e91e63 !important;
    background-color: transparent !important;
    display: inline-flex;
    align-items: center;
    padding:0.4rem 1rem;
}

.btn-superops:hover {
    background-color: #e91e63 !important;
    border-color: #e91e63 !important;
    color: #fff !important;
}

.btn-superops:hover img {
    filter: brightness(0) invert(1);
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    #sidebar-wrapper {
        display: none !important;
    }

    #page-content-wrapper {
        margin-left: 0 !important;
    }

    .btn, .navbar {
        display: none !important;
    }
}

/* ============================================
   Customer Details Page
   ============================================ */

    .contact-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary);
        padding: 0.5rem 0;
    }

    .contact-item:first-child {
        padding-top: 0;
    }

    .contact-item:last-child {
        padding-bottom: 0;
    }

    .contact-item i {
        font-size: 1.1rem;
        color: var(--accent-primary);
        width: 20px;
        text-align: center;
    }

    .manager-card-body {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .manager-avatar,
    .manager-avatar-img {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
    }

    .manager-avatar {
        background: linear-gradient(135deg, var(--accent-primary) 0%, #0284c7 100%);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 1.1rem;
        text-transform: uppercase;
    }

    .manager-avatar-img {
        object-fit: cover;
    }

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

    .manager-name {
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .manager-role {
        font-size: 0.8rem;
        color: var(--text-muted);
        margin-top: 2px;
    }

    .site-visit-content {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .site-visit-stat {
        display: flex;
        align-items: flex-start;
        gap: 1rem;
    }

    .site-visit-stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .site-visit-stat-icon i {
        font-size: 1.25rem;
        color: white;
    }

    .site-visit-stat-icon.support-level {
        background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    }

    .site-visit-stat-icon.assigned-visits {
        background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    }

    .site-visit-stat-info {
        flex: 1;
        min-width: 0;
    }

    .site-visit-stat-label {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-muted);
        margin-bottom: 0.25rem;
    }

    .site-visit-stat-value {
        font-weight: 600;
        color: var(--text-primary);
    }

    .site-visit-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.25rem;
    }

    .site-visit-tag {
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0.625rem;
        font-size: 0.75rem;
        font-weight: 500;
        background: var(--bg-elevated);
        border: 1px solid var(--border-default);
        border-radius: 9999px;
        color: var(--text-secondary);
    }

    .visit-options {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        max-height: 200px;
        overflow-y: auto;
        padding: 0.5rem;
        background: var(--bg-elevated);
        border-radius: var(--radius-md);
        border: 1px solid var(--border-default);
    }

    .gdap-portal-grid {
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        gap: 0.75rem;
    }

    .gdap-portal-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding: 0.875rem 0.5rem;
        border-radius: var(--radius-md);
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 0.8rem;
        font-weight: 500;
        transition: all var(--transition-fast);
    }

    .gdap-portal-link:hover {
        border-color: var(--accent-primary);
        color: var(--text-primary);
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .gdap-portal-icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.1rem;
    }

/* ============================================
   Settings Page
   ============================================ */

/* Layout: sidebar + content */
.settings-layout {
    display: flex;
    gap: 1.5rem;
    min-height: 500px;
}

/* Sidebar navigation */
.settings-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
}

.settings-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
    font-weight: 600;
}

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

.settings-nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-nav-count {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-overlay);
    color: var(--text-muted);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

.settings-nav-item.active .settings-nav-count {
    background: var(--accent-primary);
    color: white;
}

/* Content area */
.settings-content {
    flex: 1;
    min-width: 0;
}

.settings-category-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
}

.settings-category-title i {
    color: var(--accent-primary);
}

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

/* ============================================
   Dropdown Editor Component
   ============================================ */

.dropdown-editor {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.dropdown-editor:hover {
    border-color: var(--border-default);
}

.dropdown-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.dropdown-editor-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-editor-header .badge-saved {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    animation: fadeIn 0.2s ease;
}

.dropdown-editor-body {
    padding: 0.625rem 0.875rem;
}

.dropdown-editor-input-row {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.dropdown-editor-input-row .form-control {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-base);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.dropdown-editor-input-row .form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-muted);
}

.dropdown-editor-input-row .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.dropdown-editor-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-editor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.dropdown-editor-item:hover {
    background: var(--bg-hover);
}

.dropdown-editor-item-text {
    font-size: 0.8rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-editor-item-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    transition: all var(--transition-fast);
    opacity: 0;
    flex-shrink: 0;
}

.dropdown-editor-item:hover .dropdown-editor-item-remove {
    opacity: 1;
}

.dropdown-editor-item-remove:hover {
    background: var(--status-danger-bg, rgba(239, 68, 68, 0.15));
    color: var(--status-danger);
}

.dropdown-editor-empty {
    font-size: 0.775rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem;
    font-style: italic;
}

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

/* Responsive - stack on smaller screens */
@media (max-width: 992px) {
    .settings-layout {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
    }

    .settings-nav {
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
    }

    .settings-nav-item {
        flex: 0 0 auto;
    }

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

@media (max-width: 1200px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}