/* ==========================================================================
   LEXINGTON COUNTY SCHOOL DISTRICT ONE - CONTACTS SYNC PORTAL
   Streamlined Modern Utilitarian Design System (Stitch MCP Architecture)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS (LIGHT & DARK THEMES)
   -------------------------------------------------------------------------- */
:root {
  /* Dark Mode Palette (Default Surface) */
  --bg-main: #0b1320;
  --bg-card: #131d2e;
  --bg-card-subtle: #18253b;
  --bg-input: #0e1625;
  --bg-hover: #1e2e45;
  --bg-dark: #0b1320;
  
  --border-color: #22334d;
  --border-hover: #38527a;
  --border-focus: #38bdf8;
  
  /* High-Contrast Typography (WCAG AAA Compliance) */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #f8fafc;
  --text-main-light: #f8fafc;
  --text-muted-light: #94a3b8;
  --text-subtle: #64748b;
  --text-inverse: #0b1320;
  
  /* District Brand Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  --secondary: #3b82f6;
  --accent: #38bdf8;
  --accent-blue: #60a5fa;
  --accent-glow: rgba(56, 189, 248, 0.25);
  
  /* Status Semantics */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --error-red: #ef4444;
  
  /* Modern Typography Stacks */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  
  /* Utilitarian Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Clean Elevations */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 15px rgba(37, 99, 235, 0.15);
  --shadow-glow-mint: 0 0 15px rgba(16, 185, 129, 0.15);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
}

/* Light Theme Overrides (High-Contrast WCAG AAA Compliance) */
:root.light-theme,
html.light-theme,
body.light-theme {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-dark: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #1e3a8a;
  
  /* Maximum Legibility Typography */
  --text-main: #0f172a;        /* 15.8:1 contrast on white */
  --text-muted: #475569;       /* 5.9:1 contrast on white */
  --text-dark: #0f172a;        /* Fixes legacy references */
  --text-main-light: #0f172a;  /* Fixes legacy references */
  --text-muted-light: #475569; /* Fixes legacy references */
  --text-subtle: #64748b;
  --text-inverse: #ffffff;
  
  /* District Brand Colors */
  --primary: #1e3a8a;          /* Lexington One Official Navy */
  --primary-hover: #172554;
  --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #236093 100%);
  --secondary: #236093;
  --accent: #0284c7;
  --accent-blue: #1e3a8a;
  --accent-glow: rgba(2, 132, 199, 0.2);
  
  /* Status Colors */
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --error-red: #dc2626;
  
  /* Crisp Light Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 15px rgba(30, 58, 138, 0.06);
  --shadow-glow-mint: 0 0 15px rgba(5, 150, 105, 0.08);
  
  background-color: #f8fafc;
  color: #0f172a;
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESETS & BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  width: 100%;
  background-color: var(--bg-main);
}

body {
  min-height: 100vh;
  width: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Typography Utility */
.font-mono {
  font-family: var(--font-mono) !important;
}

/* Helper Classes */
.hidden { display: none !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-muted { color: var(--text-muted) !important; }

/* Role-based Visibility Control */
.editor-only,
.admin-only,
.editor-only-panel,
.admin-only-panel {
  display: none;
}

body.is-editor .editor-only,
body.is-editor .editor-only-panel,
body.is-admin .editor-only,
body.is-admin .editor-only-panel {
  display: block;
}

body.is-admin .admin-only,
body.is-admin .admin-only-panel {
  display: block;
}

/* Specific inline role-based buttons */
body.is-editor button.editor-only,
body.is-admin button.editor-only,
body.is-admin button.admin-only {
  display: inline-flex;
}

/* Global Floating Theme Toggle Button */
.global-theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.global-theme-toggle:hover {
  transform: scale(1.08);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.global-theme-toggle .theme-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   3. APP CONTAINER & MASTER LAYOUT
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-main);
  position: relative;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 190;
}
.sidebar-overlay.active {
  display: block;
}

/* --------------------------------------------------------------------------
   4. STREAMLINED LEFT SIDEBAR (NAVIGATION TOOLBAR)
   -------------------------------------------------------------------------- */
.app-sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  left: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width var(--transition-normal), transform var(--transition-normal);
  overflow: hidden;
}

/* Sidebar Header / Brand Crest */
.sidebar-header {
  height: 60px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-shrink: 0;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  text-decoration: none;
}

.logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  flex-shrink: 0;
}

body.light-theme .logo-img {
  filter: brightness(0) saturate(100%) invert(18%) sepia(50%) saturate(1900%) hue-rotate(195deg) brightness(85%) contrast(98%);
}

.logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.logo-text p {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Navigation Tabs Container */
.app-tabs {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Section Header Titles */
.nav-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-section-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0.5rem 0.35rem;
}

.nav-divider-line {
  flex-grow: 1;
  height: 1px;
  background: var(--border-color);
}

.nav-divider-text {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Navigation Tab Buttons */
.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
}

.tab-btn .tab-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.tab-btn .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active Tab Indicator */
.tab-btn.active {
  background: var(--primary);
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

body.light-theme .tab-btn.active {
  background: var(--primary);
  color: #ffffff !important;
}

/* User Profile Banner (Pinned to Bottom of Sidebar) */
.user-profile-banner {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.user-role-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-top: 0.2rem;
  width: fit-content;
  text-transform: capitalize;
}

.user-role-badge.admin {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.user-role-badge.editor {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

body.light-theme .user-role-badge.admin {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

body.light-theme .user-role-badge.editor {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.btn-signout {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   5. APP CONTENT WRAPPER & TOPBAR
   -------------------------------------------------------------------------- */
.app-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-main);
}

.app-topbar {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.hamburger-icon {
  width: 18px;
  height: 18px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Topbar Right Layout */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Theme Pill Toggle Slider */
.theme-pill-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 3px;
  user-select: none;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-fast);
  outline: none;
}

.theme-pill-toggle:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.theme-pill-toggle:hover {
  border-color: var(--border-hover);
}

.theme-pill-segment {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

.theme-pill-segment:hover {
  color: var(--text-main);
}

.theme-pill-segment.active {
  color: #f8fafc;
}

body.light-theme .theme-pill-segment.active {
  color: #0f172a;
}

.theme-pill-icon {
  font-size: 0.85rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-pill-segment:hover .theme-pill-icon {
  transform: scale(1.15) rotate(-5deg);
}

.theme-pill-label {
  letter-spacing: 0.01em;
}

/* Sliding pill background thumb */
.theme-pill-slider-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 9999px;
  z-index: 1;
  transition: transform 0.25s cubic-bezier(0.34, 1.25, 0.64, 1), background 0.25s ease, box-shadow 0.25s ease;
  pointer-events: none;
}

/* Dark theme active state (thumb on left) */
body:not(.light-theme) .theme-pill-slider-thumb {
  transform: translateX(0);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Light theme active state (thumb on right) */
body.light-theme .theme-pill-slider-thumb {
  transform: translateX(100%);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* IT Grayscale variant */
body.it-grayscale-theme:not(.light-theme) .theme-pill-slider-thumb {
  background: #27272a;
  border: 1px solid #3f3f46;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

body.it-grayscale-theme.light-theme .theme-pill-slider-thumb {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .theme-pill-label {
    display: none;
  }
  .theme-pill-segment {
    padding: 0.3rem 0.5rem;
  }
  .topbar-right {
    gap: 0.65rem;
  }
}

@media (max-width: 580px) {
  .stats-container {
    display: none;
  }
}

/* Topbar Compact Metrics */
.stats-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.85rem;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  transition: all var(--transition-fast);
}

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

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

body.light-theme .stat-value {
  color: var(--primary);
}

/* Main Screen Viewport */
.app-main {
  flex: 1;
  padding: 1.75rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel {
  display: none;
  animation: fadeInPanel 0.2s ease forwards;
}

.tab-panel.active {
  display: block;
}

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

.app-footer {
  padding: 1.5rem 1.75rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
  background: var(--bg-card);
}

/* --------------------------------------------------------------------------
   6. UNIVERSAL BUTTONS, INPUTS & CONTROLS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

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

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--danger);
  color: #ffffff !important;
}

.btn-outline-primary {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.3);
}
.btn-outline-primary:hover {
  background: var(--primary);
  color: #ffffff !important;
}

body.light-theme .btn-outline-primary {
  background: #eff6ff;
  color: var(--primary);
  border-color: #bfdbfe;
}
body.light-theme .btn-outline-primary:hover {
  background: var(--primary);
  color: #ffffff !important;
}

.btn-add {
  padding: 0.55rem 1.1rem;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.action-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Universal Inputs & Selects */
.form-input,
.form-select,
.search-box input,
.config-field input,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="url"],
select {
  box-sizing: border-box;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

body.light-theme .form-input,
body.light-theme .form-select,
body.light-theme .search-box input,
body.light-theme .config-field input,
body.light-theme input[type="text"],
body.light-theme input[type="email"],
body.light-theme input[type="tel"],
body.light-theme input[type="password"],
body.light-theme input[type="url"],
body.light-theme select {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.form-input:focus,
.form-select:focus,
.search-box input:focus,
.config-field input:focus,
input:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-select {
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75em;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

body.light-theme .form-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

/* Universal Cards */
.card,
.contacts-card,
.config-card,
.bulk-card,
.whitelist-list-card,
.whitelist-add-card,
.audit-intro-card,
.audit-table-card,
.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.card-header,
.section-header {
  margin-bottom: 1.25rem;
}

.card-header h2,
.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-subtitle,
.section-description {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Toolbar Bar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 320px;
  max-width: 520px;
}

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

.search-box input {
  width: 100%;
  padding-left: 2.5rem;
  height: 38px;
}

/* --------------------------------------------------------------------------
   7. LOCATION QUICK-SCROLL NAVIGATOR
   -------------------------------------------------------------------------- */
.contacts-grouped-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.location-navigator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.navigator-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.location-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.location-badge {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78125rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.location-badge:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.location-badge .badge-count,
.badge-count {
  background: var(--bg-main);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   8. DATA TABLES (CONTACTS, DESK PHONES, SEARCH, AUDIT)
   -------------------------------------------------------------------------- */
.table-wrapper,
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.contacts-table,
.data-table,
.audit-table,
.sync-logs-table,
.whitelist-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.contacts-table th,
.data-table th,
.audit-table th,
.sync-logs-table th,
.whitelist-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.contacts-table td,
.data-table td,
.audit-table td,
.sync-logs-table td,
.whitelist-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-main);
  vertical-align: middle;
}

.contacts-table tbody tr,
.data-table tbody tr,
.audit-table tbody tr,
.sync-logs-table tbody tr,
.whitelist-table tbody tr,
.contact-row {
  transition: background-color var(--transition-fast);
}

.contacts-table tbody tr:hover,
.data-table tbody tr:hover,
.audit-table tbody tr:hover,
.sync-logs-table tbody tr:hover,
.whitelist-table tbody tr:hover,
.contact-row:hover {
  background-color: var(--bg-hover);
}

.contacts-table tbody tr:last-child td,
.data-table tbody tr:last-child td,
.audit-table tbody tr:last-child td,
.sync-logs-table tbody tr:last-child td,
.whitelist-table tbody tr:last-child td {
  border-bottom: none;
}

.td-avatar-cell {
  width: 52px;
  padding-right: 0.5rem !important;
}

.contact-title-cell {
  max-width: 220px;
}

.contact-location-cell {
  max-width: 200px;
}

.contact-email-cell {
  max-width: 240px;
}

/* Grouped Location Sections */
.location-section {
  margin-bottom: 0;
}

.location-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

.location-section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.location-section-header h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

.location-section-header .section-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
}

/* Contact Name Cell & Staff Portrait */
.contact-name-cell {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.workspace-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: block;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.contacts-table tbody tr:hover .workspace-avatar {
  transform: scale(1.05);
  border-color: var(--primary);
}

.workspace-avatar.logo-fallback {
  object-fit: contain;
  padding: 6px;
}

.table-avatar-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-radius: 50%;
}

.table-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  display: block;
}

.avatar-zoom-icon {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  font-size: 0.65rem;
  padding: 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.table-avatar-wrapper:hover .avatar-zoom-icon {
  opacity: 1;
}

.default-district-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.default-district-logo-img {
  width: 22px;
  height: auto;
  opacity: 0.75;
}

body.light-theme .default-district-logo-img {
  filter: brightness(0) saturate(100%) invert(18%) sepia(50%) saturate(1900%) hue-rotate(195deg) brightness(85%) contrast(98%);
}

.contact-meta-info {
  display: flex;
  flex-direction: column;
}

.contact-fullname,
.desk-phone-user-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9375rem;
}

.contact-title {
  font-size: 0.8125rem;
  color: var(--text-main);
}

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

.dept-badge {
  display: inline-block;
  font-size: 0.71875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}

.location-badge-pill {
  display: inline-block;
  font-size: 0.78125rem;
  font-weight: 500;
  color: var(--text-main);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Phone Numbers Cell */
.contact-phone-cell,
.contact-deskphone-cell {
  white-space: nowrap;
}

.phone-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.phone-work,
.phone-cell {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-sans);
}

.phone-work {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
}
body.light-theme .phone-work {
  background: #eff6ff;
  color: var(--primary);
}

.phone-cell {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}
body.light-theme .phone-cell {
  background: #ecfdf5;
  color: var(--success);
}

/* Email Cell */
.email-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.84375rem;
}
.email-link:hover {
  text-decoration: underline;
}

body.light-theme .email-link {
  color: var(--primary);
}

/* Actions Cell */
.actions-cell,
.workspace-actions-cell {
  white-space: nowrap;
}

.workspace-action-buttons {
  display: inline-flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.btn-assign-cell,
.btn-assign-desk {
  font-size: 0.78125rem;
  padding: 0.35rem 0.65rem;
}

/* --------------------------------------------------------------------------
   9. DESK PHONE DIRECTORY SPECIFICS
   -------------------------------------------------------------------------- */
.filter-pills,
.photo-filter-pills {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
}

.filter-pill.active {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
}

body.light-theme .filter-pill.active {
  background: var(--primary);
  color: #ffffff !important;
}

/* Desk Phone Assignment Modal User Hero */
.desk-phone-user-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.desk-phone-user-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.desk-phone-user-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.desk-phone-user-job {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   10. GOOGLE WORKSPACE CONFIGURATION CARD
   -------------------------------------------------------------------------- */
.config-card-grid,
.config-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.75rem;
}

@media (max-width: 992px) {
  .config-card-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }
}

.config-form-column h3,
.config-guide-column h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.ou-pills-container,
.ou-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.ou-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.78125rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
}

.ou-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.ou-remove:hover {
  color: var(--danger);
}

.setup-guide-content {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.guide-step {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.84375rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.guide-code {
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: var(--primary);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.config-note {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-top: 1.25rem;
}

.note-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

.note-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.form-checkbox {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   11. PHOTO COMPLIANCE CHECK DIRECTORY
   -------------------------------------------------------------------------- */
.photo-check-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.photo-check-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.photo-check-title-group h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.photo-check-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

body.light-theme .photo-check-badge {
  background: #eff6ff;
  color: var(--primary);
  border-color: #bfdbfe;
}

.photo-check-description {
  font-size: 0.84375rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.photo-check-stats {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.photo-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 95px;
  padding: 0.6rem 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.photo-stat-num {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}

.photo-stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}

.photo-stat-pill.photo-stat-good .photo-stat-num {
  color: var(--success);
}

.photo-stat-pill.photo-stat-warning .photo-stat-num {
  color: var(--warning);
}

/* Photo Check Toolbar */
.photo-check-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.photo-toolbar-left,
.photo-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.photo-search-box {
  position: relative;
  min-width: 260px;
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.size-switcher-group {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 2px;
}

.size-switcher-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0.4rem 0 0.5rem;
}

.size-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.size-btn:hover {
  color: var(--text-main);
}

.size-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.size-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.photo-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.photo-grid-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.photo-grid-hint {
  font-style: italic;
  font-size: 0.78125rem;
}

.photo-loading-container,
.photo-load-more-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 0;
}

.photo-load-more-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.photo-empty-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
  gap: 0.75rem;
  grid-column: 1 / -1;
}

.photo-empty-icon {
  font-size: 2.5rem;
  opacity: 0.6;
}

/* Solid Photo Grid & Cards */
.photo-check-grid {
  display: grid;
  width: 100%;
  gap: 12px;
}

.photo-check-grid.grid-size-sm {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.photo-check-grid.grid-size-md {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.photo-check-grid.grid-size-lg {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.photo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

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

.photo-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-card-subtle);
  overflow: hidden;
}

.photo-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-normal);
}

.photo-card:hover .photo-card-img {
  transform: scale(1.04);
}

/* Resolution Quality Badges */
.photo-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.photo-card-badge.badge-quality-hd {
  background: rgba(16, 185, 129, 0.9);
  color: #ffffff;
}

.photo-card-badge.badge-quality-good {
  background: rgba(59, 130, 246, 0.9);
  color: #ffffff;
}

.photo-card-badge.badge-quality-low {
  background: rgba(245, 158, 11, 0.9);
  color: #ffffff;
}

body.light-theme .photo-card-badge.badge-quality-hd {
  background: #059669;
  color: #ffffff;
}

body.light-theme .photo-card-badge.badge-quality-low {
  background: #d97706;
  color: #ffffff;
}

.photo-card-caption {
  padding: 0.5rem 0.65rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.photo-card-username {
  font-size: 0.78125rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.light-theme .photo-card-username {
  color: var(--primary);
}

.photo-card-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card-expand-indicator {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Expanded Card View */
.photo-card.expanded {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.photo-card-details {
  display: none;
  padding: 0.75rem;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border-color);
}

.photo-card.expanded .photo-card-details {
  display: block;
}

.photo-details-header {
  margin-bottom: 0.5rem;
}

.photo-details-fullname {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-main);
}

.photo-details-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.photo-details-field {
  margin-bottom: 0.35rem;
}

.photo-field-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.photo-field-value {
  font-size: 0.78125rem;
  font-weight: 500;
  color: var(--text-main);
}

.username-val,
.email-val {
  font-family: var(--font-mono);
  color: var(--primary);
}

.photo-stat-pill.photo-stat-outdated .photo-stat-num {
  color: #f59e0b;
}

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

.photo-toolbar-select {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.42rem 0.65rem;
  font-size: 0.78125rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 210px;
}

.photo-toolbar-select:focus {
  outline: none;
  border-color: var(--primary);
}

.photo-status-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* Live Photo Queue Telemetry Indicator */
.photo-queue-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
}

.photo-queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}

.photo-queue-dot.active {
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  animation: pulseQueueDot 1s ease-in-out infinite;
}

.photo-queue-dot.done {
  background: var(--success, #10b981);
}

@keyframes pulseQueueDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.65; }
}

.photo-queue-progress-track {
  width: 72px;
  height: 6px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.photo-queue-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #10b981);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/*Queued Shimmer Skeleton for Portraits */
.photo-card-img-wrap.photo-queued::before {
  content: 'Queued...';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: linear-gradient(
    110deg,
    var(--bg-card-subtle) 25%,
    var(--bg-input) 37%,
    var(--bg-card-subtle) 63%
  );
  background-size: 200% 100%;
  animation: photoQueueShimmer 1.4s ease infinite;
  z-index: 0;
}

@keyframes photoQueueShimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.photo-card-img {
  position: relative;
  z-index: 1;
}

.photo-card-img.logo-fallback {
  object-fit: contain;
  padding: 18%;
  opacity: 0.75;
}

.photo-card-badge.badge-missing {
  background: rgba(239, 68, 68, 0.92);
  color: #ffffff;
}

.photo-card-badge.badge-outdated {
  background: rgba(245, 158, 11, 0.92);
  color: #ffffff;
}

.photo-card-badge.badge-fresh {
  background: rgba(16, 185, 129, 0.88);
  color: #ffffff;
}

.photo-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-top: 2px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.photo-card-barcode {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: var(--bg-card-subtle);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.photo-card-loc {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.68rem;
}

/* Pagination Controls (Top & Bottom) */
.photo-pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  margin-top: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.photo-pagination-summary {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.photo-pagination-bar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.photo-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.78125rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.photo-page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.photo-page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.photo-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.photo-pagination-ellipsis {
  padding: 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.photo-pagination-jump {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78125rem;
  color: var(--text-muted);
}

.photo-page-jump-input {
  width: 60px;
  height: 32px;
  padding: 0 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  text-align: center;
}

.photo-details-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   12. T-MOBILE WIRELESS BILLING AUDIT
   -------------------------------------------------------------------------- */
.dropzone,
.drag-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dropzone:hover,
.dropzone.dragover,
.drag-drop-zone:hover,
.drag-drop-zone.dragover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.dropzone-icon,
.bulk-upload-icon,
.upload-icon {
  font-size: 2.5rem;
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.upload-or {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin: 0.75rem 0;
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

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

.audit-dashboard,
.audit-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
  .audit-dashboard,
  .audit-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.audit-stats .stat-card {
  cursor: pointer;
  user-select: none;
  border-width: 2px;
}

.audit-stats .stat-card.active {
  border-color: var(--primary) !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

.stat-matched {
  border-left: 4px solid var(--success) !important;
}
.stat-discrepancy {
  border-left: 4px solid var(--warning) !important;
}
.stat-missing {
  border-left: 4px solid var(--danger) !important;
}

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

.audit-search {
  flex: 1 1 280px;
  max-width: 450px;
}

.audit-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.contacts-table tr.audit-row-missing {
  background-color: rgba(245, 158, 11, 0.08) !important;
  border-left: 4px solid var(--warning);
}

.contacts-table tr.audit-row-discrepancy {
  background-color: rgba(239, 68, 68, 0.08) !important;
  border-left: 4px solid var(--danger);
}

.contacts-table tr.audit-row-matched {
  border-left: 4px solid var(--success);
}

/* High Contrast Audit Badges */
.audit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.audit-badge.matched {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.audit-badge.discrepancy {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.audit-badge.missing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

body.light-theme .audit-badge.matched {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

body.light-theme .audit-badge.discrepancy {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

body.light-theme .audit-badge.missing {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* --------------------------------------------------------------------------
   13. BULK IMPORT & EXPORT PORTAL
   -------------------------------------------------------------------------- */
.bulk-portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 992px) {
  .bulk-portal-grid {
    grid-template-columns: 1fr;
  }
}

.bulk-card {
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.bulk-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin-top: 1rem;
}

.bulk-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.csv-preview-area,
.photos-preview-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.csv-preview-area h3,
.photos-preview-area h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.csv-table-wrapper {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
}

.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.csv-preview-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 0.65rem 0.85rem;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-color);
}

.csv-preview-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}

.photos-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.photos-log-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.photo-thumbnail {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.photo-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.photo-filename {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-main);
}

.photo-match-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   14. SERVER LOGS & TELEMETRY
   -------------------------------------------------------------------------- */
.devices-subtabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.devices-subtab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.devices-subtab-btn:hover {
  color: var(--text-main);
}

.devices-subtab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.devices-subtab-panel {
  display: none;
}

.devices-subtab-panel.active {
  display: block;
}

.devices-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
  background: var(--bg-card-subtle);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.subtab-count-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-status.success,
.badge-status-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-status.badge-status-error,
.badge-status.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-status-running {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.35);
}

body.light-theme .badge-status.success,
body.light-theme .badge-status-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

body.light-theme .badge-status.badge-status-error,
body.light-theme .badge-status.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

body.light-theme .badge-status-running {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.badge-mode,
.badge-event-type {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.method-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.method-badge.delete {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.device-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-main);
}

.device-type-icon {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.serial-pivot-badge {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--primary);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.serial-pivot-badge:hover {
  border-color: var(--primary);
  text-decoration: underline;
}

.device-count-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.pivot-action-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.btn-view-log-details {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

.device-ip {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Activity Timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  padding: 0.85rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.timeline-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.timeline-badge.red {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.timeline-content {
  flex: 1;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.timeline-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

/* --------------------------------------------------------------------------
   15. SETTINGS HUB & MDM CONFIGURATION
   -------------------------------------------------------------------------- */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

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

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

.settings-card-icon {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.settings-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.settings-card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.settings-theme-switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.theme-option-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.theme-check-icon {
  color: var(--primary);
  font-size: 1.15rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 26px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Theme Options Picker Cards */
.theme-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.theme-option-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  background: var(--bg-card-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}

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

.theme-option-card.active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.theme-option-preview {
  height: 70px;
  border-radius: 6px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.theme-preview-dark {
  background: #0b1320;
}
.theme-preview-dark .preview-sidebar {
  width: 28%;
  background: #131d2e;
  border-right: 1px solid #22334d;
}
.theme-preview-dark .preview-content {
  flex-grow: 1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.theme-preview-dark .preview-bar {
  height: 8px;
  width: 60%;
  background: #2563eb;
  border-radius: 2px;
}
.theme-preview-dark .preview-box {
  height: 28px;
  background: #18253b;
  border-radius: 3px;
}

.theme-preview-light {
  background: #f8fafc;
}
.theme-preview-light .preview-sidebar {
  width: 28%;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
}
.theme-preview-light .preview-content {
  flex-grow: 1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.theme-preview-light .preview-bar {
  height: 8px;
  width: 60%;
  background: #1e3a8a;
  border-radius: 2px;
}
.theme-preview-light .preview-box {
  height: 28px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
}

.theme-option-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-main);
}

.theme-option-desc {
  font-size: 0.78125rem;
  color: var(--text-muted);
}

/* MDM Parameter Fields */
.config-instructions {
  background: var(--bg-card-subtle);
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.84375rem;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.config-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.field-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.btn-copy {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-copy:hover {
  background: var(--bg-hover);
}

.config-field input {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--bg-input);
  color: var(--text-main);
}

/* Sync Actions Grid */
.sync-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 1.5rem;
}

.sync-action-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  transition: all var(--transition-fast);
}

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

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

.sync-service-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}

.badge-google {
  background: rgba(66, 133, 244, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(66, 133, 244, 0.3);
}

.badge-photos {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-carddav {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

body.light-theme .badge-google {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

body.light-theme .badge-photos {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

body.light-theme .badge-carddav {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.sync-status-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.sync-status-indicator.running {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent);
  border-color: rgba(37, 99, 235, 0.3);
}

.sync-action-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sync-action-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.sync-action-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text-main);
}

.sync-action-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.75rem;
  min-height: 58px;
}

.sync-last-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-action-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-sync {
  flex-grow: 1;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  justify-content: center;
}

/* Automated 2 AM Verification */
.auto-sync-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.auto-sync-status-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

.auto-sync-status-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.auto-sync-status-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.auto-sync-status-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.auto-sync-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.auto-sync-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auto-sync-btns {
  display: flex;
  gap: 0.75rem;
}

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

/* Settings Quick Links */
.settings-quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.settings-quick-link-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.settings-quick-link-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.quick-link-icon {
  font-size: 1.3rem;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-link-info h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.quick-link-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quick-link-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1rem;
  transition: transform var(--transition-fast);
}

.settings-quick-link-card:hover .quick-link-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   16. ADMIN WHITELIST SPECIFICS
   -------------------------------------------------------------------------- */
.whitelist-layout-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1000px) {
  .whitelist-layout-grid {
    grid-template-columns: 1fr;
  }
}

.whitelist-add-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.whitelist-add-form label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  display: block;
  margin-bottom: 0.35rem;
}

.input-tip {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.table-role-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 1.8rem 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.75em;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

body.light-theme .table-role-select {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* --------------------------------------------------------------------------
   17. DIALOGS & MODAL WINDOWS
   -------------------------------------------------------------------------- */
dialog,
.custom-dialog {
  display: none;
  margin: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl, 16px);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 0;
  max-width: 960px;
  width: min(960px, calc(100vw - 2rem));
  max-height: min(92vh, 900px);
  height: 90vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  outline: none;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-direction: column;
}

dialog:not([open]),
.custom-dialog:not([open]) {
  display: none !important;
  position: absolute !important;
  height: 0 !important;
  width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  overflow: hidden !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

dialog[open],
.custom-dialog[open] {
  display: flex !important;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  visibility: visible;
}

body.light-theme dialog,
body.light-theme .custom-dialog {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

dialog::backdrop,
.custom-dialog::backdrop {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dialog-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.dialog-header {
  flex-shrink: 0;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  z-index: 5;
}

body.light-theme .dialog-header {
  background: #ffffff;
  border-bottom-color: #e2e8f0;
}

.dialog-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin: 0;
}

body.light-theme .dialog-header h3 {
  color: #0f172a;
}

.btn-close-dialog {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition-fast);
}

.btn-close-dialog:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-color);
}

body.light-theme .btn-close-dialog {
  color: #64748b;
}

body.light-theme .btn-close-dialog:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.btn-close-dialog:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Modal Form Container: Guarantees Scrollability & Flex Constraints */
#contact-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.dialog-form-scroll,
.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 1.75rem;
  -webkit-overflow-scrolling: touch;
}

.dialog-form-scroll::-webkit-scrollbar {
  width: 8px;
}

.dialog-form-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.dialog-form-scroll::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

body.light-theme .dialog-form-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

body.light-theme .dialog-form-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Two-Column Responsive Layout Grid */
.dialog-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

.dialog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: stretch;
}

.avatar-upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
}

.avatar-upload-container {
  width: 150px;
  height: 150px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  background: var(--bg-card-subtle);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

body.light-theme .avatar-upload-container {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.avatar-upload-container.has-photo {
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

body.light-theme .avatar-upload-container.has-photo {
  border-color: #94a3b8;
}

.avatar-upload-container:hover {
  border-color: var(--primary);
}

body.light-theme .avatar-upload-container:hover {
  border-color: #2563eb;
}

.avatar-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.avatar-placeholder .camera-icon {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.avatar-overlay-icon {
  font-size: 1.25rem;
}

.avatar-overlay-text {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.avatar-upload-container.has-photo:hover .avatar-overlay {
  opacity: 1;
}

.avatar-action-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.btn-remove-photo {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-remove-photo:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
}

body.light-theme .btn-remove-photo {
  border-color: #fca5a5;
  color: #dc2626;
}

body.light-theme .btn-remove-photo:hover {
  background: #fef2f2;
}

.dialog-info-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  width: 100%;
  box-sizing: border-box;
}

body.light-theme .dialog-info-card {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
}

.info-card-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

body.light-theme .info-card-title {
  color: #1e40af;
}

.info-card-icon {
  font-size: 1rem;
}

.info-card-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

body.light-theme .info-card-text {
  color: #334155;
}

.dialog-main-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* Crisp Section Cards with High-Contrast Boundaries */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

body.light-theme .form-section {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.form-section:focus-within {
  border-color: var(--primary);
}

body.light-theme .form-section:focus-within {
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

body.light-theme .section-title {
  border-bottom-color: #e2e8f0;
}

.section-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.section-title h4 {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.01em;
}

body.light-theme .section-title h4 {
  color: #0f172a;
}

.section-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

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

.form-group-row-triple {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

body.light-theme .form-group label {
  color: #475569;
}

.form-group input,
.form-group select {
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  padding: 0.5rem 0.8rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  transition: all var(--transition-fast);
}

body.light-theme .form-group input,
body.light-theme .form-group select {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background-color: var(--bg-card);
}

body.light-theme .form-group input:focus,
body.light-theme .form-group select:focus {
  background-color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-checkbox-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
}

body.light-theme .form-checkbox-group label {
  color: #334155;
}

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

/* Pinned Actions Footer */
.dialog-actions,
.dialog-footer {
  flex-shrink: 0;
  padding: 1.1rem 1.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  z-index: 5;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

body.light-theme .dialog-actions,
body.light-theme .dialog-footer {
  background: #ffffff;
  border-top-color: #e2e8f0;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.03);
}

/* Desk Phone Dialog Specifics */
#desk-phone-dialog {
  max-width: 520px;
}

.desk-phone-dialog-content {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.desk-phone-modal-body {
  padding: 1.5rem;
}

.modal-error-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  display: none;
}

body.light-theme .modal-error-banner {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* Photo Lightbox Dialog */
.photo-lightbox-dialog {
  max-width: 650px;
}

.photo-lightbox-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-lightbox-titles {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.photo-lightbox-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.photo-lightbox-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.photo-lightbox-meta {
  font-size: 0.78125rem;
  color: var(--text-muted);
}

.photo-lightbox-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.photo-lightbox-stage {
  max-width: 360px;
  max-height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.photo-lightbox-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-lightbox-diagnostics {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  justify-content: space-around;
}

.diagnostic-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.diagnostic-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.diagnostic-val {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.photo-lightbox-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --------------------------------------------------------------------------
   18. IMMERSIVE LOGIN SCREEN
   -------------------------------------------------------------------------- */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.login-screen.hidden {
  display: none !important;
  position: absolute !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-logo-img {
  height: 48px;
  width: auto;
  margin-bottom: 0.75rem;
}

body.light-theme .login-logo-img {
  filter: brightness(0) saturate(100%) invert(18%) sepia(50%) saturate(1900%) hue-rotate(195deg) brightness(85%) contrast(98%);
}

.login-logo-area h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

.login-logo-area p {
  font-size: 0.84375rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.login-divider {
  width: 100%;
  height: 1px;
  background: var(--border-color);
  margin: 1.5rem 0;
}

.login-info p {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.login-restriction {
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  color: var(--text-muted) !important;
  margin-bottom: 1.5rem;
}

.btn-google {
  width: 100%;
  height: 44px;
  background: #ffffff;
  color: #1f2937 !important;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-google:hover {
  background: #f9fafb;
  box-shadow: var(--shadow-sm);
}

.google-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  width: 100%;
  display: none;
}

/* --------------------------------------------------------------------------
   19. TOAST NOTIFICATIONS & SPINNERS
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-error {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
}

.spinner,
.login-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-cell,
.empty-cell,
.error-cell {
  text-align: center;
  padding: 3rem 1rem !important;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.error-cell {
  color: var(--danger) !important;
}

/* --------------------------------------------------------------------------
   20. RESPONSIVE ADJUSTMENTS
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .sidebar-toggle-btn {
    display: flex !important;
  }

  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  
  .app-sidebar.sidebar-open {
    transform: translateX(0);
  }
}

/* Modal Responsive Breakpoints */
@media (max-width: 860px) {
  #contact-dialog {
    width: calc(100vw - 1.5rem);
    max-width: calc(100vw - 1.5rem);
    height: 94vh;
    max-height: 94vh;
  }

  .dialog-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .dialog-sidebar {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: start;
  }

  .avatar-upload-section {
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  #contact-dialog {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    margin: 0;
  }

  .dialog-header {
    padding: 1rem 1.25rem;
  }

  .dialog-form-scroll {
    padding: 1rem 1.25rem;
  }

  .dialog-sidebar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .avatar-upload-section {
    align-items: center;
  }

  .form-group-row,
  .form-group-row-triple {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .dialog-actions {
    padding: 0.85rem 1.25rem;
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .dialog-actions button {
    width: 100%;
  }
}


/* --------------------------------------------------------------------------
   18. PERMISSIONS MATRIX & ROLE-BASED ACCESS CONTROL (RBAC) STYLING
   -------------------------------------------------------------------------- */

/* Settings Sub-Navigation Pill Bar */
.settings-subnav-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
  margin-bottom: 2rem;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.settings-subnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md, 8px);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.settings-subnav-pill:hover {
  color: var(--text-main);
  background: var(--bg-card-subtle, rgba(255,255,255,0.05));
}

.settings-subnav-pill.active {
  color: #ffffff;
  background: var(--primary, #2563eb);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.settings-subnav-pill .pill-icon {
  font-size: 1rem;
}

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

.matrix-header-titles {
  flex: 1;
  min-width: 280px;
}

.matrix-breadcrumb {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent, #3b82f6);
  margin-bottom: 0.35rem;
}

.matrix-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin: 0 0 0.4rem 0;
}

.matrix-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 760px;
  line-height: 1.45;
}

.matrix-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.matrix-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.matrix-date-badge .badge-cal-icon {
  font-size: 0.95rem;
}

.btn-matrix-action {
  font-size: 0.8125rem;
  padding: 0.45rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  border-radius: var(--radius-md, 8px);
  white-space: nowrap;
}

.unsaved-count-badge {
  background: #ef4444;
  color: #ffffff;
  border-radius: 9999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.25rem;
}

/* Matrix Toolbar (Search & Filters) */
.matrix-toolbar-card {
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
}

.matrix-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.matrix-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.matrix-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.6;
  font-size: 0.9rem;
}

.matrix-search-input {
  width: 100%;
  height: 38px;
  padding: 0 2rem 0 2.4rem;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.matrix-search-input:focus {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.matrix-search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.matrix-filters-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.matrix-filter-item {
  min-width: 170px;
}

.matrix-filter-select {
  width: 100%;
  height: 38px;
  padding: 0.35rem 2rem 0.35rem 0.75rem;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='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.75rem center;
  background-size: 14px;
}

.matrix-filter-select:focus {
  border-color: var(--primary, #2563eb);
  outline: none;
}

/* The Matrix Grid Table Card */
.matrix-table-card {
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.matrix-scroll-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.matrix-scroll-wrapper::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.matrix-scroll-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.matrix-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.rbac-matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 0.8125rem;
  user-select: none;
}

/* Tier 1 Header Row */
.matrix-header-row-tier1 {
  height: 34px;
}

/* Corner Header Cell Tier 1 (Categories Level) */
.matrix-corner-tier1 {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 40;
  width: 250px;
  min-width: 250px;
  max-width: 250px;
  height: 34px;
  max-height: 34px;
  box-sizing: border-box;
  background: var(--bg-card);
  border-right: 2px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-top: 3px solid transparent;
  padding: 0.35rem 0.85rem;
  vertical-align: middle;
  text-align: left;
}

.matrix-corner-tier1-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent, #3b82f6);
  white-space: nowrap;
}

/* Category Headers (Top Tier) */
.matrix-cat-th {
  position: sticky;
  top: 0;
  z-index: 25;
  height: 34px;
  max-height: 34px;
  box-sizing: border-box;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.5rem;
  background: var(--bg-card-subtle, #f8fafc);
  border-right: 2px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-top: 3px solid var(--cat-accent, #3b82f6);
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.2;
}

.matrix-cat-header-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.cat-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.65rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
}

.cat-info-btn:hover {
  background: var(--primary, #2563eb);
  color: #ffffff;
  border-color: var(--primary, #2563eb);
}

/* Tier 2 Header Row */
.matrix-header-row-tier2 {
  height: 145px;
}

/* Corner Header Cell Tier 2 (Rotated Permissions Level) */
.matrix-corner-tier2 {
  position: sticky;
  top: 34px;
  left: 0;
  z-index: 35;
  width: 250px;
  min-width: 250px;
  max-width: 250px;
  height: 145px;
  box-sizing: border-box;
  background: var(--bg-card);
  border-right: 2px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  vertical-align: bottom;
  text-align: left;
}

.matrix-corner-tier2-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}

.matrix-corner-tier2-role {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.matrix-corner-tier2-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.2rem;
}

/* Rotated Permission Sub-headers (Second Tier) */
.matrix-perm-th {
  position: sticky;
  top: 34px;
  z-index: 20;
  height: 145px;
  box-sizing: border-box;
  width: 44px;
  min-width: 44px;
  max-width: 48px;
  padding: 0.5rem 0.2rem 0.4rem 0.2rem;
  text-align: left;
  vertical-align: bottom;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
  cursor: default;
  transition: background-color 0.15s ease;
}

.matrix-perm-th-last-in-cat {
  border-right: 2px solid var(--border-color) !important;
}

.matrix-perm-th-rotated-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--text-main);
  max-height: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Sticky Left Role Header in Rows */
.matrix-role-th {
  position: sticky;
  left: 0;
  z-index: 15;
  width: 250px;
  min-width: 250px;
  max-width: 250px;
  background: var(--bg-card);
  border-right: 2px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  text-align: left;
  transition: background-color 0.15s ease;
}

.matrix-role-name-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.matrix-role-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.matrix-role-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-main);
}

.matrix-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.matrix-role-badge-locked {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.matrix-role-badge-system {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
}

.matrix-role-badge-custom {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.matrix-role-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.matrix-role-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.matrix-role-btn-pencil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.matrix-role-btn-pencil:hover {
  background: var(--bg-hover, rgba(37, 99, 235, 0.1));
  color: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  transform: scale(1.06);
}

body:not(.light-theme) .matrix-role-btn-pencil:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: #60a5fa;
}

.edit-role-danger-zone {
  transition: all 0.2s ease;
}

/* Matrix Data Checkbox Cells */
.matrix-cell {
  width: 44px;
  min-width: 44px;
  max-width: 48px;
  height: 48px;
  text-align: center;
  vertical-align: middle;
  padding: 0;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: background-color 0.12s ease;
  cursor: pointer;
  position: relative;
}

.matrix-cell-last-in-cat {
  border-right: 2px solid var(--border-color) !important;
}

/* Custom Styled Checkboxes */
.matrix-checkbox {
  width: 19px;
  height: 19px;
  border-radius: 4px;
  border: 1.5px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: transparent;
  transition: all 0.15s ease;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 800;
  margin: auto;
}

.matrix-checkbox.checked {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.matrix-checkbox.locked {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  cursor: not-allowed;
  opacity: 0.85;
}

.matrix-checkbox.modified {
  box-shadow: 0 0 0 2px #f59e0b;
}

/* Column Hover Highlighting (Signature yellow highlight matching screenshot) */
.matrix-perm-th.col-hover {
  background-color: #fef08a !important;
  color: #854d0e !important;
}

.matrix-perm-th.col-hover .matrix-perm-th-rotated-text {
  color: #854d0e !important;
}

.matrix-cell.col-hover {
  background-color: #fef9c3 !important;
}

/* Row Hover Highlighting */
.matrix-row:hover .matrix-role-th {
  background-color: var(--bg-card-subtle, #f1f5f9);
}

.matrix-row:hover .matrix-cell:not(.col-hover) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Dark Mode Overrides for Matrix */
body:not(.light-theme) .matrix-corner-tier1,
body:not(.light-theme) .matrix-corner-tier2,
body:not(.light-theme) .matrix-perm-th,
body:not(.light-theme) .matrix-role-th,
body:not(.light-theme) .matrix-cell {
  background: var(--bg-card);
}

body:not(.light-theme) .matrix-cat-th {
  background: #0f172a;
}

body:not(.light-theme) .matrix-perm-th.col-hover {
  background-color: #713f12 !important;
  color: #fef08a !important;
}

body:not(.light-theme) .matrix-perm-th.col-hover .matrix-perm-th-rotated-text {
  color: #fef08a !important;
}

body:not(.light-theme) .matrix-cell.col-hover {
  background-color: rgba(180, 83, 9, 0.28) !important;
}

body:not(.light-theme) .matrix-row:hover .matrix-role-th {
  background-color: #1e293b;
}

body:not(.light-theme) .matrix-row:hover .matrix-cell:not(.col-hover) {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Bottom Centered Title Bar */
.matrix-bottom-title-bar {
  text-align: center;
  padding: 0.85rem;
  background: var(--bg-card-subtle, #f8fafc);
  border-top: 1px solid var(--border-color);
}

.matrix-bottom-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Floating Cell Hover Tooltip Popover */
.matrix-hover-tooltip {
  position: fixed;
  z-index: 10000;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-size: 0.78125rem;
  line-height: 1.4;
  max-width: 300px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  transform: translateY(-8px);
  opacity: 0;
}

.matrix-hover-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-perm-title {
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 0.2rem;
  font-size: 0.8125rem;
}

.tooltip-perm-desc {
  color: #e2e8f0;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.tooltip-perm-role {
  font-size: 0.7rem;
  color: #94a3b8;
  border-top: 1px solid #334155;
  padding-top: 0.25rem;
  font-weight: 600;
}

/* User Role Assignments Card & Table */
.rbac-users-card {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
}

.rbac-assign-user-form {
  padding: 1.25rem;
  background: var(--bg-card-subtle, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  margin-top: 1rem;
}

.table-role-select-dynamic {
  height: 32px;
  font-size: 0.8125rem;
  padding: 0.2rem 1.8rem 0.2rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='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.5rem center;
  background-size: 12px;
}

.perm-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

/* ==========================================================================
   OPTION 1: DENSE TECHNICAL WORKSPACE (IT GRAYSCALE THEME)
   High-contrast, zero-fatigue achromatic palette for internal IT operations
   ========================================================================== */

/* Dark Mode Tokens under IT Grayscale */
body.it-grayscale-theme:not(.light-theme) {
  --bg-main: #09090b;
  --bg-card: #141416;
  --bg-card-subtle: #1c1c1f;
  --bg-input: #121214;
  --bg-hover: #27272a;
  --bg-dark: #09090b;
  
  --border-color: #27272a;
  --border-hover: #3f3f46;
  --border-focus: #71717a;
  
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dark: #f4f4f5;
  --text-main-light: #f4f4f5;
  --text-muted-light: #a1a1aa;
  --text-subtle: #71717a;
  --text-inverse: #09090b;
  
  /* Monochrome Brand Tokens */
  --primary: #f4f4f5;
  --primary-hover: #e4e4e7;
  --primary-gradient: linear-gradient(135deg, #27272a 0%, #18181b 100%);
  --secondary: #71717a;
  --accent: #a1a1aa;
  --accent-blue: #a1a1aa;
  --accent-glow: rgba(161, 161, 170, 0.15);
  
  --shadow-glow: 0 0 15px rgba(255, 255, 255, 0.05);
}

/* Light Mode Tokens under IT Grayscale */
body.it-grayscale-theme.light-theme {
  --bg-main: #f4f4f5;
  --bg-card: #ffffff;
  --bg-card-subtle: #ececed;
  --bg-input: #ffffff;
  --bg-hover: #f4f4f5;
  --bg-dark: #f4f4f5;
  
  --border-color: #e4e4e7;
  --border-hover: #d4d4d8;
  --border-focus: #18181b;
  
  --text-main: #18181b;
  --text-muted: #71717a;
  --text-dark: #18181b;
  --text-main-light: #18181b;
  --text-muted-light: #71717a;
  --text-subtle: #a1a1aa;
  --text-inverse: #ffffff;
  
  /* Achromatic Brand Tokens */
  --primary: #18181b;
  --primary-hover: #27272a;
  --primary-gradient: linear-gradient(135deg, #18181b 0%, #27272a 100%);
  --secondary: #71717a;
  --accent: #52525b;
  --accent-blue: #18181b;
  --accent-glow: rgba(24, 24, 27, 0.12);
  
  --shadow-glow: 0 0 15px rgba(24, 24, 27, 0.08);
}

/* Option 1 Sidebar Architecture (Dark Graphite Rail) */
body.it-grayscale-theme .app-sidebar {
  background: #121214 !important;
  border-right: 1px solid #27272a !important;
  box-shadow: none !important;
}

body.it-grayscale-theme .sidebar-brand {
  border-bottom: 1px solid #27272a;
}

body.it-grayscale-theme .nav-section-divider {
  color: #71717a;
}

body.it-grayscale-theme .nav-divider-line {
  background: #27272a;
}

body.it-grayscale-theme .tab-btn {
  color: #a1a1aa;
}

body.it-grayscale-theme .tab-btn:hover {
  background: #1c1c1f;
  color: #f4f4f5;
}

body.it-grayscale-theme .tab-btn.active {
  background: #27272a !important;
  color: #ffffff !important;
  border-left: 3px solid #ffffff !important;
  font-weight: 600;
}

body.it-grayscale-theme .user-profile-banner {
  background: #18181b;
  border-top: 1px solid #27272a;
}

/* Option 1 Topbar Architecture */
body.it-grayscale-theme .app-topbar {
  background: #141416;
  border-bottom: 1px solid #27272a;
}

body.it-grayscale-theme.light-theme .app-topbar {
  background: #ffffff;
  border-bottom: 1px solid #e4e4e7;
}

/* Option 1 Primary Buttons & Controls */
body.it-grayscale-theme .btn-primary {
  background: #18181b;
  color: #ffffff;
  border: 1px solid #3f3f46;
}

body.it-grayscale-theme .btn-primary:hover {
  background: #27272a;
  border-color: #52525b;
}

body.it-grayscale-theme:not(.light-theme) .btn-primary {
  background: #27272a;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
}

body.it-grayscale-theme:not(.light-theme) .btn-primary:hover {
  background: #3f3f46;
  color: #ffffff;
}

/* Option 1 High-Density Data Tables */
body.it-grayscale-theme .data-table th {
  background: #18181b;
  color: #a1a1aa;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #27272a;
}

body.it-grayscale-theme.light-theme .data-table th {
  background: #f4f4f5;
  color: #71717a;
  border-bottom: 1px solid #e4e4e7;
}

body.it-grayscale-theme .data-table tr:hover {
  background: rgba(39, 39, 42, 0.4);
}

body.it-grayscale-theme.light-theme .data-table tr:hover {
  background: #f4f4f5;
}

/* Option 1 Monochrome Badges & Hashes */
body.it-grayscale-theme .badge,
body.it-grayscale-theme .sync-service-badge {
  font-family: var(--font-mono);
  border-radius: 4px;
}

body.it-grayscale-theme .badge-google,
body.it-grayscale-theme .badge-photos,
body.it-grayscale-theme .badge-carddav {
  background: #27272a !important;
  color: #f4f4f5 !important;
  border: 1px solid #3f3f46 !important;
}

body.it-grayscale-theme.light-theme .badge-google,
body.it-grayscale-theme.light-theme .badge-photos,
body.it-grayscale-theme.light-theme .badge-carddav {
  background: #ececed !important;
  color: #18181b !important;
  border: 1px solid #d4d4d8 !important;
}

/* Stat Cards in IT Grayscale */
body.it-grayscale-theme .stat-card {
  border: 1px solid #27272a;
  background: #141416;
}

body.it-grayscale-theme.light-theme .stat-card {
  border: 1px solid #e4e4e7;
  background: #ffffff;
}

/* Telemetry IT Indicator Pill in Topbar */
.it-theme-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: #27272a;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
  margin-left: 0.75rem;
}

body.light-theme .it-theme-mode-badge {
  background: #f4f4f5;
  color: #18181b;
  border: 1px solid #e4e4e7;
}

/* ==========================================================================
   PAGE THEME MANAGER COMPONENT STYLES
   ========================================================================== */

.theme-pill-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.theme-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.theme-pill-btn.active-color {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.theme-pill-btn.active-grayscale {
  background: #18181b;
  color: #ffffff;
  border: 1px solid #3f3f46;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

body.light-theme .theme-pill-btn.active-grayscale {
  background: #18181b;
  color: #ffffff;
  border: 1px solid #09090b;
}

.theme-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
}

.theme-status-tag.tag-color {
  background: rgba(37, 99, 235, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.theme-status-tag.tag-grayscale {
  background: rgba(113, 113, 122, 0.15);
  color: #d4d4d8;
  border: 1px solid #3f3f46;
  font-family: var(--font-mono);
}

body.light-theme .theme-status-tag.tag-grayscale {
  background: #f4f4f5;
  color: #18181b;
  border: 1px solid #e4e4e7;
}

/* --------------------------------------------------------------------------
   16. ENTERPRISE AUDIT & USER CHANGE LOGGING PLATFORM
   -------------------------------------------------------------------------- */
.audit-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.audit-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.audit-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.audit-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  font-family: var(--font-mono);
}

.audit-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

.audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--bg-card-subtle);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.audit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.audit-badge.badge-create {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.audit-badge.badge-update {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.audit-badge.badge-delete {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.audit-badge.badge-bulk {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.audit-badge.badge-sync {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.audit-diff-chip {
  display: inline-block;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin: 0.15rem 0.2rem 0.15rem 0;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.diff-field-name {
  color: var(--accent);
  font-weight: 600;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.diff-table th,
.diff-table td {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  text-align: left;
}

.diff-table th {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.diff-val-old {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  word-break: break-all;
  text-decoration: line-through;
}

.diff-val-new {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  word-break: break-all;
}

/* Live Synchronization Job Stepper */
.sync-stepper-card {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.3s ease;
}

.sync-stepper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sync-stepper-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.sync-step-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.sync-step-item.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-main);
  font-weight: 600;
}

.sync-step-item.completed {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
}

.sync-step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-shrink: 0;
}

.sync-step-item.active .sync-step-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.sync-step-item.completed .sync-step-circle {
  border-color: #10b981;
  background: #10b981;
  color: #ffffff;
}

.sync-progress-bar-container {
  height: 8px;
  background: var(--bg-card-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.sync-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.sync-stepper-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   RBAC Auto-Save Indicator & Multi-Role Assignment Styling
   ========================================================================== */

.rbac-autosave-indicator {
  transition: all 0.2s ease;
  user-select: none;
}

.rbac-autosave-indicator.saving {
  background: rgba(59, 130, 246, 0.08) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #2563eb !important;
}

.rbac-autosave-indicator.saving .autosave-dot {
  background: #3b82f6 !important;
  animation: pulse-dot 1s infinite alternate;
}

.rbac-autosave-indicator.error {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #dc2626 !important;
}

.rbac-autosave-indicator.error .autosave-dot {
  background: #ef4444 !important;
}

@keyframes pulse-dot {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 1; }
}

/* Role Badges / Pills on Tables */
.role-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.role-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  line-height: 1.25;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle, rgba(0,0,0,0.03));
  color: var(--text-main);
  white-space: nowrap;
}

.role-tag-pill.pill-admin {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.3);
}

.role-tag-pill.pill-desk_editor {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.3);
}

.role-tag-pill.pill-cell_editor {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}

.role-tag-pill.pill-photo_auditor {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.3);
}

.role-tag-pill.pill-communications {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  border-color: rgba(139, 92, 246, 0.3);
}

.role-tag-pill.pill-support_agent {
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  border-color: rgba(14, 165, 233, 0.3);
}

.role-tag-pill.pill-viewer {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.3);
}

.btn-manage-user-roles {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-manage-user-roles:hover {
  background: rgba(26, 115, 232, 0.08);
  border-color: var(--accent);
}

/* Multi-Role Chips for Forms */
.rbac-roles-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.35rem 0;
}

.role-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.role-chip-label:hover {
  border-color: var(--accent);
  background: var(--bg-card-subtle);
}

.role-chip-label input[type="checkbox"] {
  cursor: pointer;
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  margin: 0;
}

.role-chip-label.selected {
  background: rgba(26, 115, 232, 0.08);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Role Option Card in Modal */
.user-role-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-role-option-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-subtle);
}

.user-role-option-card.active {
  border-color: var(--accent);
  background: rgba(26, 115, 232, 0.05);
}

.user-role-option-card input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.user-role-option-info {
  flex: 1;
}

.user-role-option-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-role-option-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.35;
}

/* --------------------------------------------------------------------------
   DIRECTORY VIEW SWITCHER (Table, Compact List, Card Grid)
   -------------------------------------------------------------------------- */
.directory-view-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.view-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.2;
}

.view-switch-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.view-switch-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

body.light-theme .view-switch-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.view-switch-icon {
  font-size: 0.85rem;
  line-height: 1;
}

/* Compact List View */
.contacts-grouped-container.view-compact {
  gap: 0.65rem;
}

.contacts-grouped-container.view-compact .location-section {
  margin-bottom: 0;
}

.contacts-grouped-container.view-compact .location-section-header {
  margin-bottom: 0.25rem;
  padding-left: 0.15rem;
}

.contacts-grouped-container.view-compact .location-section-header h2 {
  font-size: 0.925rem;
  font-weight: 700;
  gap: 0.45rem;
  margin: 0;
}

.contacts-grouped-container.view-compact .location-section-header h2::before {
  width: 3px;
  height: 13px;
}

.contacts-grouped-container.view-compact .location-section-header .section-count {
  font-size: 0.6875rem;
  padding: 0.1rem 0.5rem;
}

.compact-contacts-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.compact-contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
  transition: background-color var(--transition-fast);
}

.compact-contact-row:last-child {
  border-bottom: none;
}

.compact-contact-row:hover {
  background-color: var(--bg-hover);
}

.compact-col-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 220px;
  flex: 1 1 240px;
}

.compact-avatar-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  cursor: pointer;
  background: var(--bg-card-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.compact-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compact-info-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.compact-name-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.compact-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.compact-col-phones {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.compact-phone-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.compact-phone-pill:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.compact-phone-pill.cell {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
}

.compact-phone-pill.cell:hover {
  background: rgba(16, 185, 129, 0.16);
}

.compact-col-email {
  font-size: 0.8125rem;
  flex: 0 1 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-col-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.compact-col-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.28rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.compact-action-btn {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.2;
}

.compact-action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.compact-action-btn.danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.compact-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

.compact-action-btn.primary {
  color: var(--primary);
  border-color: rgba(26, 115, 232, 0.35);
  background: rgba(26, 115, 232, 0.08);
}

.compact-action-btn.primary:hover {
  background: rgba(26, 115, 232, 0.18);
  border-color: var(--primary);
}

#deskphone-compact-container,
#workspace-compact-container {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

#deskphone-cards-container,
#workspace-cards-container {
  background: var(--bg-card);
}

/* Card Grid View */
.cards-contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.contact-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

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

.contact-card-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.contact-card-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--bg-card-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-card-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.25;
}

.contact-card-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 0.1rem;
}

.contact-card-location-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.contact-card-comms {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.contact-card-phone-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.contact-card-phone-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.contact-card-phone-btn.cell {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
}

.contact-card-phone-btn.cell:hover {
  background: rgba(16, 185, 129, 0.16);
}

.contact-card-email-line {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-card-email-line:hover {
  text-decoration: underline;
}

.contact-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .compact-col-email {
    display: none;
  }
  .cards-contacts-grid {
    grid-template-columns: 1fr;
  }
}


