* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Mobile viewport height fix */
html {
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height - excludes mobile browser UI */
  min-height: calc(var(--vh, 1vh) * 100); /* JS fallback */
  overflow-x: hidden;
  max-width: 100vw;
}

/* Prevent body scroll when modal open */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

:root {
  /* Mobile viewport variable */
  --vh: 1vh;
  /* Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-alt: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-overlay: rgba(15, 23, 42, 0.4);
  --accent-green: #16a34a;
  --accent-green-light: rgba(22, 163, 74, 0.1);
  --accent-yellow: #ca8a04;
  --accent-yellow-light: rgba(202, 138, 4, 0.1);
  --accent-red: #dc2626;
  --accent-red-light: rgba(220, 38, 38, 0.1);
  --accent-blue: #2563eb;
  --accent-blue-light: rgba(37, 99, 235, 0.1);
  --accent-amber: #d97706;
  --accent-amber-light: rgba(217, 119, 6, 0.1);
  --accent-emerald: #059669;
  --accent-emerald-light: rgba(5, 150, 105, 0.1);
  --accent-purple: #9333ea;
  --accent-purple-light: rgba(147, 51, 234, 0.1);
  --accent-cyan: #0891b2;
  --accent-cyan-light: rgba(8, 145, 178, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-subtle: rgba(0,0,0,0.08);
  --border-default: #e2e8f0;
  --border-light: #f1f5f9;

  /* Radius scale */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --glow-green: rgba(22, 163, 74, 0.15);

  /* Accent dark variants */
  --accent-green-dark: #15803d;

  /* Slate scale */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;

  /* Green scale */
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;

  /* Blue scale */
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;

  /* Red scale */
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;

  /* Yellow scale */
  --yellow-100: #fef3c7;
  --yellow-600: #d97706;

  /* Orange scale */
  --orange-100: #ffedd5;
  --orange-500: #f97316;

  /* Purple scale */
  --purple-100: #f3e8ff;
  --purple-500: #8b5cf6;

  /* Teal scale */
  --teal-100: #ccfbf1;
  --teal-500: #14b8a6;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-alt: #334155;
  --bg-sidebar: #1e293b;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: rgba(255,255,255,0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
  --border-default: #334155;
  --border-light: #1e293b;
  --accent-green-dark: #22c55e;

  /* Slate scale - dark */
  --slate-50: #1e293b;
  --slate-100: #334155;
  --slate-200: #475569;
  --slate-300: #64748b;
  --slate-400: #94a3b8;
  --slate-500: #cbd5e1;
  --slate-600: #e2e8f0;

  /* Green scale - dark */
  --green-50: rgba(22,163,74,0.1);
  --green-100: rgba(22,163,74,0.15);
  --green-200: rgba(22,163,74,0.25);
  --green-300: rgba(22,163,74,0.35);
  --green-500: #4ade80;
  --green-600: #22c55e;
  --green-700: #4ade80;

  /* Blue scale - dark */
  --blue-100: rgba(37,99,235,0.15);
  --blue-500: #60a5fa;
  --blue-600: #3b82f6;

  /* Red scale - dark */
  --red-100: rgba(220,38,38,0.15);
  --red-500: #f87171;
  --red-600: #ef4444;

  /* Yellow scale - dark */
  --yellow-100: rgba(234,179,8,0.15);
  --yellow-600: #facc15;

  /* Orange scale - dark */
  --orange-100: rgba(249,115,22,0.15);
  --orange-500: #fb923c;

  /* Purple scale - dark */
  --purple-100: rgba(139,92,246,0.15);
  --purple-500: #a78bfa;

  /* Teal scale - dark */
  --teal-100: rgba(20,184,166,0.15);
  --teal-500: #2dd4bf;
}

/* The Yard Theme - Nature-inspired green palette */
[data-theme="yard"] {
  --bg-primary: #e8f4ec;
  --bg-secondary: #d4edda;
  --bg-card: #ffffff;
  --bg-card-alt: #f0f9f2;
  --bg-sidebar: #ffffff;
  --bg-overlay: rgba(30, 70, 32, 0.4);

  /* Greens from The Yard palette */
  --accent-green: #22c55e;
  --accent-green-light: rgba(34, 197, 94, 0.15);
  --accent-yellow: #f5a623;
  --accent-yellow-light: rgba(245, 166, 35, 0.15);
  --accent-red: #e74c3c;
  --accent-red-light: rgba(231, 76, 60, 0.1);
  --accent-blue: #3498db;
  --accent-blue-light: rgba(52, 152, 219, 0.1);
  --accent-amber: #f39c12;
  --accent-amber-light: rgba(243, 156, 18, 0.1);
  --accent-emerald: #15803d;
  --accent-emerald-light: rgba(21, 128, 61, 0.1);
  --accent-purple: #9b59b6;
  --accent-purple-light: rgba(155, 89, 182, 0.1);
  --accent-cyan: #00bcd4;
  --accent-cyan-light: rgba(0, 188, 212, 0.1);

  --text-primary: #1a2f1a;
  --text-secondary: #4a5d4a;
  --text-muted: #6b7c6b;
  --border-subtle: rgba(39, 174, 96, 0.15);
  --shadow-sm: 0 1px 3px rgba(39, 174, 96, 0.08);
  --shadow-md: 0 4px 12px rgba(39, 174, 96, 0.1);
  --shadow-lg: 0 10px 40px rgba(39, 174, 96, 0.15);
  --glow-green: rgba(39, 174, 96, 0.2);
}

/* Yard theme specific styles */
[data-theme="yard"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f0f9f2 100%);
  border-right-color: rgba(39, 174, 96, 0.1);
}

[data-theme="yard"] .main-content {
  background: linear-gradient(180deg, #e8f4ec 0%, #d4edda 50%, #c8e6c9 100%);
}

[data-theme="yard"] .stat-card {
  border: 1px solid rgba(39, 174, 96, 0.1);
}

/* Subtle grass decoration at bottom for yard theme */
[data-theme="yard"]::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(39, 174, 96, 0.2) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* ==================== ACCESSIBILITY ==================== */

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -50px;
  left: 16px;
  padding: 12px 24px;
  background: var(--accent-green);
  color: white;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  z-index: 10001;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* Focus indicators */
*:focus {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible, [role="button"]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent-green);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.15);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Font size adjustment */
[data-font-size="large"] {
  font-size: 110%;
}

[data-font-size="larger"] {
  font-size: 120%;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-subtle: rgba(0,0,0,0.3);
  }
  [data-theme="dark"] {
    --border-subtle: rgba(255,255,255,0.3);
  }
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ============================================ */
/* UTILITY CLASSES */
/* ============================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

/* ============================================ */
/* LOGIN SCREEN */
/* ============================================ */
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: 
    radial-gradient(ellipse at 20% 20%, rgba(22, 163, 74, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(217, 119, 6, 0.04) 0%, transparent 40%);
  padding: 20px;
  position: relative;
}

.login-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg), 0 0 100px rgba(22, 163, 74, 0.05);
  animation: fadeInUp 0.5s ease-out;
}

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

.login-header { text-align: center; margin-bottom: 36px; }

.logo-container {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 40px;
  box-shadow: 0 8px 32px rgba(22, 163, 74, 0.25);
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.login-header p { color: var(--text-secondary); font-size: 1rem; }

.form-group { margin-bottom: 24px; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.company-selector { display: flex; gap: 12px; }

.company-option {
  flex: 1;
  padding: 16px;
  background: var(--bg-card-alt);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.company-option:hover { border-color: var(--text-muted); }

.company-option.selected {
  border-color: var(--accent-green);
  background: var(--accent-green-light);
}

.company-option .icon { font-size: 1.8rem; margin-bottom: 8px; }
.company-option .name { font-weight: 600; font-size: 0.95rem; }

.pin-input-container {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pin-digit {
  width: 60px;
  height: 72px;
  background: var(--bg-card-alt);
  border: 2px solid var(--border-subtle);
  border-radius: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  transition: all 0.2s ease;
  outline: none;
}

.pin-digit:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 4px var(--glow-green);
}

.pin-digit.filled {
  border-color: var(--accent-green);
  background: var(--accent-green-light);
}

.pin-digit.error {
  border-color: var(--accent-red);
  background: var(--accent-red-light);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.login-btn {
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald));
  border: none;
  border-radius: var(--radius-lg);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(22, 163, 74, 0.35);
}

.error-message {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--accent-red);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  margin-top: 16px;
  display: none;
  animation: errorShake 0.4s ease;
}

.error-message.visible { display: block; }

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.login-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

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

.theme-toggle-float {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle-float:hover { background: var(--bg-secondary); }

/* ============================================ */
/* MAIN PORTAL LAYOUT */
/* ============================================ */
#portalScreen {
  display: none;
  min-height: 100vh;
}

#portalScreen.active { display: flex; }

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height - accounts for mobile browser chrome */
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  box-shadow: 2px 0 20px rgba(0,0,0,0.03);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
  overflow: hidden;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.logo-text h2 { font-size: 1.15rem; font-weight: 700; }
.logo-text span { font-size: 0.8rem; color: var(--text-muted); }

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
}

.user-avatar.blue { background: var(--accent-blue); }
.user-avatar.green { background: var(--accent-green); }
.user-avatar.purple { background: var(--accent-purple); }
.user-avatar.amber { background: var(--accent-amber); }
.user-avatar.cyan { background: var(--accent-cyan); }

.user-details .name { font-weight: 600; font-size: 0.95rem; }
.user-details .role { font-size: 0.8rem; color: var(--text-muted); }

/* Desktop Notification Bell (in sidebar user-info) */
.desktop-notification-bell {
  position: relative;
  background: none;
  border: none;
  padding: 8px;
  margin-left: auto;
  cursor: pointer;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.desktop-notification-bell:hover {
  background: var(--bg-tertiary);
  color: var(--primary);
}

.desktop-notification-bell svg {
  display: block;
}

.desktop-notification-bell .notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #f44336;
  color: white;
  font-size: 0.6rem;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.desktop-notification-bell .notification-badge.hidden {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
  min-height: 0; /* Allow shrinking for flexbox */
}

.nav-section { margin-bottom: 16px; }

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  user-select: none;
}
.nav-section-title:hover { background: var(--bg-hover, rgba(0,0,0,0.04)); }
.nav-section-title::after {
  content: '\25BE';
  font-size: 0.65rem;
  transition: transform 0.2s;
  opacity: 0.5;
}
.nav-section.collapsed .nav-section-title::after {
  transform: rotate(-90deg);
}
.nav-section.collapsed > .nav-item,
.nav-section.collapsed > #peopleNavList,
.nav-section.collapsed > #savedViewsList {
  display: none !important;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 2px;
  font-weight: 500;
}

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

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-green-light), rgba(22, 163, 74, 0.05));
  color: var(--accent-green);
  border-left: 3px solid var(--accent-green);
  margin-left: -3px;
}

.nav-item .icon { font-size: 1.1rem; width: 22px; text-align: center; }
.nav-item .label { font-size: 0.9rem; }

.nav-item .badge {
  margin-left: auto;
  background: var(--accent-red);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

/* The Yard link */
.yard-link {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--accent-green);
}
.yard-link:hover {
  background: rgba(22, 163, 74, 0.08);
  color: var(--accent-green-dark);
}

/* Saved view delete button */
.saved-view-item {
  position: relative;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
}
.saved-view-item .label {
  flex: 1;
}
.saved-view-delete {
  display: inline-block;
  padding: 2px 8px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
  margin-left: 4px;
}
.saved-view-delete:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.sidebar-footer {
  padding: 12px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0; /* Prevent footer from shrinking */
}

.theme-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s;
}

.theme-switch:hover { background: var(--bg-card-alt); }
.theme-switch .icon { font-size: 1rem; }
.theme-switch .label { font-size: 0.85rem; color: var(--text-secondary); }

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--accent-red-light);
  color: var(--accent-red);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.logout-btn:hover { background: var(--accent-red); color: white; }

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 24px 28px;
  min-height: 100vh;
  background-image: radial-gradient(ellipse at 80% 20%, rgba(22, 163, 74, 0.03) 0%, transparent 50%);
  overflow-x: hidden;
  max-width: calc(100vw - 280px);
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-header .subtitle { color: var(--text-secondary); font-size: 0.95rem; }

.header-actions { display: flex; gap: 10px; }

/* Buttons */
.btn {
  padding: 11px 20px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(22, 163, 74, 0.3);
}

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

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

/* Data source indicator badge */
.source-badge {
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 500;
  align-items: center;
  gap: 4px;
}
.source-badge.source-d1 {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-500);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.source-badge.source-jotform {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.btn-warning:hover { background: rgba(217, 119, 6, 0.15); }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

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

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-icon { font-size: 1.4rem; }

.stat-trend {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.stat-trend.up { background: var(--accent-green-light); color: var(--accent-green); }
.stat-trend.down { background: var(--accent-red-light); color: var(--accent-red); }
.stat-trend.neutral { background: var(--bg-secondary); color: var(--text-muted); }

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card.open .stat-value { color: var(--accent-blue); }
.stat-card.escalated .stat-value { color: var(--accent-red); }
.stat-card.today .stat-value { color: var(--accent-amber); }
.stat-card.resolved .stat-value { color: var(--accent-green); }

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

/* Stat Card Clickable */
.stat-card { cursor: pointer; }

/* Morning Briefing Card */
.briefing-card {
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  border: 1px solid #bae6fd;
}
.briefing-header { margin-bottom: 10px; }
.briefing-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}
.briefing-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.briefing-item.clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin: 0 -8px;
  transition: background 0.15s ease;
}
.briefing-item.clickable:hover {
  background: rgba(0,0,0,0.04);
}
.briefing-icon { font-size: 16px; flex-shrink: 0; }
.briefing-text { font-size: 14px; color: var(--text-primary); }
.briefing-arrow { color: var(--text-muted); margin-left: auto; flex-shrink: 0; }

/* Quick Actions Bar */
.quick-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.quick-action-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  color: var(--text-primary);
}
.quick-action-btn:hover {
  background: var(--green-50);
  border-color: var(--primary);
  color: var(--primary);
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card-alt);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header .badge {
  background: var(--accent-red);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  margin-left: 8px;
}

.view-all {
  font-size: 0.85rem;
  color: var(--accent-green);
  text-decoration: none;
  font-weight: 600;
}

.view-all:hover { text-decoration: underline; }

/* Task List */
.task-list { padding: 0; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}

.task-item:hover { background: var(--bg-card-alt); }
.task-item:last-child { border-bottom: none; }

.task-signal {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.task-signal.pending { background: var(--accent-blue); }
.task-signal.in-progress { background: var(--accent-amber); box-shadow: 0 0 8px rgba(217, 119, 6, 0.4); }
.task-signal.escalated { background: var(--accent-red); box-shadow: 0 0 8px rgba(220, 38, 38, 0.4); }
.task-signal.resolved { background: var(--accent-green); }

.task-content { flex: 1; min-width: 0; }

.task-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
  line-height: 1.3;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.task-type {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.task-type.bag-rate { background: var(--accent-purple-light); color: var(--accent-purple); }
.task-type.truck-wash { background: var(--accent-cyan-light); color: var(--accent-cyan); }
.task-type.inventory { background: var(--accent-amber-light); color: var(--accent-amber); }
.task-type.complaint { background: var(--accent-red-light); color: var(--accent-red); }
.task-type.customer_complaint { background: var(--accent-red-light); color: var(--accent-red); }
.task-type.customer-complaint { background: var(--accent-red-light); color: var(--accent-red); }
.task-type.complaint-type { background: var(--accent-red-light); color: var(--accent-red); font-weight: 600; }
.task-type.compliance { background: var(--accent-blue-light); color: var(--accent-blue); }
.task-type.call-off { background: var(--accent-red-light); color: var(--accent-red); }
.task-type.pto { background: var(--accent-emerald-light); color: var(--accent-emerald); }
.task-type.inventory-compliance { background: var(--accent-amber-light); color: var(--accent-amber); }
.task-type.shop-duties-compliance { background: var(--accent-blue-light); color: var(--accent-blue); }

/* Complaint task visual indicators */
.complaint-badge { font-size: 0.9em; }
.complaint-card { border-left: 3px solid var(--accent-red, #ef4444) !important; }
.kanban-card.complaint-card { border-left: 3px solid var(--accent-red, #ef4444); }
.task-card.complaint-card { border-left: 3px solid var(--accent-red, #ef4444); }

.task-due {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.task-due.overdue { color: var(--accent-red); }
.task-due.due-soon { color: var(--accent-amber); }
.task-due.ok { color: var(--text-muted); }

/* Activity Feed */
.activity-list { padding: 0; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

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

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

.activity-icon.resolved { background: var(--accent-green-light); color: var(--accent-green); }
.activity-icon.escalated { background: var(--accent-red-light); color: var(--accent-red); }
.activity-icon.created { background: var(--accent-blue-light); color: var(--accent-blue); }
.activity-icon.progress { background: var(--accent-amber-light); color: var(--accent-amber); }

.activity-content { flex: 1; }

.activity-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.activity-text strong { color: var(--text-primary); }

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Workload */
.workload-list { padding: 16px 20px; }

.workload-item { margin-bottom: 18px; }
.workload-item:last-child { margin-bottom: 0; }

.workload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.workload-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.workload-name .avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  background: var(--accent-blue);
}

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

.workload-count .overdue { color: var(--accent-red); font-weight: 600; }

.workload-bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.workload-progress {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.workload-progress.high { background: linear-gradient(90deg, var(--accent-red), #ef4444); }
.workload-progress.medium { background: linear-gradient(90deg, var(--accent-amber), #f59e0b); }
.workload-progress.low { background: linear-gradient(90deg, var(--accent-green), #22c55e); }

/* ============================================ */
/* TASK DETAIL PANEL */
/* ============================================ */
.task-panel-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  justify-content: flex-end;
}

.task-panel-overlay.active { display: flex; }

.task-panel {
  width: 580px;
  max-width: 100%;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease;
  box-shadow: -10px 0 40px rgba(0,0,0,0.15);
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card-alt);
}

.panel-header-left { flex: 1; }

.task-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

.task-type-badge.escalated { background: var(--accent-red-light); color: var(--accent-red); }
.task-type-badge.pending { background: var(--accent-blue-light); color: var(--accent-blue); }
.task-type-badge.in-progress { background: var(--accent-amber-light); color: var(--accent-amber); }

.panel-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}

.task-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.panel-header-right { display: flex; gap: 8px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.icon-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.icon-btn.close:hover { background: var(--accent-red-light); color: var(--accent-red); }

.status-bar {
  display: flex;
  gap: 12px;
  padding: 14px 24px;
  background: var(--accent-red-light);
  border-bottom: 1px solid var(--border-subtle);
}

.status-bar.pending { background: var(--accent-blue-light); }
.status-bar.in-progress { background: var(--accent-amber-light); }

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 10px;
  flex: 1;
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.4);
}

.status-text { font-weight: 600; font-size: 0.9rem; color: var(--accent-red); }

.due-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(220, 38, 38, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.due-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-red);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.section { margin-bottom: 28px; }

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.info-item {
  background: var(--bg-card-alt);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
}

.info-item.full-width { grid-column: span 2; }

.info-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.info-value { font-size: 0.95rem; font-weight: 500; }
.info-value.mono { font-family: 'JetBrains Mono', monospace; }
.info-value.overdue { color: var(--accent-red); }

.assignee-display { display: flex; align-items: center; gap: 12px; }

.assignee-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
}

.assignee-details .name { font-weight: 600; font-size: 1rem; }
.assignee-details .role { font-size: 0.8rem; color: var(--text-muted); }

.edit-btn {
  margin-left: auto;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-btn:hover {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.summary-box {
  background: var(--bg-card-alt);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.summary-box p { margin-bottom: 10px; }
.summary-box p:last-child { margin-bottom: 0; }
.summary-box strong { color: var(--text-primary); }

.source-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.source-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.source-link .icon { font-size: 1.2rem; }
.source-link .text { flex: 1; }
.source-link .text .label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.source-link .text .value { font-weight: 500; font-size: 0.9rem; }
.source-link .arrow { color: var(--text-muted); }

/* Resolution Notes Textarea */
.notes-textarea {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  background: var(--bg-card-alt);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}

.notes-textarea:focus {
  border-color: var(--accent-green);
}

.notes-textarea::placeholder { color: var(--text-muted); }

/* Timeline */
.timeline {
  position: relative;
  padding-left: 32px;
}

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

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

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

.timeline-dot {
  position: absolute;
  left: -32px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  font-weight: 700;
}

.timeline-dot.created { border-color: var(--accent-blue); color: var(--accent-blue); }
.timeline-dot.escalated { border-color: var(--accent-red); color: var(--accent-red); }
.timeline-dot.comment { border-color: var(--accent-purple); color: var(--accent-purple); }
.timeline-dot.status { border-color: var(--accent-amber); color: var(--accent-amber); }
.timeline-dot.resolved { border-color: var(--accent-green); color: var(--accent-green); background: var(--accent-green-light); }
.timeline-dot.reassign { border-color: var(--accent-cyan, #22d3ee); color: var(--accent-cyan, #22d3ee); }
.timeline-dot.note { border-color: var(--accent-teal, #14b8a6); color: var(--accent-teal, #14b8a6); }
.timeline-dot.default { border-color: var(--text-muted); color: var(--text-muted); }

.timeline-content {
  background: var(--bg-card-alt);
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.timeline-actor { font-weight: 600; font-size: 0.9rem; }
.timeline-time { font-size: 0.75rem; color: var(--text-muted); }
.timeline-text { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }

.panel-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-alt);
  display: flex;
  gap: 12px;
}

.panel-footer .btn { flex: 1; justify-content: center; }

/* ============================================ */
/* LEADERSHIP CONSOLE */
/* ============================================ */
.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.header-left { display: flex; align-items: center; gap: 16px; }

.header-title h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: 2px; }
.header-title span { font-size: 0.85rem; color: var(--text-muted); }

.header-center { display: flex; gap: 8px; }

.company-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.company-tab {
  padding: 10px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.company-tab:hover { background: var(--bg-card); }

.company-tab.active {
  background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald));
  color: white;
  border-color: transparent;
}

.company-tab.rlc.active { background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald)); }
.company-tab.gx.active { background: linear-gradient(135deg, var(--accent-cyan), #0284c7); }

.header-right { display: flex; align-items: center; gap: 16px; }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--accent-green-light);
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-green);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
}

.datetime { text-align: right; }

.datetime .time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-amber);
}

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

.console-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.console-stats .stat-card {
  text-align: center;
  padding: 18px;
}

.console-stats .stat-icon { font-size: 1.4rem; margin-bottom: 10px; }
.console-stats .stat-value { font-size: 2rem; margin-bottom: 4px; }

.console-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

.left-column { display: flex; flex-direction: column; gap: 20px; }

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Activity Stream */
.activity-stream { max-height: 400px; overflow-y: auto; }

.activity-company {
  margin-left: auto;
  padding: 2px 8px;
  background: var(--accent-green-light);
  color: var(--accent-green);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
}

/* Task Breakdown */
.task-breakdown { padding: 16px 20px; }

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.breakdown-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.breakdown-icon { font-size: 1rem; }
.breakdown-label { font-size: 0.9rem; color: var(--text-secondary); }

.breakdown-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Manager Workload Grid */
.workload-grid { padding: 16px 20px; }

.manager-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.manager-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
}

.manager-info { flex: 1; }
.manager-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }

.manager-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.manager-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.manager-stats { text-align: right; }
.manager-total { font-weight: 700; font-size: 1.1rem; }
.manager-overdue { font-size: 0.75rem; color: var(--accent-red); }

/* Teams Grid */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  padding: 0 20px 20px;
}

.team-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.team-card-header {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-card-title {
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-card-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: var(--radius-lg);
}

.team-members-list {
  padding: 8px 0;
  max-height: 400px;
  overflow-y: auto;
}

.team-member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.team-member-item:hover {
  background: var(--bg-secondary);
}

.team-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
}

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

.team-member-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-member-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.team-member-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.team-member-badge.leadership {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
}

.team-member-badge.manager {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
}

.team-member-badge.lead-tech {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
}

@media (max-width: 768px) {
  .teams-grid {
    grid-template-columns: 1fr;
    padding: 0 12px 12px;
  }
}

/* Who's Out */
.whos-out { padding: 12px 20px; }

.out-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.out-type {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
}

.out-type.pto { background: var(--accent-purple-light); color: var(--accent-purple); }
.out-type.calloff { background: var(--accent-red-light); color: var(--accent-red); }
.out-type.birthday { background: #fce7f3; color: #db2777; }

.out-name { font-weight: 600; font-size: 0.9rem; flex: 1; }
.out-detail { font-size: 0.8rem; color: var(--text-muted); }

/* ============================================ */
/* EASTER EGG */
/* ============================================ */
.easter-egg {
  position: fixed;
  bottom: 10px;
  right: 14px;
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.25;
  font-family: 'JetBrains Mono', monospace;
  cursor: default;
  user-select: none;
  transition: opacity 0.3s;
  z-index: 50;
}

.easter-egg:hover { opacity: 0.6; }

/* ============================================ */
/* TASKS VIEW STYLES */
/* ============================================ */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 250px;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

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

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

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

.filter-select {
  padding: 11px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  min-width: 130px;
}

.filter-select:focus { border-color: var(--accent-green); }

.active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.filter-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--accent-green-light);
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  color: var(--accent-green);
  font-weight: 500;
}

.filter-tag .remove {
  cursor: pointer;
  opacity: 0.7;
  font-size: 0.75rem;
}

.filter-tag .remove:hover { opacity: 1; }

.clear-filters {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  transition: color 0.15s;
}

.clear-filters:hover { color: var(--accent-red); }

.results-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 4px;
}

.results-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.results-count strong { color: var(--text-primary); }

.view-options { display: flex; gap: 6px; }

.view-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

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

.view-btn.active {
  background: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
}

/* Task Card View */
.task-card-view {
  margin-top: 0;
}

.task-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

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

.task-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.task-card.pending::before { background: var(--accent-amber); }
.task-card.in-progress::before { background: var(--accent-blue); }
.task-card.escalated::before { background: var(--accent-red); }
.task-card.resolved::before { background: var(--accent-green); }

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.task-card-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.4;
  flex: 1;
  margin-right: 8px;
}

.task-card-status {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-lg);
  font-weight: 500;
  white-space: nowrap;
}

.task-card-status.pending { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.task-card-status.in-progress { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.task-card-status.escalated { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.task-card-status.resolved { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }

.task-card-body {
  margin-bottom: 12px;
}

.task-card-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.task-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-card-type {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.task-card-due {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.task-card-due.overdue { color: var(--accent-red); font-weight: 600; }
.task-card-due.due-soon { color: var(--accent-amber); font-weight: 600; }

.task-card-assignee {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-card-assignee .mini-avatar {
  width: 24px;
  height: 24px;
  font-size: 0.65rem;
}

.task-card-assignee span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Kanban View */
.task-kanban-view {
  margin-top: 0;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-height: 500px;
}

.kanban-column {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  margin-bottom: 12px;
}

.kanban-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.kanban-status-dot.pending { background: var(--accent-amber); }
.kanban-status-dot.in-progress { background: var(--accent-blue); }
.kanban-status-dot.escalated { background: var(--accent-red); }
.kanban-status-dot.resolved { background: var(--accent-green); }

.kanban-column-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  flex: 1;
}

.kanban-count {
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.kanban-card:hover {
  border-color: var(--accent-green);
  box-shadow: var(--shadow-sm);
}

.kanban-card-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-card-type {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.kanban-card-due {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kanban-card-due.overdue { color: var(--accent-red); }
.kanban-card-due.due-soon { color: var(--accent-amber); }

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.kanban-card-footer .mini-avatar {
  width: 20px;
  height: 20px;
  font-size: 0.6rem;
}

.kanban-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@media (max-width: 1200px) {
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .task-card-grid {
    grid-template-columns: 1fr;
  }
}

.task-table-container {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}

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

.task-table th,
.task-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.task-table th {
  background: var(--bg-card-alt);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.task-table th.sortable { cursor: pointer; }
.task-table th.sortable:hover { color: var(--text-primary); }
.task-table th.sorted { color: var(--accent-green); }
.task-table th .sort-icon { margin-left: 4px; }

.task-table tr { cursor: pointer; transition: background 0.15s; }
.task-table tbody tr:hover { background: var(--bg-card-alt); }
.task-table tbody tr:last-child td { border-bottom: none; }

.table-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-checkbox:hover { border-color: var(--accent-green); }

.table-checkbox.checked {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.table-checkbox.checked::after {
  content: '✓';
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.signal-cell { display: flex; align-items: center; }

.task-summary-cell .title { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.task-summary-cell .subtitle { font-size: 0.8rem; color: var(--text-muted); }

.assignee-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: white;
}

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.pending { background: var(--accent-blue-light); color: var(--accent-blue); }
.status-badge.in-progress { background: var(--accent-amber-light); color: var(--accent-amber); }
.status-badge.escalated { background: var(--accent-red-light); color: var(--accent-red); }
.status-badge.resolved { background: var(--accent-green-light); color: var(--accent-green); }

.due-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
}

.due-badge.overdue { color: var(--accent-red); }
.due-badge.due-soon { color: var(--accent-amber); }
.due-badge.ok { color: var(--text-muted); }

.action-menu-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s;
}

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

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-alt);
}

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

.pagination-controls { display: flex; gap: 6px; }

.page-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) { background: var(--bg-secondary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.page-btn.active {
  background: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
}

.quick-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.quick-action-bar .selected-count {
  font-weight: 600;
  font-size: 0.9rem;
}

.quick-action-bar .action-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

/* ============================================ */
/* ADMIN VIEW STYLES */
/* ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-green); }

.admin-stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  width: fit-content;
}

.admin-tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-tab-btn:hover:not(:disabled) {
  background: var(--surface-light);
  color: var(--text-primary);
}

.admin-tab-btn.active {
  background: var(--accent);
  color: white;
}

.admin-tab-content {
  animation: fadeIn 0.2s ease-out;
}

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

.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.stat-mini {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-mini-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-mini-icon.blue { background: var(--accent-blue-light); }
.stat-mini-icon.green { background: var(--accent-green-light); }
.stat-mini-icon.purple { background: var(--accent-purple-light); }
.stat-mini-icon.amber { background: var(--accent-amber-light); }
.stat-mini-icon.red { background: rgba(239, 68, 68, 0.15); }
.stat-mini-icon.emerald { background: rgba(16, 185, 129, 0.15); }

.stat-mini-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.stat-mini-label { font-size: 0.8rem; color: var(--text-muted); }

/* Week Calendar Grid for Who's Out */
.week-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.week-day-column {
  background: var(--surface-light);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-height: 120px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.week-day-column.today {
  background: var(--accent-blue-light);
  border-color: var(--accent-blue);
}

.week-day-header {
  text-align: center;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.week-day-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.week-day-date {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.week-day-column.today .week-day-name,
.week-day-column.today .week-day-date {
  color: var(--accent-blue);
}

.week-day-absences {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.week-absence-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
}

.week-absence-chip.pto {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.week-absence-chip.calloff {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.week-absence-chip.birthday {
  background: #fce7f3;
  color: #db2777;
}

.week-absence-chip .absence-initials {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.week-absence-chip.pto .absence-initials {
  background: var(--accent-green);
}

.week-absence-chip.calloff .absence-initials {
  background: var(--accent-red);
}

/* Who's Out List Items */
.whosout-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-light);
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
}

.whosout-item:last-child {
  margin-bottom: 0;
}

.whosout-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

.whosout-info {
  flex: 1;
}

.whosout-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

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

.whosout-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.whosout-type-badge {
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.whosout-type-badge.pto {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.whosout-type-badge.calloff {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.whosout-type-badge.birthday {
  background: #fce7f3;
  color: #db2777;
}

.whosout-company-badge {
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-size: 0.7rem;
  font-weight: 600;
}

.whosout-company-badge.rlc {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.whosout-company-badge.gx {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-purple);
}

.whosout-company-badge.both {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.whosout-days-until {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  min-width: 60px;
}

.whosout-empty {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

.whosout-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* Schedule View Styles */
.schedule-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.view-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
}

.view-toggle-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--accent-blue);
  color: white;
}

.schedule-nav {
  display: flex;
  gap: 8px;
}

.schedule-period-header {
  margin-bottom: 16px;
}

.schedule-period-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Week View */
.schedule-week-view {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.schedule-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: 500px;
}

.schedule-day {
  border-right: 1px solid var(--border-subtle);
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.schedule-day:last-child {
  border-right: none;
}

.schedule-day-header {
  padding: 12px;
  text-align: center;
  background: var(--surface-light);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
}

.schedule-day.today .schedule-day-header {
  background: var(--accent-blue-light);
}

.schedule-day-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.schedule-day.today .schedule-day-name {
  color: var(--accent-blue);
}

.schedule-day-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.schedule-day.today .schedule-day-num {
  color: var(--accent-blue);
}

.schedule-day-content {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  cursor: pointer;
}

.schedule-day-content:hover {
  background: var(--surface-light);
}

.schedule-absence-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  cursor: default;
}

.schedule-absence-item.pto {
  background: rgba(16, 185, 129, 0.15);
  border-left: 3px solid var(--accent-green);
}

.schedule-absence-item.calloff {
  background: rgba(239, 68, 68, 0.15);
  border-left: 3px solid var(--accent-red);
}

.schedule-absence-item.birthday {
  background: #fdf2f8;
  border-left: 3px solid #ec4899;
}

.schedule-absence-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.schedule-absence-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-absence-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.schedule-absence-badge.pto {
  background: var(--accent-green);
  color: white;
}

.schedule-absence-badge.calloff {
  background: var(--accent-red);
  color: white;
}

.schedule-absence-badge.birthday {
  background: #ec4899;
  color: white;
}

/* Delete Button for Absences - Hidden by default, visible on hover */
.absence-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: rgba(100, 100, 100, 0.15);
  color: var(--text-muted);
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
  transition: all 0.15s ease;
  opacity: 0;
  visibility: hidden;
}

/* Show delete button on parent hover */
.week-absence-chip:hover .absence-delete-btn,
.schedule-absence-item:hover .absence-delete-btn,
.absence-list-item:hover .absence-delete-btn,
.popover-absence-item:hover .absence-delete-btn {
  opacity: 0.6;
  visibility: visible;
}

.absence-delete-btn:hover {
  background: var(--accent-red);
  color: white;
  opacity: 1 !important;
  visibility: visible;
}

/* Month View */
.schedule-month-view {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.schedule-month-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-light);
  border-bottom: 1px solid var(--border-subtle);
}

.month-day-header {
  padding: 12px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.schedule-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.month-day-cell {
  min-height: 100px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.month-day-cell:nth-child(7n) {
  border-right: none;
}

.month-day-cell:hover {
  background: var(--surface-light);
}

.month-day-cell.today {
  background: var(--accent-blue-light);
}

.month-day-cell.other-month {
  opacity: 0.4;
}

.month-day-cell.other-month:hover {
  opacity: 0.6;
}

.month-day-num {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.month-day-cell.today .month-day-num {
  color: var(--accent-blue);
  font-weight: 700;
}

.month-day-absences {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.month-absence-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-absence-chip.pto {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}

.month-absence-chip.calloff {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.month-absence-chip.birthday {
  background: #fce7f3;
  color: #db2777;
}

.month-absence-more {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 2px 4px;
}

/* Day Detail Popover */
.schedule-day-popover {
  position: fixed;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 320px;
  z-index: 1000;
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}

.popover-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.popover-close:hover {
  color: var(--text-primary);
}

.popover-body {
  padding: 12px 16px;
  max-height: 250px;
  overflow-y: auto;
}

.popover-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

.popover-absence-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}

.popover-absence-item:last-child {
  margin-bottom: 0;
}

.popover-absence-item.pto {
  background: rgba(16, 185, 129, 0.1);
}

.popover-absence-item.calloff {
  background: rgba(239, 68, 68, 0.1);
}

.popover-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
  .schedule-week-grid {
    min-height: 400px;
  }

  .schedule-day {
    min-height: 400px;
  }

  .schedule-day-num {
    font-size: 1.2rem;
  }

  .schedule-absence-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .schedule-absence-avatar {
    display: none;
  }
}

@media (max-width: 768px) {
  .schedule-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .view-toggle {
    justify-content: center;
  }

  .schedule-nav {
    justify-content: center;
  }

  .company-tabs {
    justify-content: center;
  }

  .month-day-cell {
    min-height: 80px;
    padding: 4px;
  }

  .month-absence-chip {
    font-size: 0.6rem;
    padding: 2px 4px;
  }
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* People Table (List View) */
.people-table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.people-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.people-table th,
.people-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.people-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
}

.people-table tbody tr:hover {
  background: var(--bg-secondary);
}

.people-table .employee-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.people-table .mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.people-table .company-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

.people-table .company-badge.rlc {
  background: rgba(245, 166, 35, 0.15);
  color: #b45309;
}

.people-table .company-badge.gx {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-emerald);
}

.people-table .status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 600;
}

.people-table .status-pill.active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green-dark);
}

.people-table .status-pill.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.people-table .pin-cell {
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 8px;
}

.people-table .pin-value {
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.people-table .pin-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.people-table .pin-toggle:hover {
  opacity: 1;
}

.people-table .action-btns {
  display: flex;
  gap: 8px;
}

.people-table .action-btn {
  background: var(--bg-secondary);
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.people-table .action-btn:hover {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.people-table .action-btn.edit:hover {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
}

.people-table .action-btn.delete:hover {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

/* View Toggle Buttons */
.view-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.view-toggle-btn {
  background: none;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  transition: all 0.2s;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--bg-card);
  color: var(--accent-green);
  box-shadow: var(--shadow-sm);
}

.person-card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.person-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border-subtle);
}

.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}

.person-info { flex: 1; }
.person-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 2px; }
.person-role { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; }

.person-team {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.person-status {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.person-status.active { background: var(--accent-green-light); color: var(--accent-green); }
.person-status.inactive { background: var(--accent-red-light); color: var(--accent-red); }

.person-details { padding: 16px 20px; }

.person-details .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.person-details .detail-row:last-child { border-bottom: none; }
.person-details .detail-label { color: var(--text-muted); }
.person-details .detail-value { font-weight: 500; }

.company-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.company-badge.rlc { background: var(--accent-green-light); color: var(--accent-green); }
.company-badge.gx { background: var(--accent-cyan-light); color: var(--accent-cyan); }

.person-actions {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-alt);
}

.person-action-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.person-action-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.person-action-btn.edit:hover { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }
.person-action-btn.delete:hover { background: var(--accent-red-light); color: var(--accent-red); }

/* Add Person Modal */
.modal-overlay-bg {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  display: none;
}

.modal-overlay-bg.active { display: block; }

.add-person-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 100%;
  max-width: 520px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: none;
  opacity: 0;
  transition: all 0.2s ease;
}

.add-person-modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header-bar h3 { font-size: 1.2rem; font-weight: 700; }

.modal-close-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  touch-action: manipulation;
  -webkit-appearance: none;
  z-index: 10;
}

.modal-close-btn:hover,
.modal-close-btn:active { background: var(--accent-red-light); color: var(--accent-red); }

.modal-body-content { padding: 24px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s;
}

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

.modal-footer-bar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-alt);
  border-radius: 0 0 20px 20px;
}

/* Absence Detail Modal */
.absence-detail-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: none;
  opacity: 0;
  transition: all 0.2s ease;
}

.absence-detail-modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.absence-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.absence-detail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.absence-detail-title {
  flex: 1;
}

.absence-detail-title h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.absence-detail-type {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-lg);
  font-size: 0.8rem;
  font-weight: 600;
}

.absence-detail-type.pto {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.absence-detail-type.calloff {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

.absence-detail-body {
  padding: 24px;
}

.absence-detail-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
}

.absence-detail-row:last-child {
  margin-bottom: 0;
}

.absence-detail-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-right: 12px;
  flex-shrink: 0;
}

.absence-detail-info label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.absence-detail-info span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.absence-detail-photo {
  margin-top: 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
}

.absence-detail-photo img {
  width: 100%;
  height: auto;
  display: block;
}

.absence-detail-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-alt);
  border-radius: 0 0 20px 20px;
}

.absence-detail-delete-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--accent-red-light);
  color: var(--accent-red);
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.absence-detail-delete-btn:hover {
  background: var(--accent-red);
  color: white;
}

/* ============================================ */
/* RESPONSIVE */
/* ============================================ */

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-size: 1.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
  background: var(--bg-secondary);
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(60px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 150;
  padding-left: 64px;
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.mobile-header-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.mobile-header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-header-user .user-avatar {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s;
}

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

/* Touch-friendly delete button */
.absence-delete-btn.touch-visible {
  opacity: 0.6 !important;
  visibility: visible !important;
}

/* Tablet breakpoint */
@media (max-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .console-stats { grid-template-columns: repeat(3, 1fr); }
  .console-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .sidebar { width: 240px; }
  .main-content { margin-left: 240px; }
  .task-panel { width: 360px; }

  .schedule-week-grid { min-height: 400px; }
  .schedule-day { min-width: 100px; }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
  /* Show mobile UI elements */
  .mobile-menu-btn { display: flex; }
  .mobile-header { display: flex; }
  .sidebar-overlay { display: block; pointer-events: none; }
  .sidebar-overlay.active { pointer-events: auto; }

  /* Sidebar mobile behavior */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
    z-index: 200;
    /* Stop sidebar above the bottom nav */
    height: calc(100% - 64px);
    height: calc(100dvh - 64px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 64px - env(safe-area-inset-bottom, 0px));
  }

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

  /* Tighter sidebar spacing on mobile */
  .sidebar-nav {
    padding: 8px 10px;
  }
  .nav-section {
    margin-bottom: 12px;
  }
  .nav-item {
    padding: 8px 10px;
    gap: 8px;
  }
  .nav-section-title {
    padding: 6px 10px;
  }
  .sidebar-footer {
    padding: 10px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .theme-switch {
    padding: 7px 10px;
    margin-bottom: 6px;
  }
  .logout-btn {
    padding: 8px;
  }

  /* Main content adjustments */
  .main-content {
    margin-left: 0;
    padding-top: calc(70px + env(safe-area-inset-top, 0px));
    max-width: 100vw;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  .top-bar {
    position: relative;
    top: 0;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .top-bar-left {
    display: none; /* Hide breadcrumb on mobile */
  }

  .top-bar-center {
    order: 1;
    width: 100%;
    justify-content: center;
  }

  .top-bar-right {
    display: none; /* User info in mobile header instead */
  }

  /* Stats grid - 2 columns on tablet, 1 on phone */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* Cards */
  .card { border-radius: var(--radius-lg); }
  .card-header { padding: 12px 16px; }

  /* Task panel full width overlay */
  .task-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 300;
    border-radius: 0;
  }

  /* Schedule controls stack */
  .schedule-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .schedule-nav-buttons { width: 100%; justify-content: center; }
  .schedule-view-toggle { width: 100%; justify-content: center; }

  /* Week grid horizontal scroll */
  .schedule-week-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .schedule-day {
    min-width: 140px;
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* Who's Out week calendar scroll */
  .week-calendar-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .week-day-column {
    min-width: 100px;
    flex-shrink: 0;
  }

  /* Month view adjustments */
  .schedule-month-day {
    min-height: 80px;
    padding: 4px;
  }

  .month-absence-chip {
    font-size: 0.65rem;
    padding: 2px 4px;
  }

  /* Forms full width */
  .form-row { grid-template-columns: 1fr; }

  .filter-bar {
    flex-direction: column;
    gap: 12px;
  }

  .filter-bar .search-box { width: 100%; }
  .filter-bar .filter-select { width: 100%; }

  /* Modal adjustments */
  .add-person-modal,
  .absence-detail-modal {
    width: 95%;
    max-width: none;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-body-content { padding: 16px; }
  .modal-footer-bar { padding: 12px 16px; }

  /* Larger touch targets */
  .btn { min-height: 44px; padding: 10px 16px; }
  .filter-select { min-height: 44px; }
  .form-input { min-height: 44px; padding: 10px 12px; }

  .nav-link {
    padding: 14px 16px;
    min-height: 48px;
  }

  /* Table to cards on mobile */
  .task-table { display: none !important; }
  .task-table-container { overflow: hidden; border: none; box-shadow: none; background: transparent; }
  #taskTableView { display: block; overflow: visible; } /* Keep container, hide table */
  #taskCardView { display: block !important; }
  #taskCardView.hidden { display: block !important; } /* Override hidden class on mobile */
  .task-card-grid { display: grid !important; grid-template-columns: 1fr; gap: 12px; }
  #taskKanbanView { display: none !important; } /* Hide kanban on mobile */

  /* ========================================== */
  /* Inventory & PTO Tables Mobile Scroll Fix */
  /* ========================================== */
  /* Single horizontal scroll with touch-friendly scrolling */
  #inventoryView .task-table-container,
  .people-table-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    border-radius: var(--radius-lg);
    padding-bottom: 4px;
  }

  #inventoryView .task-table {
    display: table !important; /* Override task table hide for inventory */
    min-width: 600px; /* Ensure table scrolls rather than squishes */
  }

  .people-table {
    min-width: 500px;
  }

  /* PTO Balance table responsive wrapper */
  #ptoBalanceTable {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  #ptoBalanceTable th,
  #ptoBalanceTable td {
    white-space: nowrap;
    padding: 8px 10px !important;
    font-size: 11px !important;
  }

  /* Scroll indicator shadow for tables */
  #inventoryView .task-table-container::after,
  .people-table-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(0,0,0,0.05), transparent);
    pointer-events: none;
    border-radius: 0 12px 12px 0;
  }

  /* Popover adjustments */
  .schedule-popover {
    left: 16px !important;
    right: 16px !important;
    max-width: none;
  }

  /* Toast container on mobile */
  #toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  /* Console stats */
  .console-stats { grid-template-columns: repeat(2, 1fr); }

  /* ========================================== */
  /* Command Center / Leadership Page Mobile */
  /* ========================================== */
  .console-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .console-section {
    padding: 16px;
  }

  .console-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  /* ========================================== */
  /* Who's Out Page Mobile */
  /* ========================================== */
  .whosout-stats-row {
    flex-direction: column !important;
    gap: 12px;
  }

  .whosout-main-grid {
    grid-template-columns: 1fr !important;
  }

  .whosout-item {
    padding: 12px;
  }

  .whosout-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .whosout-name {
    font-size: 0.95rem;
  }

  .whosout-detail {
    font-size: 0.8rem;
  }

  .whosout-badges {
    flex-wrap: wrap;
    gap: 6px;
  }

  .whosout-type-badge,
  .whosout-company-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .whosout-days-until {
    font-size: 0.75rem;
  }

  /* ========================================== */
  /* Schedule Page Mobile */
  /* ========================================== */
  .schedule-week-grid {
    display: block !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .schedule-week-grid > div {
    min-width: 280px;
  }

  .schedule-day-header {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .schedule-day-content {
    padding: 8px;
    min-height: 80px;
  }

  .schedule-absence-item {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .schedule-absence-name {
    font-size: 0.9rem;
  }

  .schedule-absence-type {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  /* ========================================== */
  /* Admin Page Mobile */
  /* ========================================== */
  .admin-section {
    padding: 16px;
  }

  .admin-section h3 {
    font-size: 1rem;
  }

  .admin-user-grid {
    grid-template-columns: 1fr !important;
  }

  .admin-user-card {
    padding: 12px;
  }

  .admin-actions {
    flex-direction: column;
    gap: 8px;
  }

  .admin-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Admin form on mobile */
  .admin-form-row {
    flex-direction: column;
    gap: 12px;
  }

  .admin-form-row .form-group {
    width: 100%;
  }

  /* User list table to cards */
  .user-list-table {
    display: none;
  }

  .user-list-mobile {
    display: block !important;
  }

  /* ========================================== */
  /* Common Page Header Mobile */
  /* ========================================== */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header h2 {
    font-size: 1.25rem;
  }

  .page-header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-header-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* ========================================== */
  /* Cards & Sections Mobile */
  /* ========================================== */
  .section-grid {
    grid-template-columns: 1fr !important;
  }

  .card-grid {
    grid-template-columns: 1fr !important;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  .metric-card {
    padding: 12px;
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .metric-label {
    font-size: 0.75rem;
  }

  /* Photo upload section */
  #timeOffPhotoSection {
    padding: 16px;
  }

  #timeOffPhotoPreview img {
    max-width: 100%;
  }

  /* Bottom Navigation Bar */
  .bottom-nav {
    display: flex !important;
  }

  /* Adjust main content for bottom nav */
  .main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  /* Position toast above bottom nav */
  #toast-container {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

/* Bottom Navigation Bar (hidden by default, shown on mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  z-index: 1000;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s;
  min-width: 64px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.bottom-nav-item.active {
  color: var(--accent-green);
}

.bottom-nav-item.active .bottom-nav-icon {
  background: var(--accent-green-light);
}

.bottom-nav-icon {
  font-size: 1.25rem;
  margin-bottom: 2px;
  width: 40px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  transition: background 0.2s;
}

.bottom-nav-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Small mobile breakpoint */
@media (max-width: 480px) {
  .mobile-header { padding-left: 56px; }

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

  .week-day-column { min-width: 85px; }
  .schedule-day { min-width: 120px; }

  .top-bar-center .company-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .card-header h3 { font-size: 1rem; }

  /* Login card */
  .login-card { padding: 24px 20px; }
  .pin-input { width: 45px; height: 55px; font-size: 1.5rem; }

  /* Absence modal */
  .absence-detail-header { padding: 16px; gap: 12px; }
  .absence-detail-avatar { width: 44px; height: 44px; font-size: 1rem; }
  .absence-detail-title h3 { font-size: 1.1rem; }
  .absence-detail-body { padding: 16px; }
  .absence-detail-row { margin-bottom: 12px; }
  .absence-detail-icon { width: 32px; height: 32px; font-size: 0.9rem; }

  /* Command Center small mobile */
  .console-section h3 { font-size: 0.9rem; }

  /* Who's Out small mobile */
  .whosout-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .whosout-badges {
    width: 100%;
    justify-content: flex-start;
  }

  /* Schedule small mobile */
  .schedule-week-grid > div {
    min-width: 100%;
  }

  /* Admin small mobile */
  .admin-user-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Metrics grid single column */
  .metrics-grid {
    grid-template-columns: 1fr !important;
  }

  .metric-value {
    font-size: 1.25rem;
  }

  /* Page headers stacked */
  .page-header-actions .btn {
    width: 100%;
    flex: none;
  }

  /* Feedback button - back to left on mobile when sidebar is hidden */
  .feedback-btn {
    left: 24px;
  }
}

/* Tablet breakpoint - adjust feedback button for narrower sidebar */
@media (max-width: 1024px) and (min-width: 769px) {
  .feedback-btn {
    left: 264px; /* 240px sidebar + 24px margin */
  }
}

/* Touch feedback for interactive elements */
.pto-row:hover { background: var(--bg-primary); }
.pto-row:active { background: var(--bg-secondary); }

@media (hover: none) and (pointer: coarse) {
  .nav-link:active,
  .btn:active,
  .company-btn:active,
  .schedule-day:active,
  .week-absence-chip:active,
  .schedule-absence-item:active {
    opacity: 0.8;
    transform: scale(0.98);
  }

  /* Show delete button on touch devices after long press */
  .week-absence-chip.touch-active .absence-delete-btn,
  .schedule-absence-item.touch-active .absence-delete-btn {
    opacity: 0.6;
    visibility: visible;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Import Progress Banner */
.import-progress-banner {
  background: linear-gradient(135deg, var(--blue-500) 0%, var(--blue-600) 100%);
  color: white;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.import-progress-content {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.import-progress-icon {
  font-size: 1.5rem;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.import-progress-text {
  flex: 1;
}
.import-progress-text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 2px;
}
.import-progress-text span {
  font-size: 0.85rem;
  opacity: 0.9;
}
.import-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  overflow: hidden;
}
.import-progress-fill {
  height: 100%;
  background: var(--bg-card);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.import-progress-banner.success {
  background: linear-gradient(135deg, #10b981 0%, var(--accent-emerald) 100%);
}
.import-progress-banner.error {
  background: linear-gradient(135deg, var(--red-500) 0%, var(--accent-red) 100%);
}

/* Toast container (dynamically created by showToast in ui.js) */
/* Styles are inline — no CSS needed */

/* Feedback Button - positioned right of sidebar */
.feedback-btn {
  position: fixed;
  bottom: 24px;
  left: 304px; /* 280px sidebar + 24px margin */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
  z-index: 100;
}

.feedback-btn:hover {
  background: var(--accent-green-light);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.feedback-btn svg {
  width: 18px;
  height: 18px;
}

/* Modal Overlay (for reassign, etc.) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.active {
  display: flex;
}
.modal-overlay .modal {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  max-width: 400px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.modal-overlay .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-overlay .modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-overlay .modal-body {
  padding: 20px;
}
.modal-overlay .modal-body .form-group {
  margin-bottom: 16px;
}
.modal-overlay .modal-body .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.modal-overlay .modal-body .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-primary);
}
.modal-overlay .modal-body .form-group select:focus {
  outline: none;
  border-color: var(--accent-green);
}
.modal-overlay .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

/* Feedback Modal */
.feedback-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.feedback-modal.visible {
  opacity: 1;
  visibility: visible;
}

.feedback-modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s;
}

.feedback-modal.visible .feedback-modal-content {
  transform: scale(1) translateY(0);
}

.feedback-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feedback-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.feedback-close-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.feedback-close-btn:hover {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

.feedback-modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.feedback-type-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.feedback-type-option {
  padding: 12px;
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-type-option:hover {
  background: var(--bg-card-alt);
}

.feedback-type-option.selected {
  border-color: var(--accent-green);
  background: var(--accent-green-light);
}

.feedback-type-option .icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.feedback-type-option .label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.feedback-form-group {
  margin-bottom: 16px;
}

.feedback-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.feedback-input, .feedback-textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.feedback-input:focus, .feedback-textarea:focus {
  outline: none;
  border-color: var(--accent-green);
}

.feedback-textarea {
  min-height: 120px;
  resize: vertical;
}

.feedback-submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-green);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-submit-btn:hover {
  opacity: 0.9;
}

.feedback-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Notification Bell */
.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.notification-bell:hover {
  background: var(--bg-card-alt);
  color: var(--accent-green);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--accent-red);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.notification-badge.hidden {
  display: none;
}

.notification-dropdown {
  position: fixed;
  top: 60px;
  right: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
}

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

.notification-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mark-all-read {
  background: none;
  border: none;
  color: var(--accent-green);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.mark-all-read:hover {
  text-decoration: underline;
}

.notification-list {
  max-height: calc(70vh - 60px);
  overflow-y: auto;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.2s;
}

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

.notification-item.unread {
  background: var(--accent-blue-light);
}

.notification-item.unread:hover {
  background: rgba(37, 99, 235, 0.15);
}

.notification-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.notification-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.notification-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notification-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
}

.notification-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* Notification Dropdown - icon layout */
.notification-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.notification-item-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  padding-top: 1px;
}

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

.notification-footer {
  padding: 12px 16px;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.notification-view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-green);
  cursor: pointer;
  text-decoration: none;
}

.notification-view-all:hover {
  text-decoration: underline;
}

/* ==================== FULL NOTIFICATIONS VIEW ==================== */

.notif-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.notif-filter-tab {
  padding: 6px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.notif-filter-tab:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.notif-filter-tab.active {
  background: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
}

.notif-date-group {
  border-bottom: 1px solid var(--border-subtle);
}

.notif-date-group:last-child {
  border-bottom: none;
}

.notif-date-label {
  padding: 10px 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.notif-full-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
}

.notif-full-item:last-child {
  border-bottom: none;
}

.notif-full-item:hover {
  background: var(--bg-secondary);
}

.notif-full-item.unread {
  background: rgba(37, 99, 235, 0.06);
}

.notif-full-item.unread:hover {
  background: rgba(37, 99, 235, 0.1);
}

.notif-full-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  padding-top: 2px;
}

.notif-full-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.notif-full-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.notif-full-title {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-full-item.unread .notif-full-title {
  font-weight: 700;
}

.notif-full-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.notif-full-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 6px;
}

.notif-full-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-type-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.notif-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}

.notif-full-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.notif-full-item:hover .notif-full-actions {
  opacity: 1;
}

.notif-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.notif-action-btn:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.notif-delete-btn:hover {
  border-color: var(--red-500);
  color: var(--red-500);
}

/* Mobile responsive for notifications */
@media (max-width: 768px) {
  .notif-full-header {
    flex-direction: column;
    gap: 2px;
  }

  .notif-full-actions {
    opacity: 1;
  }

  .notification-dropdown {
    left: 8px;
    right: 8px;
    width: auto;
  }
}

/* Rain Day Button */
.rain-day-btn {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}
.rain-day-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}
@media (max-width: 640px) {
  .rain-day-btn-text { display: none; }
  #rdcWeatherRow { grid-template-columns: 1fr !important; }
}

/* Launch Console */
.launch-console-section { margin-bottom: 24px; }
.launch-trigger {
  width: 100%; display: flex; align-items: center; gap: 16px; padding: 18px 24px;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border: none; border-radius: var(--radius-lg); cursor: pointer; text-align: left;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 4px 15px rgba(220,38,38,0.25);
}
.launch-trigger:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(220,38,38,0.35); }
.launch-trigger.open { border-radius: 12px 12px 0 0; }
.launch-trigger-icon { font-size: 28px; animation: iconPulse 2s ease infinite; }
@keyframes iconPulse { 0%,100%{transform:scale(1);opacity:1;} 50%{transform:scale(1.1);opacity:0.85;} }
.launch-trigger-text { flex: 1; }
.launch-trigger-title { display: block; font-size: 16px; font-weight: 700; color: white; text-transform: uppercase; letter-spacing: 1.5px; }
.launch-trigger-subtitle { display: block; font-size: 12px; color: rgba(255,255,255,0.75); margin-top: 2px; }
.launch-trigger-chevron { font-size: 18px; color: white; transition: transform 0.4s cubic-bezier(0.4,0,0.2,1); }
.launch-trigger.open .launch-trigger-chevron { transform: rotate(180deg); }
.launch-console-panel { max-height: 0; overflow: hidden; transition: max-height 0.5s cubic-bezier(0.4,0,0.2,1); }
.launch-console-panel.open { max-height: 600px; }
.launch-console-wrapper {
  background: linear-gradient(180deg, #1a1f2e 0%, #0f1219 100%);
  border-radius: 0 0 12px 12px; padding: 28px; position: relative; overflow: hidden;
}
.launch-console-wrapper::before {
  content:''; position:absolute; top:0; left:0; right:0; bottom:0;
  background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 25px 25px; pointer-events: none;
}
.console-status-panel {
  background: #000; border: 2px solid #1a3a2a; border-radius: var(--radius-md);
  padding: 14px 20px; margin-bottom: 24px; position: relative; overflow: hidden;
}
.console-status-panel::before {
  content:''; position:absolute; top:0; left:-100%; width:100%; height:100%;
  background: linear-gradient(90deg, transparent, rgba(45,90,61,0.1), transparent);
  animation: scanline 4s linear infinite;
}
@keyframes scanline { 0%{left:-100%;} 100%{left:100%;} }
.console-status-text {
  font-family: 'Courier New', monospace; color: #4ade80; font-size: 13px;
  text-align: center; text-transform: uppercase; letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(74,222,128,0.5); position: relative;
}
.console-status-text.warning { color: #f87171; text-shadow: 0 0 8px rgba(248,113,113,0.6); animation: statusBlink 0.5s ease infinite; }
.console-status-text.armed { color: #fbbf24; text-shadow: 0 0 12px rgba(251,191,36,0.7); animation: statusBlink 0.8s ease infinite; }
@keyframes statusBlink { 0%,100%{opacity:1;} 50%{opacity:0.6;} }
.console-layout { display: grid; grid-template-columns: 1fr 200px 1fr; gap: 28px; align-items: center; position: relative; z-index: 1; }
@media (max-width: 800px) { .console-layout { grid-template-columns: 1fr; gap: 24px; } .console-key-section { flex-direction: row !important; justify-content: center; } }
.console-key-section { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.console-key-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); }
.console-key-slot {
  width: 90px; height: 90px; background: linear-gradient(145deg, #1e2433, #0c0f15);
  border-radius: 50%; border: 3px solid #2d3748; display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.5);
}
.console-key-slot:hover { border-color: #fbbf24; box-shadow: inset 0 4px 12px rgba(0,0,0,0.5), 0 0 20px rgba(251,191,36,0.2); }
.console-key-visual { width: 6px; height: 28px; background: #374151; border-radius: 2px; position: relative; transition: all 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.console-key-visual::before {
  content:''; position:absolute; top:-14px; left:50%; transform:translateX(-50%);
  width:18px; height:18px; border:3px solid #374151; border-radius:50%; transition: all 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.console-key-slot.inserted .console-key-visual { width:18px; background:linear-gradient(180deg,#fbbf24,#f59e0b); box-shadow:0 0 15px rgba(251,191,36,0.5); }
.console-key-slot.inserted .console-key-visual::before { border-color:#fbbf24; background:linear-gradient(135deg,#fbbf24,#f59e0b); box-shadow:0 0 10px rgba(251,191,36,0.4); }
.console-key-slot.turned .console-key-visual { transform: rotate(90deg); }
.console-key-lights { display: flex; gap: 10px; }
.console-key-light { width:10px; height:10px; border-radius:50%; background:#1f2937; border:2px solid #374151; transition:all 0.3s ease; }
.console-key-light.inserted { background:#fbbf24; border-color:#fbbf24; box-shadow:0 0 8px #fbbf24; }
.console-key-light.turned { background:#4ade80; border-color:#4ade80; box-shadow:0 0 8px #4ade80; }
.console-button-section { display: flex; justify-content: center; }
.console-glass-assembly { position: relative; width: 160px; height: 180px; perspective: 800px; }
.console-glass-lid {
  position:absolute; top:0; left:0; right:0; height:90px;
  background:linear-gradient(180deg,rgba(255,255,255,0.15),rgba(255,255,255,0.05));
  border:2px solid rgba(255,255,255,0.2); border-bottom:none; border-radius:16px 16px 0 0;
  transform-origin:top center; transition:all 0.8s cubic-bezier(0.4,0,0.2,1);
  cursor:pointer; z-index:5; backdrop-filter:blur(4px);
}
.console-glass-lid::before { content:'🔒'; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); font-size:24px; opacity:0.5; transition:all 0.3s ease; }
.console-glass-lid::after { content:'LIFT TO ARM'; position:absolute; bottom:10px; left:50%; transform:translateX(-50%); font-size:9px; font-weight:700; color:rgba(255,255,255,0.4); letter-spacing:1.5px; white-space:nowrap; }
.console-glass-lid:hover { border-color:rgba(255,255,255,0.35); }
.console-glass-lid.unlocked::before { content:'🔓'; }
.console-glass-lid.unlocked:hover { border-color:rgba(251,191,36,0.5); }
.console-glass-lid.open { transform:rotateX(-120deg); opacity:0; pointer-events:none; }
.console-glass-lid.locked { cursor:not-allowed; }
.console-button-base {
  position:absolute; bottom:0; left:0; right:0; height:105px;
  background:linear-gradient(180deg,#252d3d,#1a202c); border:2px solid #374151;
  border-top:none; border-radius:0 0 16px 16px; display:flex; align-items:center;
  justify-content:center; box-shadow:inset 0 -8px 20px rgba(0,0,0,0.3);
}
.console-button-base::after {
  content:''; position:absolute; bottom:0; left:0; right:0; height:14px;
  background:repeating-linear-gradient(-55deg,#fbbf24,#fbbf24 10px,#1a202c 10px,#1a202c 20px);
  border-radius:0 0 14px 14px;
}
.console-rain-button { width:90px; height:90px; border-radius:50%; border:none; cursor:not-allowed; position:relative; margin-bottom:8px; transition:all 0.2s ease; }
.console-button-rim { position:absolute; top:0; left:0; width:100%; height:100%; border-radius:50%; background:linear-gradient(145deg,#374151,#1f2937); box-shadow:0 6px 20px rgba(0,0,0,0.4); }
.console-button-top {
  position:absolute; top:7px; left:7px; width:calc(100% - 14px); height:calc(100% - 14px);
  border-radius:50%; background:linear-gradient(145deg,#4b5563,#374151); display:flex;
  flex-direction:column; align-items:center; justify-content:center; transition:all 0.2s ease;
  box-shadow:inset 0 -4px 12px rgba(0,0,0,0.3);
}
.console-rain-button.armed { cursor:pointer; }
.console-rain-button.armed .console-button-top {
  background:linear-gradient(145deg,#ef4444,#b91c1c);
  box-shadow:0 0 35px rgba(239,68,68,0.5),inset 0 -4px 12px rgba(0,0,0,0.2);
  animation:buttonGlow 1.5s ease infinite;
}
@keyframes buttonGlow {
  0%,100%{box-shadow:0 0 35px rgba(239,68,68,0.5),inset 0 -4px 12px rgba(0,0,0,0.2);}
  50%{box-shadow:0 0 55px rgba(239,68,68,0.7),0 0 80px rgba(239,68,68,0.3),inset 0 -4px 12px rgba(0,0,0,0.2);}
}
.console-rain-button.armed:hover .console-button-top { transform:scale(1.05); }
.console-rain-button.armed:active .console-button-top { transform:scale(0.95); }
.console-button-icon { font-size:24px; filter:grayscale(100%) brightness(0.5); transition:all 0.3s ease; }
.console-rain-button.armed .console-button-icon { filter:none; }
.console-button-text { font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:#6b7280; margin-top:2px; }
.console-rain-button.armed .console-button-text { color:white; text-shadow:0 1px 2px rgba(0,0,0,0.5); }
.console-progress { display:flex; justify-content:center; gap:24px; margin-top:24px; position:relative; z-index:1; }
.console-step { display:flex; align-items:center; gap:8px; color:#4b5563; font-size:12px; font-weight:500; transition:all 0.3s ease; }
.console-step.active { color:#fbbf24; }
.console-step.completed { color:#4ade80; }
.console-step-num {
  width:26px; height:26px; border-radius:50%; background:#1f2937; border:2px solid #374151;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:11px; transition:all 0.3s ease;
}
.console-step.active .console-step-num { border-color:#fbbf24; background:rgba(251,191,36,0.15); color:#fbbf24; }
.console-step.completed .console-step-num { border-color:#4ade80; background:#4ade80; color:#000; }

/* Storm Overlay */
.storm-overlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:linear-gradient(180deg,#050510 0%,#0a0a20 30%,#101030 70%,#0a0a15 100%);
  z-index:10000; opacity:0; visibility:hidden; transition:all 0.8s cubic-bezier(0.4,0,0.2,1);
}
.storm-overlay.active { opacity:1; visibility:visible; }
.storm-rain { position:absolute; top:0; left:0; right:0; bottom:0; overflow:hidden; }
.storm-raindrop {
  position:absolute; width:2px;
  background:linear-gradient(180deg,transparent,rgba(150,180,220,0.5),rgba(150,180,220,0.7));
  border-radius:0 0 2px 2px; animation:rainFall linear infinite;
}
@keyframes rainFall { 0%{transform:translateY(-100vh) rotate(10deg);opacity:0;} 5%{opacity:1;} 95%{opacity:1;} 100%{transform:translateY(100vh) rotate(10deg);opacity:0;} }
.storm-clouds { position:absolute; top:0; left:0; right:0; height:50%; overflow:hidden; }
.storm-cloud { position:absolute; background:radial-gradient(ellipse,rgba(30,30,50,0.8) 0%,transparent 70%); border-radius:50%; filter:blur(40px); animation:cloudDrift linear infinite; }
@keyframes cloudDrift { 0%{transform:translateX(-100%);} 100%{transform:translateX(100vw);} }
.storm-lightning { position:absolute; top:0; left:0; right:0; bottom:0; background:white; opacity:0; z-index:5; }
.storm-lightning.flash { animation:lightningFlash 0.2s ease-out; }
@keyframes lightningFlash { 0%{opacity:0;} 5%{opacity:0.9;} 10%{opacity:0.15;} 15%{opacity:0.85;} 20%{opacity:0.1;} 25%{opacity:0.6;} 100%{opacity:0;} }
.storm-content { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); text-align:center; z-index:10; }
.storm-icon { font-size:80px; margin-bottom:20px; animation:stormIconFloat 3s ease infinite; filter:drop-shadow(0 0 30px rgba(251,191,36,0.3)); }
@keyframes stormIconFloat { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-12px);} }
.storm-title { font-size:48px; font-weight:900; color:#fbbf24; text-transform:uppercase; letter-spacing:8px; margin-bottom:12px; text-shadow:0 0 30px rgba(251,191,36,0.6),0 4px 15px rgba(0,0,0,0.5); }
.storm-subtitle { font-size:16px; color:rgba(255,255,255,0.7); letter-spacing:4px; text-transform:uppercase; margin-bottom:8px; }
.storm-date { font-size:24px; color:#4ade80; font-weight:600; margin-bottom:40px; text-shadow:0 0 15px rgba(74,222,128,0.5); }
.storm-buttons { display:flex; gap:16px; justify-content:center; }
@media (max-width: 600px) {
  .storm-title { font-size:28px; letter-spacing:4px; }
  .storm-icon { font-size:60px; }
  .console-progress { flex-direction:column; align-items:center; gap:10px; }
}

/* Rain Day Modal */
.rain-day-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.rain-day-modal {
  background: var(--bg-card); border-radius: 16px; width: 90%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.rain-day-modal-header {
  padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between;
}
.rain-day-modal-header h2 { margin: 0; font-size: 1.25rem; }
.rain-day-modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--text-muted); padding: 4px 8px; border-radius: var(--radius-sm);
}
.rain-day-modal-close:hover { background: var(--bg-hover); }
.rain-day-modal-body { padding: 20px 24px; }
.rain-day-modal-body .form-group { margin-bottom: 16px; }
.rain-day-modal-body .form-label {
  display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; color: var(--text-secondary);
}
.rain-day-modal-body .form-input,
.rain-day-modal-body .form-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.9rem; box-sizing: border-box;
}
.rain-day-modal-body .form-textarea { resize: vertical; min-height: 60px; }
.rain-day-modal-body .form-input:focus,
.rain-day-modal-body .form-textarea:focus { border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.rd-pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.rd-pill {
  padding: 6px 14px; border-radius: var(--radius-xl); border: 2px solid var(--border);
  background: var(--bg-card); cursor: pointer; font-size: 0.85rem; font-weight: 500;
  transition: all 0.15s;
}
.rd-pill:hover { border-color: #93c5fd; background: #eff6ff; }
.rd-pill.selected { border-color: var(--blue-500); background: var(--blue-100); color: var(--blue-600); font-weight: 600; }
.rd-time-range { display: flex; align-items: center; gap: 10px; }
.rd-time-range input { flex: 1; }
.rd-time-range span { color: var(--text-muted); font-size: 0.85rem; }
.rain-day-stats-preview {
  background: #f0f9ff; border-radius: 10px; padding: 12px 16px; margin-top: 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.rain-day-stats-preview .stat-label { font-size: 0.85rem; color: #1e40af; }
.rain-day-stats-preview .stat-value { font-size: 1.5rem; font-weight: 800; color: #1d4ed8; }
.rain-day-modal-footer {
  padding: 16px 24px 20px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.rain-day-modal-footer .rd-info { font-size: 0.8rem; color: var(--text-muted); text-align: center; }
.rain-day-modal-footer .rd-submit {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: white;
  padding: 12px; border: none; border-radius: 10px; font-weight: 700; font-size: 1rem;
  cursor: pointer; transition: all 0.2s;
}
.rain-day-modal-footer .rd-submit:hover { background: linear-gradient(135deg, #2563eb, #1e40af); }
.rain-day-modal-footer .rd-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Rain Day Dashboard Widget */
.rain-day-widget-card {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe; border-radius: var(--radius-lg); padding: 16px;
}
.rain-day-widget-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.rain-day-widget-header h4 { margin: 0; font-size: 0.9rem; color: #1e40af; }
.rain-day-widget-count { font-size: 2rem; font-weight: 800; color: #1d4ed8; }
.rain-day-widget-label { font-size: 0.8rem; color: var(--blue-500); }
.rain-day-widget-last { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* ══════════════════════════════════════════════════════════════ */
/* DRAINAGE RISK MAP VIEW — scoped under #drainageRiskView      */
/* ══════════════════════════════════════════════════════════════ */
#drainageRiskView .drm-page-header { margin-bottom: 20px; }
#drainageRiskView .drm-page-title {
  font-size: 24px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
}
#drainageRiskView .drm-page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

#drainageRiskView .drm-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
#drainageRiskView .drm-stat-card {
  background: var(--card-bg, #fff); border-radius: var(--radius-lg); padding: 20px;
  text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
#drainageRiskView .drm-stat-value { font-size: 28px; font-weight: 700; }
#drainageRiskView .drm-stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
#drainageRiskView .drm-stat-value.safe { color: var(--green-500); }
#drainageRiskView .drm-stat-value.caution { color: #eab308; }
#drainageRiskView .drm-stat-value.avoid { color: var(--red-500); }
#drainageRiskView .drm-stat-value.info { color: var(--accent-green, #2d5a3d); }

#drainageRiskView .drm-content-card {
  background: var(--card-bg, #fff); border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 20px; overflow: hidden;
}
#drainageRiskView .drm-card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; justify-content: space-between;
}
#drainageRiskView .drm-card-header h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
#drainageRiskView .drm-card-header-actions { display: flex; align-items: center; gap: 8px; }
#drainageRiskView .drm-card-body { padding: 16px 20px; }
#drainageRiskView .drm-card-body.no-pad { padding: 0; }

#drainageRiskView .drm-view-toggle {
  display: inline-flex; background: var(--bg-secondary, #f5f7f5);
  border-radius: var(--radius-md); padding: 3px; gap: 2px;
}
#drainageRiskView .drm-view-toggle button {
  padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all 0.2s; font-family: 'Outfit', sans-serif;
}
#drainageRiskView .drm-view-toggle button.active {
  background: var(--card-bg, #fff); color: var(--accent-green, #2d5a3d); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Weather Bar */
#drainageRiskView .weather-bar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
#drainageRiskView .weather-bar.loading { opacity: 0.6; }
#drainageRiskView .weather-bar.error .weather-detail { color: var(--red-500); }
#drainageRiskView .weather-bar.hidden { display: none !important; }
#drainageRiskView .weather-status { display: flex; align-items: center; gap: 8px; }
#drainageRiskView .weather-icon { font-size: 22px; }
#drainageRiskView .weather-temp { font-size: 22px; font-weight: 700; }
#drainageRiskView .weather-detail { font-size: 12px; color: var(--text-muted); }
#drainageRiskView .weather-metrics { display: flex; gap: 16px; }
#drainageRiskView .weather-metric { text-align: center; }
#drainageRiskView .weather-metric .metric-label { display: block; font-size: 10px; color: var(--text-muted); }
#drainageRiskView .weather-metric .metric-value { display: block; font-size: 13px; font-weight: 600; }
#drainageRiskView .precip-summary { display: flex; gap: 16px; margin-left: auto; }
#drainageRiskView .precip-item { text-align: center; }
#drainageRiskView .precip-item span:first-child { display: block; font-size: 10px; color: var(--text-muted); }
#drainageRiskView .precip-item span:last-child { display: block; font-size: 13px; font-weight: 600; }
#drainageRiskView .last-updated { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
#drainageRiskView .btn-refresh {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  padding: 3px 10px; border-radius: 4px; font-family: 'Outfit', sans-serif;
  font-size: 11px; cursor: pointer; transition: all 0.2s;
}
#drainageRiskView .btn-refresh:hover { border-color: var(--accent-green, #2d5a3d); color: var(--accent-green, #2d5a3d); }

/* Controls Row */
#drainageRiskView .controls-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
#drainageRiskView .controls-row.hidden { display: none !important; }
#drainageRiskView .slider-group { display: flex; align-items: center; gap: 10px; }
#drainageRiskView .slider-group label { font-size: 13px; font-weight: 500; white-space: nowrap; }
#drainageRiskView .slider-value {
  font-size: 13px; font-weight: 600; color: var(--accent-green, #2d5a3d);
  background: var(--accent-green-light, #e8f4ea); padding: 2px 8px; border-radius: 4px;
  min-width: 36px; text-align: center;
}
#drainageRiskView input[type="range"] { height: 6px; -webkit-appearance: none; appearance: none; background: var(--border); border-radius: 3px; outline: none; }
#drainageRiskView input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; background: var(--accent-green, #2d5a3d); border-radius: 50%; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
#drainageRiskView input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; background: var(--accent-green, #2d5a3d); border-radius: 50%; cursor: pointer; border: none; }

/* Map Card */
#drainageRiskView .map-card { position: relative; }
#drainageRiskView .map-card .drm-card-body.no-pad { position: relative; }
#drainageRiskView #drm-map { width: 100%; height: calc(100vh - 380px); min-height: 450px; }
#drainageRiskView .leaflet-tile-pane { filter: grayscale(90%) brightness(1.05); }
[data-theme="dark"] #drainageRiskView .leaflet-tile-pane { filter: grayscale(90%) brightness(0.7) invert(1); }
#drainageRiskView .map-info {
  position: absolute; top: 12px; right: 12px; background: var(--card-bg, #fff);
  border-radius: var(--radius-md); padding: 6px 12px; font-size: 11px;
  font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.08); z-index: 400; color: var(--text-primary);
}
#drainageRiskView .drm-loading-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,0.8);
  display: flex; align-items: center; justify-content: center; z-index: 450; transition: opacity 0.3s;
}
[data-theme="dark"] #drainageRiskView .drm-loading-overlay { background: rgba(26,26,26,0.8); }
#drainageRiskView .loading-spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent-green, #2d5a3d); border-radius: 50%; animation: drm-spin 0.8s linear infinite; }
@keyframes drm-spin { to { transform: rotate(360deg); } }

/* Quick Nav chips */
#drainageRiskView .quick-nav-overlay {
  position: absolute; top: 12px; left: 55px; z-index: 400;
  display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 200px);
}
#drainageRiskView .nav-chip {
  padding: 4px 10px; border-radius: 16px; font-size: 11px; font-weight: 500;
  background: var(--card-bg, #fff); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-family: 'Outfit', sans-serif; color: var(--text-primary);
}
#drainageRiskView .nav-chip:hover { border-color: var(--accent-green, #2d5a3d); color: var(--accent-green, #2d5a3d); }
#drainageRiskView .nav-chip.active { background: var(--accent-green, #2d5a3d); color: white; border-color: var(--accent-green, #2d5a3d); }

/* Legend Overlay */
#drainageRiskView .legend-overlay {
  position: absolute; bottom: 28px; left: 12px; z-index: 400;
  background: var(--card-bg, #fff); border-radius: var(--radius-md);
  padding: 10px 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); max-width: 200px;
}
#drainageRiskView .legend-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 6px; }
#drainageRiskView .legend-items { display: flex; flex-direction: column; gap: 3px; }
#drainageRiskView .legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; }
#drainageRiskView .legend-swatch { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
#drainageRiskView .legend-label { flex: 1; font-weight: 500; }
#drainageRiskView .legend-range { color: var(--text-muted); font-size: 10px; }

/* Opacity control */
#drainageRiskView .opacity-control {
  position: absolute; bottom: 28px; right: 12px; z-index: 400;
  background: var(--card-bg, #fff); border-radius: var(--radius-md);
  padding: 8px 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex; align-items: center; gap: 8px; font-size: 11px;
}
#drainageRiskView .opacity-control input[type="range"] { width: 80px; }

/* Detail Panel */
#drainageRiskView .detail-overlay {
  position: absolute; top: 0; right: 0; bottom: 0; width: 320px;
  background: color-mix(in srgb, var(--card-bg, #fff) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  z-index: 450; overflow-y: auto; transform: translateX(100%);
  transition: transform 0.3s ease; box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  border-left: 1px solid var(--border);
}
#drainageRiskView .detail-overlay.open { transform: translateX(0); }
#drainageRiskView .detail-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
#drainageRiskView .detail-panel-header h4 { font-size: 14px; font-weight: 600; }
#drainageRiskView .detail-close {
  background: transparent; border: none; font-size: 18px; cursor: pointer;
  color: var(--text-muted); width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
#drainageRiskView .detail-close:hover { background: var(--bg-secondary); }
#drainageRiskView .detail-body { padding: 16px; }

/* Detail panel inner styles */
#drainageRiskView .detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
#drainageRiskView .risk-badge { padding: 4px 12px; border-radius: var(--radius-xl); font-size: 12px; font-weight: 600; color: white; }
#drainageRiskView .detail-coord { font-size: 11px; color: var(--text-muted); }
#drainageRiskView .detail-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
#drainageRiskView .detail-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
#drainageRiskView .detail-section h4 { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 8px; }
#drainageRiskView .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#drainageRiskView .detail-item { display: flex; flex-direction: column; gap: 1px; }
#drainageRiskView .detail-item .label { font-size: 10px; color: var(--text-muted); }
#drainageRiskView .detail-item .value { font-size: 12px; font-weight: 600; }
#drainageRiskView .detail-rows { display: flex; flex-direction: column; gap: 6px; }
#drainageRiskView .detail-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
#drainageRiskView .detail-row .label { color: var(--text-muted); }
#drainageRiskView .detail-row .value { font-weight: 600; }
#drainageRiskView .dry-time-bar { width: 100%; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
#drainageRiskView .dry-time-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
#drainageRiskView .score-breakdown { display: flex; flex-direction: column; gap: 5px; }
#drainageRiskView .score-component { display: flex; align-items: center; gap: 6px; font-size: 10px; }
#drainageRiskView .score-component .comp-label { width: 82px; flex-shrink: 0; color: var(--text-muted); }
#drainageRiskView .score-component .comp-bar-track { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
#drainageRiskView .score-component .comp-bar-fill { height: 100%; border-radius: 3px; }
#drainageRiskView .score-component .comp-value { width: 26px; text-align: right; font-weight: 600; }
#drainageRiskView .score-composition { display: flex; gap: 10px; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
#drainageRiskView .score-composition strong { color: var(--text-primary); }
#drainageRiskView .drying-factors { display: flex; flex-wrap: wrap; gap: 6px; font-size: 10px; color: var(--text-muted); margin-top: 4px; }
#drainageRiskView .drying-factors strong { color: var(--text-primary); }
#drainageRiskView .forecast-warning { margin-top: 6px; padding: 6px 10px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 500; background: rgba(249,115,22,0.1); color: #ea580c; }
[data-theme="dark"] #drainageRiskView .forecast-warning { background: rgba(249,115,22,0.15); color: #fb923c; }
#drainageRiskView .rec-badge {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 11px;
  font-weight: 600; margin-top: 8px; text-align: center; line-height: 1.4;
}
#drainageRiskView .rec-badge.safe { background: rgba(34,197,94,0.12); color: var(--accent-green); }
#drainageRiskView .rec-badge.warning { background: rgba(234,179,8,0.12); color: #b45309; }
#drainageRiskView .rec-badge.danger { background: rgba(239,68,68,0.12); color: var(--accent-red); }
#drainageRiskView .rec-badge.extreme { background: rgba(153,27,27,0.15); color: #991b1b; }
[data-theme="dark"] #drainageRiskView .rec-badge.safe { background: rgba(34,197,94,0.15); color: #4ade80; }
[data-theme="dark"] #drainageRiskView .rec-badge.warning { background: rgba(234,179,8,0.15); color: #facc15; }
[data-theme="dark"] #drainageRiskView .rec-badge.danger { background: rgba(239,68,68,0.15); color: #f87171; }
[data-theme="dark"] #drainageRiskView .rec-badge.extreme { background: rgba(153,27,27,0.2); color: #fca5a5; }

/* Collapsible Panels */
#drainageRiskView .collapse-header {
  display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 0;
  background: none; border: none; font-family: 'Outfit', sans-serif;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: color 0.2s; width: 100%; text-align: left;
}
#drainageRiskView .collapse-header:hover { color: var(--accent-green, #2d5a3d); }
#drainageRiskView .collapse-body { display: none; padding-top: 12px; }
#drainageRiskView .collapse-body.open { display: block; }
#drainageRiskView .collapse-body p { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 8px; }
#drainageRiskView .collapse-body ul { font-size: 12px; color: var(--text-muted); line-height: 1.6; padding-left: 18px; margin-bottom: 10px; }
#drainageRiskView .weight-presets { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
#drainageRiskView .preset-btn {
  padding: 5px 12px; border: 1px solid var(--border); background: var(--card-bg, #fff);
  border-radius: 16px; font-family: 'Outfit', sans-serif; font-size: 11px;
  font-weight: 500; cursor: pointer; transition: all 0.2s; color: var(--text-primary);
}
#drainageRiskView .preset-btn.active { background: var(--accent-green, #2d5a3d); color: white; border-color: var(--accent-green, #2d5a3d); }
#drainageRiskView .weight-slider { margin-bottom: 6px; }
#drainageRiskView .weight-slider label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 2px; }
#drainageRiskView .weight-total { font-size: 12px; font-weight: 600; text-align: center; padding: 6px; border-radius: 4px; margin: 6px 0; }
#drainageRiskView .weight-total.valid { background: rgba(34,197,94,0.1); color: var(--accent-green); }
#drainageRiskView .weight-total.invalid { background: rgba(239,68,68,0.1); color: var(--accent-red); }
#drainageRiskView .split-note { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
#drainageRiskView .btn-reset {
  display: block; width: 100%; padding: 8px; border: 1px solid var(--border);
  background: var(--card-bg, #fff); border-radius: var(--radius-sm); font-family: 'Outfit', sans-serif;
  font-size: 12px; cursor: pointer; margin-top: 8px; color: var(--text-primary);
}
#drainageRiskView .btn-reset:hover { border-color: var(--accent-green, #2d5a3d); }
#drainageRiskView .info-weights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Education Panel */
#drainageRiskView .education-panel {
  background: var(--card-bg, #fff); border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 20px; overflow: hidden;
}
#drainageRiskView .education-panel .drm-card-header { cursor: pointer; user-select: none; }
#drainageRiskView .education-panel .drm-card-header:hover { background: var(--bg-hover); }
#drainageRiskView .education-panel .drm-card-body { display: none; }
#drainageRiskView .education-panel .drm-card-body.open { display: block; }
#drainageRiskView .edu-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
#drainageRiskView .edu-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
#drainageRiskView .edu-section h4 {
  font-size: 14px; font-weight: 600; color: var(--accent-green, #2d5a3d);
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
[data-theme="dark"] #drainageRiskView .edu-section h4 { color: #6ee7b7; }
#drainageRiskView .edu-section h5 { font-size: 12px; font-weight: 600; color: var(--text-primary); margin: 10px 0 4px; }
#drainageRiskView .edu-section p { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 8px; }
#drainageRiskView .edu-section ul, #drainageRiskView .edu-section ol { font-size: 12px; color: var(--text-muted); line-height: 1.7; padding-left: 20px; margin-bottom: 10px; }
#drainageRiskView .edu-section li { margin-bottom: 3px; }
#drainageRiskView .edu-section strong { color: var(--text-primary); }
#drainageRiskView .edu-factor {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px;
  background: var(--bg-secondary); border-radius: var(--radius-sm); margin-bottom: 6px;
}
#drainageRiskView .edu-factor .factor-weight {
  flex-shrink: 0; width: 40px; height: 24px; border-radius: 4px;
  background: var(--accent-green, #2d5a3d); color: white; font-size: 11px;
  font-weight: 600; display: flex; align-items: center; justify-content: center;
}
#drainageRiskView .edu-factor .factor-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
#drainageRiskView .edu-factor .factor-desc strong { color: var(--text-primary); }
#drainageRiskView .edu-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0; }
#drainageRiskView .edu-table th {
  background: var(--bg-hover); color: var(--text-primary); font-weight: 600;
  padding: 6px 10px; text-align: left; border: 1px solid var(--border);
}
#drainageRiskView .edu-table td { padding: 5px 10px; border: 1px solid var(--border); }
#drainageRiskView .edu-table tr:hover { background: var(--bg-secondary); }
#drainageRiskView .drm-badge-a { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; background: #dcfce7; color: #166534; }
#drainageRiskView .drm-badge-b { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; background: #ecfccb; color: #3f6212; }
#drainageRiskView .drm-badge-c { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; background: #fef9c3; color: #854d0e; }
#drainageRiskView .drm-badge-d { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; background: #fee2e2; color: #991b1b; }
[data-theme="dark"] #drainageRiskView .drm-badge-a { background: rgba(34,197,94,0.2); color: #86efac; }
[data-theme="dark"] #drainageRiskView .drm-badge-b { background: rgba(132,204,22,0.2); color: #bef264; }
[data-theme="dark"] #drainageRiskView .drm-badge-c { background: rgba(234,179,8,0.2); color: #fde047; }
[data-theme="dark"] #drainageRiskView .drm-badge-d { background: rgba(239,68,68,0.2); color: #fca5a5; }
[data-theme="dark"] #drainageRiskView .edu-factor { background: #1e1e1e; }
[data-theme="dark"] #drainageRiskView .edu-table th { background: #2a2a2a; }

/* Leaflet popup overrides */
#drainageRiskView .leaflet-popup-content-wrapper { border-radius: 8px !important; font-family: 'Outfit', sans-serif !important; box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important; }
#drainageRiskView .leaflet-popup-content { margin: 12px 16px !important; font-size: 13px !important; line-height: 1.5 !important; }
#drainageRiskView .popup-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
#drainageRiskView .popup-risk { display: inline-block; padding: 2px 8px; border-radius: var(--radius-lg); font-size: 11px; font-weight: 600; color: white; margin-bottom: 6px; }
#drainageRiskView .popup-detail { color: var(--text-muted); font-size: 12px; }

/* Responsive */
@media (max-width: 768px) {
  #drainageRiskView .drm-stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  #drainageRiskView .drm-stat-card { padding: 14px; }
  #drainageRiskView .drm-stat-value { font-size: 22px; }
  #drainageRiskView #drm-map { height: calc(100dvh - 320px); min-height: 350px; }
  #drainageRiskView .quick-nav-overlay { max-width: calc(100% - 100px); overflow-x: auto; flex-wrap: nowrap; }
  #drainageRiskView .weather-bar { flex-direction: column; gap: 8px; }
  #drainageRiskView .weather-metrics { gap: 10px; }
  #drainageRiskView .precip-summary { margin-left: 0; }
  #drainageRiskView .detail-overlay {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 70vh; border-radius: 16px 16px 0 0;
    transform: translateY(100%); border-left: none; border-top: 1px solid var(--border);
  }
  #drainageRiskView .detail-overlay.open { transform: translateY(0); }
  #drainageRiskView .info-weights-grid { grid-template-columns: 1fr; }
  #drainageRiskView .controls-row { gap: 12px; }
}

/* ==================== INVENTORY VIEW ==================== */
.inv-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inv-tab-btn {
  padding: 10px 18px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

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

.inv-tab-btn.active {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.inv-tab-content {
  animation: fadeIn 0.2s ease;
}

/* Inventory status badges */
.inv-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 600;
}

.inv-status.ok {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.inv-status.low {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
}

.inv-status.out {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

/* Inventory compliance cards */
.inv-compliance-good { border-left: 3px solid var(--accent-green); }
.inv-compliance-warn { border-left: 3px solid var(--accent-amber); }
.inv-compliance-bad { border-left: 3px solid var(--accent-red); }

@media (max-width: 768px) {
  .inv-tabs { gap: 6px; }
  .inv-tab-btn { padding: 8px 12px; font-size: 0.8rem; }
}


/* ==================== PERFORMANCE MODULE STYLES ==================== */

/* --- Bag Rate Slider --- */
.br-slider-container { margin-top: 12px; }
.br-slider {
  height: 10px;
  background: linear-gradient(to right, #ffcdd2 0%, #ffe0b2 25%, #c8e6c9 40%, #c8e6c9 60%, #bbdefb 75%, #e1bee7 100%);
  border-radius: 5px;
  position: relative;
}
.br-slider-optimal {
  position: absolute;
  top: -2px;
  height: 14px;
  background: rgba(34, 197, 94, 0.25);
  border-radius: 7px;
}
.br-slider-marker {
  position: absolute;
  top: -5px;
  width: 20px;
  height: 20px;
  background: #2d5a3d;
  border: 2px solid white;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.br-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* --- Charts Row --- */
.br-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.br-chart-container { min-height: 260px; }

/* --- Tech Grid --- */
.br-tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.br-tech-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}
.br-tech-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.br-tech-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.br-tech-name { font-weight: 600; font-size: 0.9rem; }
.br-company-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}
.br-company-badge.gx { background: var(--accent-cyan-light, #cffafe); color: var(--accent-cyan, #0891b2); }
.br-company-badge.rlc { background: var(--accent-green-light, #dcfce7); color: var(--accent-green, #166534); }
.br-tech-rate {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}
.br-tech-rate-label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 8px; }
.br-tech-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.br-status-badge {
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}
.br-status-badge.on-target { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.br-status-badge.heavy { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.br-status-badge.light { background: rgba(234,179,8,0.15); color: var(--accent-amber); }
.br-tech-meta { font-size: 0.7rem; color: var(--text-muted); }

/* --- View Controls --- */
.br-view-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.br-view-toggle { display: flex; gap: 4px; }
.br-tech-count { font-size: 0.85rem; color: var(--text-muted); }

/* --- Leaderboard --- */
.br-leaderboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.br-leader-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.br-leader-item.attention { background: rgba(239,68,68,0.03); }
.br-leader-rank { font-size: 1.2rem; width: 28px; text-align: center; }
.br-leader-info { flex: 1; }
.br-leader-name { font-weight: 600; font-size: 0.9rem; }
.br-leader-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.br-leader-rate { font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* --- Detail Panel (Bag Rate + Employee Perf) --- */
.br-detail-panel,
.employee-perf-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-card, #fff);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 1000;
  transition: right 0.3s ease;
  overflow-y: auto;
}
.br-detail-panel.open,
.employee-perf-panel.open {
  right: 0;
}
.br-detail-panel-header,
.employee-perf-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-card, #fff);
  z-index: 1;
}
.br-detail-panel-header h3,
.employee-perf-panel-header h3 { margin: 0; }
.br-detail-panel-body,
.employee-perf-panel-body { padding: 20px; }

.br-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.br-detail-stat { text-align: center; }
.br-detail-stat-value { font-size: 1.4rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.br-detail-stat-label { font-size: 0.7rem; color: var(--text-muted); }
.br-detail-monthly { margin-bottom: 20px; }
.br-detail-monthly h4 { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 12px; }
.br-monthly-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 80px;
  gap: 6px;
}
.br-monthly-bar-wrapper { flex: 1; display: flex; flex-direction: column; align-items: center; }
.br-monthly-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 4px; }
.br-monthly-bar.optimal { background: #4caf50; }
.br-monthly-bar.near-optimal { background: #8bc34a; }
.br-monthly-bar.needs-work { background: #ff9800; }
.br-monthly-label { font-size: 0.6rem; color: var(--text-muted); margin-top: 4px; }
.br-monthly-value { font-size: 0.55rem; color: var(--text-secondary); font-weight: 500; }
.br-detail-comparison { padding: 12px; background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); margin-bottom: 16px; }
.br-detail-rank { font-weight: 600; }
.br-detail-vs-team { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* --- 5-Tier Status Badges --- */
.br-status-badge.very-heavy { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.br-status-badge.running-hot { background: rgba(249,115,22,0.15); color: #ea580c; }
.br-status-badge.optimal { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.br-status-badge.running-light { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.br-status-badge.very-light { background: rgba(139,92,246,0.15); color: #7c3aed; }
.br-status-badge.no-data { background: rgba(107,114,128,0.1); color: var(--text-muted); }

/* --- Company Performance Cards Grid --- */
.br-company-perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.br-company-perf-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  border-top: 3px solid var(--accent-green);
  transition: box-shadow 0.2s;
}
.br-company-perf-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.br-company-perf-card .perf-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.br-company-perf-card .perf-card-title { font-weight: 700; font-size: 1.05rem; }
.br-company-perf-card .perf-card-rate {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  margin: 4px 0 2px;
}
.br-company-perf-card .perf-card-sub { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 12px; }
.br-delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
.br-delta-badge.up { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.br-delta-badge.down { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.br-delta-badge.flat { background: rgba(107,114,128,0.1); color: var(--text-muted); }
.br-company-perf-card .perf-card-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.br-company-perf-card .perf-card-stats span { display: flex; flex-direction: column; gap: 2px; }
.br-company-perf-card .perf-card-stats strong { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }

/* --- Quick Stats Panel --- */
.br-quick-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.br-quick-stat-item {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
  flex: 1;
  min-width: 120px;
  text-align: center;
}
.br-quick-stat-item .stat-val { font-size: 1.4rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.br-quick-stat-item .stat-lbl { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* --- Sparkline --- */
.br-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  margin-top: 6px;
}
.br-spark-bar {
  flex: 1;
  min-width: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--accent-green);
  opacity: 0.6;
  transition: opacity 0.2s;
}
.br-spark-bar.no-data { background: var(--border-subtle); }

/* --- Search/Filter Bar --- */
.br-filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.br-search-input {
  padding: 7px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: var(--bg-card, #fff);
  color: var(--text-primary);
  min-width: 180px;
}
.br-search-input::placeholder { color: var(--text-muted); }
.br-search-input:focus { outline: none; border-color: var(--accent-green); box-shadow: 0 0 0 2px rgba(34,197,94,0.15); }

/* --- Tech Card Enhancements (left border by status) --- */
.br-tech-card.status-very-heavy { border-left: 3px solid var(--accent-red); }
.br-tech-card.status-running-hot { border-left: 3px solid #ea580c; }
.br-tech-card.status-optimal { border-left: 3px solid var(--accent-green); }
.br-tech-card.status-running-light { border-left: 3px solid var(--accent-blue); }
.br-tech-card.status-very-light { border-left: 3px solid #7c3aed; }
.br-tech-card.status-no-data { border-left: 3px solid #9ca3af; }

/* --- Sort Indicators --- */
.br-sort-header { cursor: pointer; user-select: none; white-space: nowrap; }
.br-sort-header:hover { color: var(--accent-green); }
.br-sort-active { color: var(--accent-green); font-weight: 700; }
.br-sort-arrow { font-size: 0.7rem; margin-left: 3px; opacity: 0.5; }
.br-sort-active .br-sort-arrow { opacity: 1; }

/* --- Daily Breakdown (Detail Panel) --- */
.br-daily-breakdown { margin-bottom: 20px; }
.br-daily-breakdown h4 { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 10px; }
.br-daily-table { width: 100%; font-size: 0.8rem; border-collapse: collapse; }
.br-daily-table th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); color: var(--text-muted); font-weight: 500; }
.br-daily-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); }

/* --- Personal Trend Chart (Detail Panel) --- */
.br-personal-trend { margin-bottom: 20px; }
.br-personal-trend h4 { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 10px; }
.br-personal-trend canvas { max-height: 200px; }

/* --- Comparison Bars (Detail Panel) --- */
.br-comparison-bars { margin-bottom: 20px; }
.br-comparison-bars h4 { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 10px; }
.br-comparison-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}
.br-comparison-bar-item .bar-label { width: 80px; text-align: right; color: var(--text-muted); flex-shrink: 0; }
.br-comparison-bar-item .bar-track { flex: 1; height: 12px; background: var(--bg-secondary, #f3f4f6); border-radius: var(--radius-sm); overflow: hidden; }
.br-comparison-bar-item .bar-fill { height: 100%; border-radius: var(--radius-sm); transition: width 0.4s ease; }
.br-comparison-bar-item .bar-value { width: 50px; font-weight: 600; font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }

/* --- Explanation Panels & Info Buttons --- */
.br-chart-explain {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  margin: -4px 0 8px;
  line-height: 1.4;
}
.br-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-green);
  background: transparent;
  color: var(--accent-green);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 6px;
  padding: 0;
  vertical-align: middle;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.br-info-btn:hover {
  background: var(--accent-green);
  color: #fff;
}
.br-info-panel {
  display: none;
  background: linear-gradient(135deg, rgba(34,197,94,0.06), rgba(34,197,94,0.02));
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0 12px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.br-info-panel.visible { display: block; }
.br-info-panel h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.br-info-panel ul {
  margin: 4px 0 8px 16px;
  padding: 0;
}
.br-info-panel ul li { margin-bottom: 3px; }
.br-action-tip {
  border-left: 3px solid var(--accent-green);
  background: rgba(34,197,94,0.05);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* --- Advanced Date Filters --- */
.br-advanced-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg-secondary, #f9fafb);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}
.br-advanced-filters.hidden { display: none; }
.br-advanced-filters label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.br-advanced-filters input[type="date"],
.br-advanced-filters input[type="number"] {
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: var(--bg-card, #fff);
  color: var(--text-primary);
}
.br-advanced-filters input:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
}
.br-period-label {
  display: inline-block;
  padding: 5px 12px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-green);
  margin-bottom: 12px;
}

/* --- Review Cards --- */
.review-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.review-card-enhanced {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  text-align: center;
}
.review-card-enhanced:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.review-card-enhanced.completed { border-left: 3px solid var(--accent-green); }
.review-card-enhanced.pending { border-left: 3px solid var(--accent-amber); }
.review-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  text-align: left;
}
.review-card-name { font-weight: 600; font-size: 0.95rem; }
.review-card-company { font-size: 0.7rem; color: var(--text-muted); }
.review-score-circle,
.review-score-circle-lg {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 8px auto;
  font-weight: 700;
}
.review-score-circle-lg { width: 80px; height: 80px; }
.review-score-circle .score-value,
.review-score-circle-lg .score-value { font-size: 1.4rem; line-height: 1; }
.review-score-circle-lg .score-value { font-size: 1.8rem; }
.review-score-circle .score-max,
.review-score-circle-lg .score-max { font-size: 0.65rem; color: var(--text-muted); font-weight: 400; }
.review-score-circle.excellent,
.review-score-circle-lg.excellent { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.review-score-circle.good,
.review-score-circle-lg.good { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.review-score-circle.needs-improvement,
.review-score-circle-lg.needs-improvement { background: rgba(234,179,8,0.15); color: var(--accent-amber); }
.review-status-tag { font-size: 0.8rem; color: var(--text-muted); padding: 12px 0; }
.review-status-tag.completed { color: var(--accent-green); }
.review-status-tag.pending { color: var(--accent-amber); }
.review-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* --- Review Detail Modal --- */
.review-detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.review-detail-modal-inner {
  background: var(--bg-card, #fff);
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.review-detail-modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-card, #fff);
  z-index: 1;
}
.review-detail-modal-top h3 { margin: 0; }
.review-detail-modal-body { padding: 24px; }
.review-detail-header h2 { margin: 0 0 8px; font-size: 1.2rem; }
.review-detail-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.review-overall-score { text-align: center; margin: 20px 0; }
.score-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; }
.review-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.review-metric-item { text-align: center; padding: 12px; background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); }
.review-metric-value { font-size: 1.3rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.review-metric-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.review-section {
  margin: 20px 0;
  padding: 16px;
  background: var(--bg-secondary, #f9fafb);
  border-radius: var(--radius-md);
}
.review-section h3 { margin: 0 0 10px; font-size: 1rem; }
.review-section.strengths { border-left: 3px solid var(--accent-green); }
.review-section.improvements { border-left: 3px solid var(--accent-amber); }
.review-section ul { margin: 0; padding-left: 20px; }
.review-section li { margin-bottom: 6px; line-height: 1.5; }
.review-acknowledge-section {
  margin-top: 20px;
  padding: 16px;
  background: rgba(59,130,246,0.08);
  border-radius: var(--radius-md);
}

/* --- Customer Feedback Hero --- */
.fb-hero-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.fb-hero-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}
.fb-hero-card.compliment { border-bottom: 3px solid var(--accent-green); }
.fb-hero-card.complaint { border-bottom: 3px solid var(--accent-red); }
.fb-hero-card.ratio { border-bottom: 3px solid var(--accent-blue); }
.fb-hero-icon { font-size: 1.5rem; margin-bottom: 4px; }
.fb-hero-value { font-size: 1.8rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.fb-hero-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* --- Feedback Toggle --- */
.feedback-toggle-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.feedback-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-card, #fff);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.feedback-toggle-btn:hover { border-color: var(--text-muted); }
.feedback-toggle-btn.active.compliment {
  border-color: var(--accent-green);
  background: rgba(34,197,94,0.08);
  color: var(--accent-green);
}
.feedback-toggle-btn.active.complaint {
  border-color: var(--accent-red);
  background: rgba(239,68,68,0.08);
  color: var(--accent-red);
}
.toggle-count {
  background: var(--bg-secondary, #f1f5f9);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
}
.feedback-toggle-btn.active .toggle-count { background: rgba(255,255,255,0.3); }

/* --- Enhanced Feedback Cards --- */
.feedback-card-enhanced {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px;
  transition: box-shadow 0.2s;
}
.feedback-card-enhanced:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.feedback-card-enhanced.compliment { border-left: 3px solid var(--accent-green); }
.feedback-card-enhanced.complaint { border-left: 3px solid var(--accent-red); }
.feedback-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.category-badge {
  padding: 3px 10px;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-secondary);
}
.category-badge.service_quality { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.category-badge.technician_behavior { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.category-badge.communication { background: rgba(139,92,246,0.12); color: var(--accent-purple, #8b5cf6); }
.category-badge.timeliness { background: rgba(234,179,8,0.12); color: var(--accent-amber); }
.category-badge.results { background: rgba(6,182,212,0.12); color: var(--accent-cyan, #0891b2); }
.feedback-date { font-size: 0.8rem; color: var(--text-muted); }
.customer-quote {
  font-style: italic;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  border: none;
}
.feedback-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.customer-info { display: flex; gap: 12px; }
.company-tag {
  padding: 2px 8px;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* --- AI Insights Panel --- */
.ai-insights-panel {
  background: linear-gradient(135deg, rgba(139,92,246,0.06) 0%, rgba(59,130,246,0.06) 100%);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.ai-insights-panel.for-complaints {
  background: linear-gradient(135deg, rgba(239,68,68,0.06) 0%, rgba(234,179,8,0.06) 100%);
  border-color: rgba(239,68,68,0.2);
}
.ai-insights-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
}
.ai-icon { font-size: 1.2rem; }
.ai-refresh-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}
.ai-refresh-btn:hover { color: var(--text-primary); }
.ai-insights-content { font-size: 0.9rem; line-height: 1.6; }
.ai-insights-content ul { margin: 0; padding-left: 20px; }
.ai-insights-content li { margin-bottom: 6px; }

/* ==================== FEEDBACK ANALYTICAL POWERHOUSE ==================== */

/* --- Feedback Tabs --- */
.fb-tab-group {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 10px;
  padding: 4px;
}
.fb-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}
.fb-tab:hover { color: var(--text-primary); }
.fb-tab.active {
  background: var(--bg-card, #fff);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* --- Charts Row --- */
.fb-charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.fb-chart-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.fb-chart-card h3 { margin: 0 0 12px; font-size: 0.95rem; }
.fb-chart-wrap { position: relative; height: 250px; }

/* --- Breakdown Row --- */
.fb-breakdown-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.fb-breakdown-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.fb-breakdown-card h3 { margin: 0 0 16px; font-size: 0.95rem; }
.fb-breakdown-item { margin-bottom: 14px; }
.fb-breakdown-name { font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
.fb-breakdown-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.fb-bar-fill.compliment { background: var(--accent-green); }
.fb-bar-fill.complaint { background: var(--accent-red); }
.fb-breakdown-stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
}
.fb-empty-text { color: var(--text-muted); padding: 12px; font-style: italic; }

/* --- Leaderboard Row --- */
.fb-leaderboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.fb-leaderboard-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.fb-leaderboard-card h3 { margin: 0 0 16px; font-size: 0.95rem; }
.fb-leaderboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.fb-leaderboard-item:last-child { border-bottom: none; }
.fb-rank { font-size: 1.1rem; width: 28px; text-align: center; }
.fb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-green-light, rgba(34,197,94,0.15));
  color: var(--accent-green);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
}
.fb-avatar.complaint {
  background: var(--accent-red-light, rgba(239,68,68,0.15));
  color: var(--accent-red);
}
.fb-leader-name { flex: 1; font-weight: 500; font-size: 0.9rem; }
.fb-leader-count {
  font-size: 0.8rem; font-weight: 600; color: var(--accent-green);
  font-family: 'JetBrains Mono', monospace;
}
.fb-leader-count.complaint { color: var(--accent-red); }

/* --- Filter Bar --- */
.fb-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.fb-search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--bg-card, #fff);
}
.fb-search-input:focus { outline: 2px solid var(--accent-green); border-color: transparent; }

/* --- Data Table --- */
.fb-table-container { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); }
.fb-data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.fb-data-table thead { background: var(--bg-secondary, #f9fafb); }
.fb-data-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.fb-sortable { cursor: pointer; user-select: none; }
.fb-sortable:hover { color: var(--accent-green); }
.fb-sort-arrow { font-size: 0.75rem; color: var(--text-muted); }
.fb-data-table td { padding: 10px 12px; border-top: 1px solid var(--border-subtle); }
.fb-table-row { cursor: pointer; transition: background 0.15s; }
.fb-table-row:hover { background: var(--bg-secondary, #f9fafb); }
.fb-cell-date { white-space: nowrap; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.fb-cell-excerpt { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.fb-empty-cell { text-align: center; padding: 40px; color: var(--text-muted); }

/* --- Type & Status Badges --- */
.fb-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600;
  text-transform: capitalize;
}
.fb-type-badge.compliment { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.fb-type-badge.complaint { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.fb-type-badge.neutral { background: var(--bg-secondary, #f1f5f9); color: var(--text-muted); }
.fb-status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; text-transform: capitalize;
}
.fb-status-badge.new { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.fb-status-badge.acknowledged { background: rgba(139,92,246,0.12); color: var(--accent-purple, #8b5cf6); }
.fb-status-badge.in_progress { background: rgba(234,179,8,0.12); color: var(--accent-amber); }
.fb-status-badge.resolved { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.fb-status-badge.closed { background: var(--bg-secondary, #f1f5f9); color: var(--text-muted); }

/* --- Pagination --- */
.fb-pagination {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; padding: 12px 0; font-size: 0.85rem;
}
.fb-page-info { color: var(--text-muted); }
.fb-page-btns { display: flex; gap: 4px; }
.fb-page-btn {
  padding: 6px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--bg-card, #fff); cursor: pointer; font-family: inherit; font-size: 0.8rem;
}
.fb-page-btn:hover:not(:disabled) { border-color: var(--accent-green); color: var(--accent-green); }
.fb-page-btn.active { background: var(--accent-green); color: #fff; border-color: var(--accent-green); }
.fb-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fb-page-ellipsis { padding: 6px 4px; color: var(--text-muted); }
.fb-page-size {
  padding: 6px 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.8rem; background: var(--bg-card, #fff);
}

/* --- Mobile Cards --- */
.fb-mobile-cards { display: none; flex-direction: column; gap: 10px; }
.fb-mobile-card {
  background: var(--bg-card, #fff); border: 1px solid var(--border-subtle);
  border-radius: 10px; padding: 14px; cursor: pointer; transition: box-shadow 0.2s;
}
.fb-mobile-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.fb-mobile-card.compliment { border-left: 3px solid var(--accent-green); }
.fb-mobile-card.complaint { border-left: 3px solid var(--accent-red); }
.fb-mobile-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fb-mobile-date { font-size: 0.8rem; color: var(--text-muted); }
.fb-mobile-excerpt { font-style: italic; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.fb-mobile-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 0.8rem; color: var(--text-muted); }

/* --- Detail Panel --- */
.fb-detail-overlay {
  position: fixed; inset: 0; background: var(--bg-overlay, rgba(0,0,0,0.4));
  backdrop-filter: blur(4px); z-index: 1000; display: none; justify-content: flex-end;
}
.fb-detail-overlay.active { display: flex; }
.fb-detail-panel {
  width: 580px; max-width: 100%; height: 100vh;
  background: var(--bg-card, #fff); border-left: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  animation: slideIn 0.3s ease; box-shadow: -10px 0 40px rgba(0,0,0,0.15);
}
.fb-detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px; border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card-alt, var(--bg-card, #fff));
}
.fb-detail-header-left { flex: 1; }
.fb-detail-type-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--radius-md); font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; margin-bottom: 8px;
}
.fb-detail-type-badge.compliment { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.fb-detail-type-badge.complaint { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.fb-detail-header h2 { font-size: 1.2rem; font-weight: 700; margin: 0; line-height: 1.3; }
.fb-detail-body {
  flex: 1; overflow-y: auto; padding: 24px;
}

/* --- Detail Sections --- */
.fb-detail-section { margin-bottom: 24px; }
.fb-detail-section h3 {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 12px;
}
.fb-detail-quote {
  font-style: italic; font-size: 1rem; line-height: 1.6;
  padding: 12px 16px; margin: 0; border-left: 3px solid var(--accent-green);
  background: rgba(34,197,94,0.04); border-radius: 0 8px 8px 0;
}
.fb-detail-desc { color: var(--text-secondary); line-height: 1.5; margin: 8px 0 0; }
.fb-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fb-detail-field label {
  display: block; font-size: 0.7rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px;
}
.fb-detail-field span { font-size: 0.9rem; }
.fb-detail-resolution { color: var(--text-secondary); line-height: 1.5; margin: 0 0 12px; }

/* --- Timeline --- */
.fb-detail-timeline { display: flex; flex-direction: column; gap: 0; }
.fb-timeline-item {
  display: flex; gap: 12px; padding: 8px 0;
  position: relative;
}
.fb-timeline-item:not(:last-child)::after {
  content: ''; position: absolute; left: 7px; top: 28px; bottom: -8px;
  width: 2px; background: var(--border-subtle);
}
.fb-timeline-dot {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-secondary, #e5e7eb); border: 2px solid var(--border-subtle);
  margin-top: 2px;
}
.fb-timeline-item.resolved .fb-timeline-dot { background: var(--accent-green); border-color: var(--accent-green); }
.fb-timeline-label { font-weight: 500; font-size: 0.85rem; }
.fb-timeline-date { font-size: 0.8rem; color: var(--text-muted); }

/* --- Resolution Actions --- */
.fb-detail-actions { margin-top: 12px; }
.fb-resolution-input {
  width: 100%; min-height: 80px; padding: 10px; margin-bottom: 10px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.85rem; resize: vertical;
}
.fb-action-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Related Feedback --- */
.fb-related-item {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: var(--radius-md); cursor: pointer; transition: background 0.15s;
}
.fb-related-item:hover { background: var(--bg-secondary, #f9fafb); }
.fb-related-excerpt { flex: 1; font-size: 0.85rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-related-date { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* --- Insights Tab --- */
.fb-insights-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.fb-insight-card {
  background: var(--bg-card, #fff); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 20px;
}
.fb-insight-card h3 { margin: 0 0 4px; font-size: 0.95rem; }
.fb-insight-card .subtitle { margin: 0 0 16px; font-size: 0.8rem; color: var(--text-muted); }

/* --- Heatmap --- */
.fb-heatmap-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.fb-heatmap-cell {
  padding: 12px 8px; border-radius: var(--radius-md); text-align: center;
  transition: transform 0.15s;
}
.fb-heatmap-cell:hover { transform: scale(1.05); }
.fb-heatmap-day { font-size: 0.7rem; font-weight: 600; margin-bottom: 4px; }
.fb-heatmap-count { font-size: 1.1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* --- Feedback Responsive --- */
@media (max-width: 768px) {
  .fb-charts-row { grid-template-columns: 1fr; }
  .fb-breakdown-row { grid-template-columns: 1fr; }
  .fb-leaderboard-row { grid-template-columns: 1fr; }
  .fb-insights-grid { grid-template-columns: 1fr; }
  .fb-filter-bar { flex-direction: column; }
  .fb-search-input { min-width: unset; }
  .fb-table-container { display: none; }
  .fb-mobile-cards { display: flex !important; }
  .fb-detail-panel { width: 100%; }
  .fb-detail-grid { grid-template-columns: 1fr; }
  .fb-hero-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .fb-tab-group { flex-direction: column; }
  .fb-heatmap-grid { grid-template-columns: repeat(4, 1fr); }
  .fb-hero-row { grid-template-columns: 1fr 1fr; }
  .fb-pagination { flex-direction: column; align-items: flex-start; }
}

/* --- Employee Performance Panel --- */
.emp-perf-header { margin-bottom: 20px; }
.emp-perf-role { font-weight: 600; font-size: 1rem; }
.emp-perf-company { font-size: 0.85rem; color: var(--text-muted); }
.emp-perf-section { margin-bottom: 20px; }
.emp-perf-section h4 { margin: 0 0 12px; font-size: 0.9rem; color: var(--text-secondary); }
.emp-perf-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.emp-perf-mini-stat { text-align: center; padding: 10px; background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); }
.mini-stat-value { font-size: 1.2rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.mini-stat-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

/* --- Benchmark Bars (Portal) --- */
.benchmark-item-portal { margin-bottom: 16px; }
.benchmark-header-portal { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.85rem; }
.benchmark-value-portal { font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.benchmark-bar-container-portal { height: 8px; background: var(--bg-secondary, #e5e7eb); border-radius: 4px; overflow: hidden; }
.benchmark-bar-portal { height: 100%; background: var(--accent-green); border-radius: 4px; transition: width 0.5s ease; }
.benchmark-bar-portal.warning { background: var(--accent-amber); }
.benchmark-meta-portal { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* --- Team Performer Items --- */
.team-performer-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.15s;
}
.team-performer-item:hover { background: var(--bg-secondary, #f9fafb); }

/* ==================== EMPLOYEE DETAIL PANEL (EXPANDED) ==================== */

/* --- Expanded Metrics Grid --- */
.portal-emp-metrics-group { margin-bottom: 16px; }
.portal-emp-metrics-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.portal-emp-metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.portal-emp-metric-card { background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); padding: 10px; text-align: center; }
.portal-emp-metric-value { font-size: 1.1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--text-primary); }
.portal-emp-metric-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

/* --- Bag Rate Rich Visualization --- */
.portal-emp-br-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.portal-emp-br-stat { text-align: center; padding: 10px; background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); }
.portal-emp-br-stat-value { font-size: 1.3rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.portal-emp-br-stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.portal-emp-br-stat-sub { font-size: 0.65rem; color: var(--text-secondary); margin-top: 2px; }

.portal-emp-br-slider-wrap { background: var(--bg-secondary, #f9fafb); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.portal-emp-br-slider { height: 14px; background: linear-gradient(to right, #ffcdd2 0%, #ffe0b2 25%, #c8e6c9 40%, #c8e6c9 60%, #bbdefb 75%, #e1bee7 100%); border-radius: 7px; position: relative; margin: 10px 0; }
.portal-emp-br-slider-optimal { position: absolute; top: 0; height: 100%; background: rgba(34, 197, 94, 0.3); border-radius: 7px; }
.portal-emp-br-slider-marker { position: absolute; top: -8px; width: 28px; height: 28px; background: #2d5a3d; border: 2px solid white; border-radius: 50%; transform: translateX(-50%); box-shadow: 0 2px 6px rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center; color: white; font-size: 0.5rem; font-weight: 600; }
.portal-emp-br-slider-team { position: absolute; top: 18px; transform: translateX(-50%); font-size: 0.6rem; color: var(--text-muted); white-space: nowrap; }
.portal-emp-br-slider-labels { display: flex; justify-content: space-between; font-size: 0.65rem; color: var(--text-muted); margin-top: 18px; }

.portal-emp-br-comparison { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.portal-emp-br-comp-card { background: var(--bg-secondary, #f9fafb); border-radius: 10px; padding: 10px; display: flex; align-items: center; gap: 8px; }
.portal-emp-br-comp-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.portal-emp-br-comp-icon.declining { background: var(--accent-red-light) !important; }

.portal-emp-br-monthly { background: var(--bg-secondary, #f9fafb); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.portal-emp-br-monthly-bars { display: flex; align-items: flex-end; justify-content: space-between; height: 70px; gap: 4px; }
.portal-emp-br-monthly-item { flex: 1; display: flex; flex-direction: column; align-items: center; }
.portal-emp-br-monthly-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 4px; }
.portal-emp-br-monthly-bar.optimal { background: #4caf50; }
.portal-emp-br-monthly-bar.near-optimal { background: #8bc34a; }
.portal-emp-br-monthly-bar.needs-work { background: #ff9800; }
.portal-emp-br-monthly-label { font-size: 0.55rem; color: var(--text-muted); margin-top: 3px; }
.portal-emp-br-monthly-value { font-size: 0.5rem; color: var(--text-secondary); font-weight: 500; }

.portal-emp-br-highlights { display: flex; gap: 8px; margin-bottom: 14px; }
.portal-emp-br-highlight { flex: 1; padding: 10px; border-radius: 10px; text-align: center; }
.portal-emp-br-highlight.best { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); }
.portal-emp-br-highlight.worst { background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3); }
.portal-emp-br-highlight span { font-size: 1.1rem; display: block; margin-bottom: 4px; }
.portal-emp-br-highlight .month { font-weight: 600; font-size: 0.85rem; }
.portal-emp-br-highlight .pct { font-size: 0.7rem; color: var(--text-secondary); }

/* --- SVG Trend Chart --- */
.portal-emp-trends { position: relative; }
.portal-emp-trend-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.portal-emp-trend-tab { padding: 4px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-card); font-size: 0.75rem; cursor: pointer; transition: all 0.15s; color: var(--text-secondary); font-family: inherit; }
.portal-emp-trend-tab.active { background: var(--accent-green); color: white; border-color: var(--accent-green); }
.portal-emp-trend-chart-area { min-height: 100px; }
.portal-emp-trend-svg { width: 100%; height: 100px; }

.portal-emp-trend-indicators { display: flex; gap: 8px; margin-top: 10px; }
.portal-emp-trend-indicator { flex: 1; text-align: center; padding: 8px; background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); }
.portal-emp-trend-indicator-label { font-size: 0.7rem; color: var(--text-muted); display: block; }
.portal-emp-trend-indicator-value { font-size: 1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; display: block; }
.portal-emp-trend-indicator-change { font-size: 0.7rem; font-weight: 600; }
.portal-emp-trend-indicator-change.up { color: var(--accent-green); }
.portal-emp-trend-indicator-change.down { color: var(--accent-red); }
.portal-emp-trend-indicator-change.stable { color: var(--text-muted); }

.portal-emp-season-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.portal-emp-season-card { background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); padding: 10px; text-align: center; }
.portal-emp-season-label { font-size: 0.7rem; color: var(--text-muted); }
.portal-emp-season-value { font-size: 1.1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.portal-emp-season-change { font-size: 0.7rem; font-weight: 600; }
.portal-emp-season-change.improved { color: var(--accent-green); }
.portal-emp-season-change.declined { color: var(--accent-red); }

/* --- WACU Grid --- */
.portal-emp-wacu-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.portal-emp-wacu-card { background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); padding: 10px; text-align: center; }
.portal-emp-wacu-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; }
.portal-emp-wacu-value { font-size: 1.1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--accent-green); }
.portal-emp-wacu-total { font-size: 0.8rem; color: var(--text-secondary); text-align: center; padding: 8px 0; }

/* --- Sales Bars --- */
.portal-emp-sales-total { font-size: 1.4rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-bottom: 12px; }
.portal-emp-sales-item { margin-bottom: 10px; }
.portal-emp-sales-header { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 4px; }
.portal-emp-sales-header span:first-child { font-weight: 500; }
.portal-emp-sales-header span:last-child { font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.portal-emp-sales-bar { height: 8px; background: var(--bg-secondary, #e5e7eb); border-radius: 4px; overflow: hidden; }
.portal-emp-sales-fill { height: 100%; background: linear-gradient(90deg, var(--accent-green), #22c55e); border-radius: 4px; transition: width 0.5s ease; }

/* --- Comparison Bars --- */
.portal-emp-comparison { margin-bottom: 12px; }
.portal-emp-comparison-label { font-size: 0.8rem; margin-bottom: 4px; }
.portal-emp-comparison-track { position: relative; height: 10px; background: var(--bg-secondary, #e5e7eb); border-radius: 5px; overflow: visible; }
.portal-emp-comparison-fill { height: 100%; border-radius: 5px; transition: width 0.5s ease; }
.portal-emp-comparison-fill.good { background: linear-gradient(90deg, var(--accent-green), #22c55e); }
.portal-emp-comparison-fill.warning { background: linear-gradient(90deg, var(--accent-amber), #f59e0b); }
.portal-emp-comparison-avg { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text-primary); border-radius: 1px; transform: translateX(-1px); }
.portal-emp-comparison-value { font-size: 0.75rem; font-weight: 600; font-family: 'JetBrains Mono', monospace; text-align: right; margin-top: 2px; }

/* --- Time Off List --- */
.portal-emp-vacation-balance { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-secondary, #f9fafb); border-radius: var(--radius-md); margin-bottom: 12px; font-size: 0.85rem; }
.portal-emp-timeoff-heading { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin: 10px 0 6px; }
.portal-emp-timeoff-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.8rem; }
.portal-emp-timeoff-date { font-weight: 600; font-family: 'JetBrains Mono', monospace; min-width: 60px; color: var(--text-secondary); }

/* --- Per-Employee Feedback --- */
.portal-emp-praise-hero { display: flex; align-items: center; gap: 10px; padding: 14px; background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.04)); border-radius: var(--radius-lg); margin-bottom: 14px; }
.portal-emp-praise-count { font-size: 2rem; font-weight: 700; color: var(--accent-green); font-family: 'JetBrains Mono', monospace; }

.portal-emp-fb-toggle { display: flex; gap: 6px; margin-bottom: 12px; }
.portal-emp-fb-btn { flex: 1; padding: 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); font-size: 0.75rem; font-weight: 500; cursor: pointer; transition: all 0.15s; background: var(--bg-card); color: var(--text-secondary); font-family: inherit; text-align: center; }
.portal-emp-fb-btn.active { background: var(--accent-green); color: white; border-color: var(--accent-green); }

.portal-emp-fb-card { padding: 12px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--border-subtle); }
.portal-emp-fb-card.compliment { border-left: 3px solid var(--accent-green); }
.portal-emp-fb-card.complaint { border-left: 3px solid var(--accent-red); }
.portal-emp-fb-category { font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--bg-secondary, #f0f0f0); color: var(--text-secondary); }

.portal-emp-ai-insights { background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.06)); border: 1px solid rgba(59, 130, 246, 0.2); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.portal-emp-ai-header { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; }

/* --- Employee Review Cards in Panel --- */
.portal-emp-review-card { padding: 12px; border: 1px solid var(--border-subtle); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: background 0.15s; }
.portal-emp-review-card:hover { background: var(--bg-secondary, #f9fafb); }
.portal-emp-review-badge { font-size: 0.65rem; padding: 2px 8px; border-radius: 4px; background: var(--accent-red-light); color: var(--accent-red); font-weight: 600; }

/* --- Challenge Cards --- */
.portal-challenge-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent-red); color: white; font-size: 0.7rem; font-weight: 700; padding: 0 6px; margin-left: 6px; }

.portal-challenge-card { padding: 12px; border: 1px solid var(--border-subtle); border-radius: 10px; margin-bottom: 8px; }
.portal-challenge-card.completed { opacity: 0.7; }
.portal-challenge-card.in-progress { border-left: 3px solid var(--accent-blue); }

.portal-challenge-status { font-size: 0.65rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; background: var(--bg-secondary, #f0f0f0); color: var(--text-secondary); }
.portal-challenge-status.completed { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.portal-challenge-status.in-progress { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.portal-challenge-status.new { background: rgba(234, 179, 8, 0.15); color: var(--accent-amber); }

.portal-challenge-priority { font-size: 0.6rem; padding: 2px 6px; border-radius: 4px; background: var(--accent-red-light); color: var(--accent-red); font-weight: 600; }
.portal-challenge-due { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.portal-challenge-due.overdue { color: var(--accent-red); font-weight: 600; }
.portal-challenge-due.soon { color: var(--accent-amber); font-weight: 600; }
.portal-challenge-actions { display: flex; gap: 6px; margin-top: 8px; }

/* --- Challenge Library --- */
.portal-library-filter { background: var(--bg-card); border: 1px solid var(--border-subtle); color: var(--text-secondary); }
.portal-library-filter.active { background: var(--accent-green); color: white; border-color: var(--accent-green); }

.portal-library-card { padding: 14px; border: 1px solid var(--border-subtle); border-radius: 10px; margin-bottom: 10px; }
.portal-library-badge { font-size: 0.6rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.portal-library-badge.featured { background: rgba(234, 179, 8, 0.15); color: var(--accent-amber); }
.portal-library-badge.portal-difficulty-easy { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.portal-library-badge.portal-difficulty-medium { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.portal-library-badge.portal-difficulty-hard { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* --- Team Challenge Cards --- */
.portal-team-challenge-card { padding: 14px; border: 1px solid var(--border-subtle); border-radius: 10px; margin-bottom: 10px; }
.portal-team-challenge-progress { margin-top: 8px; }
.portal-team-challenge-bar { height: 8px; background: var(--bg-secondary, #e5e7eb); border-radius: 4px; overflow: hidden; }
.portal-team-challenge-fill { height: 100%; background: linear-gradient(90deg, var(--accent-green), #22c55e); border-radius: 4px; transition: width 0.5s ease; }

/* ==================== END EMPLOYEE DETAIL STYLES ==================== */

/* --- Responsive --- */
@media (max-width: 768px) {
  .br-company-perf-grid { grid-template-columns: 1fr; }
  .br-charts-row { grid-template-columns: 1fr; }
  .br-tech-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .br-leaderboard-row { grid-template-columns: 1fr; }
  .br-advanced-filters { flex-direction: column; align-items: stretch; }
  .br-advanced-filters .btn { width: 100%; }
  .fb-hero-row { grid-template-columns: repeat(2, 1fr); }
  .review-cards-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .review-metrics-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .review-detail-modal { padding: 10px; }
  .review-detail-modal-inner { max-height: 90vh; }
  .emp-perf-stat-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .portal-emp-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-emp-br-comparison { grid-template-columns: 1fr; }
  .portal-emp-wacu-grid { grid-template-columns: repeat(3, 1fr); }
  .portal-emp-season-cards { grid-template-columns: 1fr; }
  .portal-emp-fb-toggle { flex-direction: column; }
}
@media (max-width: 480px) {
  .br-quick-stats { flex-direction: column; }
  .fb-hero-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .feedback-toggle-group { flex-direction: column; }
  .review-detail-meta { flex-direction: column; gap: 4px; }
  .portal-emp-metrics-grid { grid-template-columns: 1fr 1fr; }
  .portal-emp-br-stats { grid-template-columns: 1fr; }
  .portal-emp-br-highlights { flex-direction: column; }
  .portal-emp-wacu-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════ */
/* TEAM DASHBOARD — FPA-03                                       */
/* ══════════════════════════════════════════════════════════════ */

/* Summary Bar */
.td-summary-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.td-summary-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.td-summary-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.td-summary-card.has-attention { background: var(--yellow-100); border: 1px solid var(--accent-amber); }
[data-theme="dark"] .td-summary-card.has-attention { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.4); }
.td-summary-val { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.td-summary-lbl { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.td-summary-sub { font-size: 0.75rem; margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.td-attention-card .td-summary-val { color: var(--accent-amber); }

/* Zero/empty metric styling */
.metric-empty { opacity: 0.6; border-style: dashed !important; }
.metric-empty .td-summary-val,
.metric-empty .td-detail-metric-val,
.metric-empty .td-metric-val,
.metric-empty .stat-val,
.metric-empty .br-detail-stat-value { color: var(--text-muted) !important; font-style: italic; }
.no-data-label { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* Status dots */
.td-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.td-status-dot.td-status-very-heavy { background: var(--accent-red); }
.td-status-dot.td-status-running-hot { background: #ea580c; }
.td-status-dot.td-status-optimal { background: var(--accent-green); }
.td-status-dot.td-status-running-light { background: var(--accent-blue); }
.td-status-dot.td-status-very-light { background: #7c3aed; }
.td-status-dot.td-status-no-data { background: var(--text-muted); }

/* Filter Bar */
.td-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.td-search-wrap { position: relative; flex: 1; min-width: 180px; }
.td-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text-primary);
  box-sizing: border-box;
}
.td-search-input:focus { outline: none; border-color: var(--accent-green); }
.td-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 1rem; color: var(--text-muted);
  cursor: pointer; padding: 2px 6px;
}
.td-filter-bar .filter-select { min-width: 120px; }
.td-view-toggle { display: flex; gap: 2px; margin-left: auto; }
.td-view-btn {
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.td-view-btn:first-child { border-radius: 6px 0 0 6px; }
.td-view-btn:last-child { border-radius: 0 6px 6px 0; }
.td-view-btn.active { background: var(--accent-green); color: white; border-color: var(--accent-green); }

/* Collapsible Sections */
.td-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.td-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}
.td-section-header h3 { margin: 0; font-size: 0.95rem; }
.td-collapse-btn {
  background: none; border: none; font-size: 0.85rem;
  color: var(--text-muted); cursor: pointer; padding: 4px 8px;
}
.td-section-body { padding: 0 16px 12px; }
.td-section-body.collapsed { display: none; }

/* Leader/Attention Items */
.td-leader-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.td-leader-item:last-child { border-bottom: none; }
.td-leader-rank { font-size: 1.2rem; width: 28px; text-align: center; flex-shrink: 0; }
.td-leader-info { flex: 1; min-width: 0; }
.td-leader-name { font-weight: 600; font-size: 0.9rem; }
.td-leader-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 8px; align-items: center; margin-top: 2px; flex-wrap: wrap; }
.td-leader-rate { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.td-leader-rate > span:first-child { font-weight: 700; font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; }

/* Attention items */
.td-attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.td-attention-item:last-child { border-bottom: none; }
.td-attention-info { flex: 1; min-width: 0; }
.td-attention-reasons { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.td-reason-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(239,68,68,0.1);
  color: var(--accent-red);
  font-weight: 500;
  white-space: nowrap;
}
.td-severity-high { border-left: 3px solid var(--accent-red); padding-left: 10px; }
.td-severity-medium { border-left: 3px solid var(--accent-amber); padding-left: 10px; }
.td-attention-count-badge {
  font-size: 0.75rem;
  background: var(--accent-amber);
  color: white;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 700;
  margin-left: 6px;
}

/* Status Badges */
.td-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.td-status-very-heavy { background: rgba(220,38,38,0.1); color: var(--accent-red); }
.td-status-running-hot { background: rgba(234,88,12,0.1); color: #ea580c; }
.td-status-optimal { background: rgba(22,163,74,0.1); color: var(--accent-green); }
.td-status-running-light { background: rgba(37,99,235,0.1); color: var(--accent-blue); }
.td-status-very-light { background: rgba(124,58,237,0.1); color: #7c3aed; }
.td-status-no-data { background: rgba(107,114,128,0.1); color: var(--text-muted); }

/* Employee Header */
.td-employee-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
}
.td-employee-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
#td-compare-toggle { font-size: 13px; transition: all 0.15s; }

/* Card Grid */
.td-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.td-emp-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  border-left: 4px solid var(--border-subtle);
  transition: transform 0.15s, box-shadow 0.15s;
}
.td-emp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.td-emp-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.td-emp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.td-emp-identity { flex: 1; min-width: 0; }
.td-emp-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-emp-role { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-emp-badges { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.td-active-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate-300); }
.td-active-dot.active { background: var(--green-500); }
.td-emp-card-divider { height: 1px; background: var(--border-subtle); margin: 8px 0; }
.td-emp-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  text-align: center;
  margin-bottom: 8px;
}
.td-metric-item { }
.td-metric-val { font-weight: 700; font-size: 0.9rem; }
.td-metric-lbl { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.td-emp-card-footer { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Feedback badges on cards */
.td-fb-badge {
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: var(--radius-md);
  font-weight: 600;
}
.td-fb-badge.compliment { background: rgba(22,163,74,0.1); color: var(--accent-green); }
.td-fb-badge.complaint { background: rgba(220,38,38,0.1); color: var(--accent-red); }
.td-fb-badge.badge-count { background: rgba(245,158,11,0.1); color: #b45309; }

/* Table View */
.td-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.td-table thead { position: sticky; top: 0; z-index: 2; background: var(--bg-card); }
.td-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}
.td-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.td-alt-row { background: rgba(0,0,0,0.015); }
[data-theme="dark"] .td-alt-row { background: rgba(255,255,255,0.02); }
.td-table tr:hover { background: rgba(22,163,74,0.04); }
.td-th-sticky { position: sticky; left: 0; background: var(--bg-card); z-index: 1; }

/* Empty State */
.td-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Detail Panel */
.td-detail-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 460px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -8px 0 30px rgba(0,0,0,0.15);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  overflow: hidden;
}
.td-detail-panel.open { right: 0; }
.td-detail-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.td-detail-panel-header h3 { margin: 0; font-size: 1.1rem; }
.td-detail-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.td-detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  padding: 0 16px;
}
.td-tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.td-tab-btn:hover { color: var(--text-primary); }
.td-tab-btn.active { color: var(--accent-green); border-bottom-color: var(--accent-green); font-weight: 600; }
.td-detail-tabs-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.td-detail-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  flex-shrink: 0;
}

/* Detail Panel Metrics */
.td-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.td-detail-metric-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}
.td-detail-metric-val { font-size: 1.3rem; font-weight: 700; }
.td-detail-metric-lbl { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* Detail Sections */
.td-detail-section { margin-bottom: 20px; }
.td-detail-section h4 { font-size: 0.85rem; font-weight: 600; margin: 0 0 10px; color: var(--text-secondary); }

/* Badges */
.td-badge-list { display: flex; flex-wrap: wrap; gap: 8px; }
.td-badge-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}
.td-badge-icon { font-size: 1rem; }

/* Reviews */
.td-review-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.td-review-item:last-child { border-bottom: none; }

/* Feedback in detail */
.td-fb-summary-card {
  flex: 1;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
}
.td-fb-summary-card.compliment { background: rgba(22,163,74,0.08); }
.td-fb-summary-card.complaint { background: rgba(220,38,38,0.08); }
.td-fb-summary-val { font-size: 1.4rem; font-weight: 700; }
.td-fb-summary-card.compliment .td-fb-summary-val { color: var(--accent-green); }
.td-fb-summary-card.complaint .td-fb-summary-val { color: var(--accent-red); }
.td-fb-summary-lbl { font-size: 0.75rem; color: var(--text-muted); }

.td-fb-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.td-fb-item:last-child { border-bottom: none; }
.td-fb-item.compliment { border-left: 3px solid var(--accent-green); padding-left: 12px; }
.td-fb-item.complaint { border-left: 3px solid var(--accent-red); padding-left: 12px; }
.td-fb-date { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.td-fb-text { font-size: 0.85rem; line-height: 1.4; }
.td-fb-status-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: var(--radius-md);
  background: rgba(245,158,11,0.1);
  color: var(--accent-amber);
  font-weight: 500;
  margin-left: 6px;
}
.td-fb-status-tag.resolved { background: rgba(22,163,74,0.1); color: var(--accent-green); }

/* PTO bar */
.td-pto-bar-container { margin-bottom: 8px; }
.td-pto-bar {
  height: 12px;
  background: var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.td-pto-bar-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: var(--radius-sm);
  transition: width 0.3s;
}
.td-pto-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Mini table */
.td-mini-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.td-mini-table th { padding: 6px 8px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 0.75rem; border-bottom: 1px solid var(--border-subtle); }
.td-mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); }

/* ── TEAM DASHBOARD RESPONSIVE ── */
@media (max-width: 1200px) {
  .td-card-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .td-summary-bar { grid-template-columns: repeat(3, 1fr); }
  .td-card-grid { grid-template-columns: repeat(2, 1fr); }
  .td-detail-panel { width: 100vw; right: -100vw; }
}
@media (max-width: 640px) {
  .td-summary-bar { grid-template-columns: repeat(2, 1fr); }
  .td-summary-bar .td-summary-card:last-child { grid-column: 1 / -1; }
  .td-card-grid { grid-template-columns: 1fr; }
  .td-filter-bar { flex-direction: column; align-items: stretch; }
  .td-filter-bar .filter-select { min-width: unset; }
  .td-search-wrap { min-width: unset; }
  .td-view-toggle { align-self: flex-end; }
  .td-emp-metrics { grid-template-columns: repeat(2, 1fr); }
  .td-detail-metrics { grid-template-columns: repeat(2, 1fr); }
  .td-attention-item { flex-direction: column; align-items: flex-start; gap: 6px; }
}


/* ==================== PERSISTENT COMPANY TOGGLE ==================== */
.company-toggle-container {
  margin-bottom: 16px;
}

.company-toggle {
  display: inline-flex;
  gap: 0;
  background: var(--bg-secondary, #f0f0f0);
  border-radius: 10px;
  padding: 3px;
}

.company-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--text-muted, #666);
  transition: all 0.2s;
  min-height: 44px;
  white-space: nowrap;
}

.company-btn.active {
  background: var(--bg-card, white);
  color: var(--accent-green, #166534);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.company-btn:hover:not(.active):not(:disabled) {
  color: var(--text-primary, #333);
  background: rgba(0,0,0,0.03);
}

.company-toggle.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.company-toggle.disabled .company-btn {
  cursor: not-allowed;
  pointer-events: none;
}

.company-btn.active[data-company="RLC"] {
  border-bottom: 2px solid #c5972c;
}

.company-btn.active[data-company="GX"] {
  border-bottom: 2px solid var(--accent-green, #166534);
}

/* Static label for non-leadership roles */
.company-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-secondary, #f0f0f0);
  color: var(--text-secondary, #555);
  margin-bottom: 16px;
}

.company-label.rlc {
  border-left: 3px solid #c5972c;
}

.company-label.gx {
  border-left: 3px solid var(--accent-green, #166534);
}

@media (max-width: 480px) {
  .company-toggle {
    display: flex;
    width: 100%;
  }
  .company-btn {
    flex: 1;
    text-align: center;
    font-size: 13px;
    padding: 8px 8px;
  }
}

/* ==================== ENTITY DEEP-LINKS ==================== */
.entity-link {
  color: var(--accent-green-dark);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}
.entity-link:hover {
  color: #3d7a4d;
  text-decoration: underline;
}

/* Notification navigation arrow */
.notif-nav-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.notification-item[data-navigable]:hover .notif-nav-arrow,
.notif-full-item[data-navigable]:hover .notif-nav-arrow {
  opacity: 1;
}
.notification-item[data-navigable] {
  position: relative;
}
.notif-full-item[data-navigable] {
  position: relative;
}
.notification-item[data-navigable]:hover {
  background: var(--green-50);
}

/* Needs Attention quick-action buttons */
.td-attention-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.td-attention-actions button {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300);
  background: var(--bg-card);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.15s;
}
.td-attention-actions button:hover {
  border-color: var(--accent-green-dark);
  color: var(--accent-green-dark);
  background: var(--green-50);
}

/* Bag rate tech card profile link */
.br-profile-link {
  font-size: 12px;
  display: block;
  margin-top: 8px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.br-tech-card:hover .br-profile-link {
  opacity: 1;
}

/* ==================== PH-08: POLISH & MICRO-INTERACTIONS ==================== */

/* Loading Skeletons */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-subtle) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  height: 120px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
}
.skeleton-card .skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  background: rgba(0,0,0,0.04);
  border-radius: 4px;
}
.skeleton-card .skeleton-line:first-child {
  height: 20px;
  margin-bottom: 12px;
  background: rgba(0,0,0,0.06);
}
.skeleton-line { height: 16px; margin-bottom: 8px; background: rgba(0,0,0,0.04); border-radius: 4px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-circle { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.skeleton-list-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
}

/* Enhanced kanban card hover */
.kanban-card:hover {
  transform: translateY(-1px);
}

/* Live Data Indicator */
.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0); }
}

/* Detail Breadcrumbs */
.detail-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: 'Outfit', sans-serif;
}
.detail-breadcrumb-parent {
  color: var(--accent-green-dark);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.detail-breadcrumb-parent:hover {
  text-decoration: underline;
}
.detail-breadcrumb-sep {
  margin: 0 6px;
  color: var(--slate-300);
}
.detail-breadcrumb-current {
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

/* ============================================ */
/* MOBILE RESPONSIVENESS (WB-FIX-4)            */
/* ============================================ */
@media (max-width: 768px) {
  /* Modal close (x) buttons — 44px minimum touch target */
  [id*="Modal"] button[onclick*="close"]:not(.btn),
  [id*="Modal"] button[style*="cursor:pointer"]:not(.btn),
  .rain-day-modal-close,
  .detail-close,
  .popover-close,
  .modal-close,
  .icon-btn.close {
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
    touch-action: manipulation;
  }

  /* Modal Cancel/Save/Upload action buttons — 44px minimum height */
  [id*="Modal"] div[style*="flex-end"] button,
  [id*="Modal"] div[style*="justify-content"] button,
  .modal-overlay .modal-footer .btn,
  .modal-footer-bar .btn,
  .rain-day-modal-footer .rd-submit {
    min-height: 44px !important;
    padding: 10px 18px !important;
    font-size: 1rem !important;
    touch-action: manipulation;
  }

  /* Small list action buttons (Edit/Delete/Remove) */
  .btn-sm {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    font-size: 0.85rem;
    touch-action: manipulation;
  }

  /* Quick Settings toggle — 44px minimum height */
  #quickSettingsToggle {
    min-height: 44px !important;
    touch-action: manipulation;
  }
}

/* ================================================================ */
/* OPS REPORTING VIEW (scoped under #opsReportingView)              */
/* ================================================================ */

#opsReportingView .or-content-area {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

/* Department Tabs */
#opsReportingView .or-dept-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow-x: auto;
}

#opsReportingView .or-dept-tab {
  flex: 1;
  min-width: 120px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 150ms ease;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

#opsReportingView .or-dept-tab:hover { background: var(--slate-50); color: var(--text-primary); }

#opsReportingView .or-dept-tab.active { color: white; font-weight: 600; }
#opsReportingView .or-dept-tab.active[data-dept="Lawn"] { background: var(--green-600); }
#opsReportingView .or-dept-tab.active[data-dept="Pest"] { background: var(--orange-500); }
#opsReportingView .or-dept-tab.active[data-dept="Tree Care"] { background: var(--teal-500); }
#opsReportingView .or-dept-tab.active[data-dept="Liquid/Soil"] { background: var(--blue-500); }

/* Filter Bar */
#opsReportingView .or-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

#opsReportingView .or-period-toggle {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 3px;
  box-shadow: var(--shadow-sm);
}

#opsReportingView .or-period-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 150ms ease;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

#opsReportingView .or-period-btn:hover { color: var(--text-primary); }
#opsReportingView .or-period-btn.active { background: var(--accent-green); color: white; }

#opsReportingView .or-filter-bar input[type="date"],
#opsReportingView .or-filter-bar select {
  padding: 7px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms ease;
}

#opsReportingView .or-filter-bar input[type="date"]:focus,
#opsReportingView .or-filter-bar select:focus {
  border-color: var(--accent-green);
}

#opsReportingView .or-apply-btn {
  padding: 7px 18px;
  background: var(--accent-green);
  color: white;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 150ms ease;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
#opsReportingView .or-apply-btn:hover { background: var(--accent-green-dark); }

/* Summary Cards */
#opsReportingView .or-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

#opsReportingView .or-summary-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 250ms ease;
}

#opsReportingView .or-summary-card:hover { box-shadow: var(--shadow-md); }

#opsReportingView .or-summary-card .or-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

#opsReportingView .or-summary-card .or-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

#opsReportingView .or-summary-card .or-card-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

#opsReportingView .or-summary-card .or-card-accent {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  margin-top: 12px;
}

/* Charts Grid */
#opsReportingView .or-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

#opsReportingView .or-chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

#opsReportingView .or-chart-card.wide { grid-column: span 2; }

#opsReportingView .or-chart-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

#opsReportingView .or-chart-wrap {
  position: relative;
  height: 280px;
}

#opsReportingView .or-chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* Bottom Grid (Leaderboard + MDR) */
#opsReportingView .or-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

#opsReportingView .or-bottom-grid.no-mdr { grid-template-columns: 1fr; }

#opsReportingView .or-section-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

#opsReportingView .or-section-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Leaderboard Table */
#opsReportingView .or-leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#opsReportingView .or-leaderboard-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-subtle);
}

#opsReportingView .or-leaderboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--text-primary);
}

#opsReportingView .or-leaderboard-table tr:last-child td { border-bottom: none; }

#opsReportingView .or-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

#opsReportingView .or-rank-1 { background: var(--yellow-100); color: #92400e; }
#opsReportingView .or-rank-2 { background: var(--slate-100); color: var(--slate-600); }
#opsReportingView .or-rank-3 { background: #fff7ed; color: #9a3412; }
#opsReportingView .or-rank-other { background: var(--slate-50); color: var(--slate-500); }

#opsReportingView .or-metric-highlight {
  font-weight: 700;
  font-size: 0.9rem;
}

/* MDR Stats */
#opsReportingView .or-mdr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#opsReportingView .or-mdr-stat {
  text-align: center;
  padding: 16px 12px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
}

#opsReportingView .or-mdr-stat .or-big-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

#opsReportingView .or-mdr-stat .or-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Empty State */
#opsReportingView .or-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

#opsReportingView .or-empty-state .or-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

#opsReportingView .or-empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

#opsReportingView .or-empty-state p {
  font-size: 0.85rem;
  max-width: 360px;
  margin: 0 auto;
}

/* Loading Overlay */
#opsReportingView .or-loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

#opsReportingView .or-loading-overlay.active { display: flex; }

#opsReportingView .or-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Skeleton Placeholders */
#opsReportingView .or-skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

#opsReportingView .or-skeleton-card { height: 120px; border-radius: var(--radius-lg); }
#opsReportingView .or-skeleton-chart { height: 280px; border-radius: var(--radius-lg); }

/* Employee Links */
#opsReportingView .employee-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-green);
  cursor: pointer;
  transition: all 150ms ease;
}
#opsReportingView .employee-link:hover {
  color: var(--accent-green-dark);
  border-bottom-style: solid;
}

/* Ops Reporting Responsive */
@media (max-width: 1024px) {
  #opsReportingView .or-summary-cards { grid-template-columns: repeat(2, 1fr); }
  #opsReportingView .or-charts-grid { grid-template-columns: 1fr; }
  #opsReportingView .or-chart-card.wide { grid-column: span 1; }
  #opsReportingView .or-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  #opsReportingView .or-summary-cards { grid-template-columns: 1fr; }
  #opsReportingView .or-dept-tabs { gap: 2px; padding: 3px; }
  #opsReportingView .or-dept-tab { min-width: 80px; padding: 8px 10px; font-size: 0.8rem; }
  #opsReportingView .or-filter-bar { gap: 8px; }
  #opsReportingView .or-filter-bar input[type="date"],
  #opsReportingView .or-filter-bar select { flex: 1; min-width: 0; }
  #opsReportingView .or-chart-wrap { height: 220px; }
  #opsReportingView .or-mdr-stats { grid-template-columns: 1fr; }
}


/* ================================================================ */
/* SUBMISSIONS VIEW (scoped under #submissionsView)                 */
/* ================================================================ */

/* View Management */
#submissionsView .sub-view { display: none; }
#submissionsView .sub-view.sub-active { display: block; }

/* List Header */
#submissionsView .sub-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

#submissionsView .sub-list-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

#submissionsView .sub-list-header .sub-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-left: 8px;
  font-weight: 400;
}

/* Filters Bar */
#submissionsView .sub-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

#submissionsView .sub-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

#submissionsView .sub-filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#submissionsView .sub-filter-group select,
#submissionsView .sub-filter-group input {
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: border-color 150ms ease;
}

#submissionsView .sub-filter-group select:focus,
#submissionsView .sub-filter-group input:focus {
  border-color: var(--accent-green);
}

#submissionsView .sub-filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

/* Submissions Table */
#submissionsView .sub-table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

#submissionsView .sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

#submissionsView .sub-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--slate-50);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

#submissionsView .sub-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-100);
  white-space: nowrap;
}

#submissionsView .sub-table tbody tr {
  cursor: pointer;
  transition: background 150ms ease;
}

#submissionsView .sub-table tbody tr:hover { background: var(--green-50); }
#submissionsView .sub-table tbody tr:last-child td { border-bottom: none; }

/* Form Type & Company Badges */
#submissionsView .sub-form-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

#submissionsView .sub-form-type-badge.sub-teod { background: var(--blue-100); color: var(--blue-600); }
#submissionsView .sub-form-type-badge.sub-mdr { background: var(--purple-100); color: var(--purple-500); }

#submissionsView .sub-company-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
}

#submissionsView .sub-company-badge.sub-rlc { background: var(--green-100); color: var(--green-700); }
#submissionsView .sub-company-badge.sub-gx { background: var(--teal-100); color: var(--teal-500); }

/* Pagination */
#submissionsView .sub-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#submissionsView .sub-pagination-controls {
  display: flex;
  gap: 4px;
}

/* Buttons (scoped) */
#submissionsView .sub-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 150ms ease;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

#submissionsView .sub-btn-primary { background: var(--accent-green); color: white; }
#submissionsView .sub-btn-primary:hover { background: var(--accent-green-dark); }

#submissionsView .sub-btn-secondary {
  background: var(--slate-100);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
#submissionsView .sub-btn-secondary:hover { background: var(--slate-200); }

#submissionsView .sub-btn-ghost { color: var(--text-secondary); padding: 6px 10px; background: none; }
#submissionsView .sub-btn-ghost:hover { background: var(--slate-100); color: var(--text-primary); }

#submissionsView .sub-btn-danger {
  background: var(--red-100);
  color: var(--red-600);
  border: 1px solid transparent;
}
#submissionsView .sub-btn-danger:hover { background: var(--red-500); color: white; }

#submissionsView .sub-btn-sm { padding: 4px 10px; font-size: 0.8rem; }
#submissionsView .sub-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Detail Header */
#submissionsView .sub-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

#submissionsView .sub-detail-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Detail Meta Cards — green-tinted bar */
#submissionsView .sub-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

#submissionsView .sub-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#submissionsView .sub-meta-item .sub-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green-700);
  margin-bottom: 2px;
}

#submissionsView .sub-meta-item .sub-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Section Cards */
#submissionsView .sub-section-card {
  background: var(--bg-card, white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

#submissionsView .sub-section-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--slate-50);
  color: var(--text-primary);
}

#submissionsView .sub-section-card-body {
  padding: 18px 20px;
}

/* Field Grid */
#submissionsView .sub-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

#submissionsView .sub-field-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#submissionsView .sub-field-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #64748b);
}

#submissionsView .sub-field-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

#submissionsView .sub-field-value.sub-computed { color: var(--blue-600); font-weight: 600; }
#submissionsView .sub-field-value.sub-empty { color: var(--text-muted, #94a3b8); font-style: italic; }

#submissionsView .sub-computed-tag {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--blue-500);
  text-transform: none;
  letter-spacing: 0;
}

/* JSON Key-Value Grid */
#submissionsView .sub-kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.85rem;
}
#submissionsView .sub-kv-key {
  color: var(--text-secondary, #64748b);
  font-weight: 500;
  white-space: nowrap;
}
#submissionsView .sub-kv-val {
  font-weight: 600;
  color: var(--text-primary);
}

/* Pill badges for arrays */
#submissionsView .sub-pill {
  display: inline-block;
  padding: 2px 10px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-lg);
  font-size: 0.8rem;
  color: var(--green-700);
  margin: 2px;
}

/* Bag Rate Status Badges */
#submissionsView .sub-bag-rate-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

#submissionsView .sub-bag-rate-status.optimal { background: var(--green-100); color: var(--green-700); }
#submissionsView .sub-bag-rate-status.heavy { background: var(--yellow-100); color: var(--yellow-600); }
#submissionsView .sub-bag-rate-status.very_heavy { background: var(--red-100); color: var(--red-600); }
#submissionsView .sub-bag-rate-status.light { background: var(--orange-100); color: var(--orange-500); }
#submissionsView .sub-bag-rate-status.very_light { background: var(--red-100); color: var(--red-600); }

/* Edit Banner (audit trail) */
#submissionsView .sub-edit-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: #854d0e;
  margin-bottom: 16px;
}
#submissionsView .sub-edit-banner::before { content: '\270F\FE0F'; }
#submissionsView .sub-edit-banner strong { font-weight: 700; }

#submissionsView .sub-edit-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

#submissionsView .sub-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#submissionsView .sub-edit-field label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

#submissionsView .sub-edit-field input,
#submissionsView .sub-edit-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: border-color 150ms ease;
}

#submissionsView .sub-edit-field input:focus,
#submissionsView .sub-edit-field textarea:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

#submissionsView .sub-edit-field input.sub-changed {
  border-color: var(--blue-500);
  background: var(--blue-100);
}

#submissionsView .sub-edit-field .sub-original-value {
  font-size: 0.7rem;
  color: var(--text-muted);
}

#submissionsView .sub-edit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

#submissionsView .sub-edit-reason-group { flex: 1; }

#submissionsView .sub-edit-reason-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

#submissionsView .sub-edit-reason-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

#submissionsView .sub-edit-reason-group input:focus {
  border-color: var(--accent-green);
}

/* Loading + Empty States */
#submissionsView .sub-loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

#submissionsView .sub-loading-state .sub-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

#submissionsView .sub-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

#submissionsView .sub-empty-state .sub-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* Employee Links */
#submissionsView .employee-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-green);
  cursor: pointer;
  transition: all 150ms ease;
}
#submissionsView .employee-link:hover {
  color: var(--accent-green-dark);
  border-bottom-style: solid;
}

/* Active Filter Badge */
#submissionsView .sub-active-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--green-700);
}

#submissionsView .sub-active-filter-badge .sub-clear-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-200);
  color: var(--green-700);
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 150ms ease;
}

#submissionsView .sub-active-filter-badge .sub-clear-filter:hover {
  background: var(--green-300);
}

/* Submissions Responsive */
@media (max-width: 768px) {
  #submissionsView .sub-filters-bar { flex-direction: column; }
  #submissionsView .sub-filter-group { min-width: 100%; }
  #submissionsView .sub-detail-meta { grid-template-columns: 1fr 1fr; padding: 14px 16px; }
  #submissionsView .sub-field-grid { grid-template-columns: 1fr 1fr; }
  #submissionsView .sub-edit-field-grid { grid-template-columns: 1fr; }
  #submissionsView .sub-list-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  #submissionsView .sub-detail-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  #submissionsView .sub-edit-actions { flex-direction: column; }
  #submissionsView .sub-edit-reason-group { width: 100%; }
  #submissionsView .sub-section-card-header { padding: 12px 14px; }
  #submissionsView .sub-section-card-body { padding: 14px; }
  #submissionsView .sub-edit-banner { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  #submissionsView .sub-detail-meta { grid-template-columns: 1fr; }
  #submissionsView .sub-field-grid { grid-template-columns: 1fr; }
  #submissionsView .sub-kv-grid { grid-template-columns: 1fr; gap: 2px 0; }
}

/* ================================================================ */
/* FIELD TOOLS LAUNCHER                                             */
/* ================================================================ */

.ft-department { margin-bottom: 32px; }

.department-header {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}
.ft-department:first-child .department-header { margin-top: 0; }

.ft-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* Active tool card */
.field-tool-card.active {
  background: white;
  border: 1px solid #e0e0e0;
  border-left: 4px solid var(--primary-green, #2d5a3d);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}
.field-tool-card.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Coming Soon card */
.field-tool-card.coming-soon {
  background: #fafafa;
  border: 1px dashed #d0d0d0;
  border-radius: 12px;
  padding: 24px;
  opacity: 0.75;
  cursor: default;
}

/* Card header */
.ft-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ft-card-icon { font-size: 1.4rem; }
.ft-card-code {
  font-family: 'Outfit', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted, #6b7280);
  letter-spacing: 0.5px;
}

/* Coming Soon badge */
.badge-coming-soon {
  display: inline-block;
  background: #f59e0b;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: auto;
}

.ft-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--text-primary, #111);
}
.ft-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  line-height: 1.5;
  margin: 0 0 16px 0;
}

/* Active card actions */
.ft-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ft-card-action {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.ft-action-primary {
  background: var(--primary-green, #2d5a3d);
  color: white;
}
.ft-action-primary:hover { background: #224a30; }
.ft-action-secondary {
  background: #f3f4f6;
  color: var(--text-primary, #374151);
}
.ft-action-secondary:hover { background: #e5e7eb; }

/* Coming Soon features */
.ft-card-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.ft-feature-tag {
  font-size: 0.72rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 6px;
}
.ft-card-target {
  font-size: 0.72rem;
  color: #9ca3af;
  font-style: italic;
}

/* My Work count badge */
.ft-count-badge {
  background: var(--primary-green, #2d5a3d);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Responsive: single column on mobile */
@media (max-width: 768px) {
  .ft-card-grid {
    grid-template-columns: 1fr;
  }
  .field-tool-card { padding: 18px; }
  .ft-card-actions { flex-direction: column; }
  .ft-card-action { width: 100%; justify-content: center; }
}

/* Dark mode */
[data-theme="dark"] .department-header {
  color: #9ca3af;
  border-bottom-color: #374151;
}
[data-theme="dark"] .field-tool-card.active {
  background: var(--card-bg, #1f2937);
  border-color: #374151;
  border-left-color: #4ade80;
}
[data-theme="dark"] .field-tool-card.active:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
[data-theme="dark"] .field-tool-card.coming-soon {
  background: var(--card-bg, #1f2937);
  border-color: #374151;
}
[data-theme="dark"] .ft-card-title { color: #e5e7eb; }
[data-theme="dark"] .ft-card-desc { color: #9ca3af; }
[data-theme="dark"] .ft-card-code { color: #9ca3af; }
[data-theme="dark"] .ft-action-secondary {
  background: #374151;
  color: #e5e7eb;
}
[data-theme="dark"] .ft-action-secondary:hover { background: #4b5563; }
[data-theme="dark"] .ft-feature-tag {
  background: #374151;
  color: #9ca3af;
}
[data-theme="dark"] .ft-card-target { color: #6b7280; }
[data-theme="dark"] .ft-count-badge { background: #4ade80; color: #111; }

/* ================================================================ */
/* ESTIMATES VIEW (scoped under #estimatesView)                     */
/* ================================================================ */

/* Stats Row */
#estimatesView .est-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

#estimatesView .est-stat-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 10px;
  padding: 18px 16px;
  text-align: center;
}

#estimatesView .est-stat-card.est-stat-green { border-left: 3px solid #16a34a; }
#estimatesView .est-stat-card.est-stat-amber { border-left: 3px solid #d97706; }

#estimatesView .est-stat-number {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary, #111);
  line-height: 1.1;
}

#estimatesView .est-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  margin-top: 4px;
}

#estimatesView .est-stat-sub {
  font-size: 0.72rem;
  opacity: 0.7;
}

/* Tabs */
#estimatesView .est-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-light, #e5e7eb);
  margin-bottom: 14px;
}

#estimatesView .est-tab {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

#estimatesView .est-tab:hover { color: var(--text-primary, #111); }

#estimatesView .est-tab.active {
  color: var(--primary-green, #2d5a3d);
  border-bottom-color: var(--primary-green, #2d5a3d);
}

/* Filter Bar */
#estimatesView .est-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 8px;
}

#estimatesView .est-filter-group { display: flex; flex-direction: column; gap: 3px; }
#estimatesView .est-filter-group label { font-size: 0.72rem; color: var(--text-muted, #6b7280); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
#estimatesView .est-filter-group select,
#estimatesView .est-filter-group input[type="date"] {
  padding: 6px 10px;
  font-size: 0.82rem;
  border: 1px solid var(--border-light, #d1d5db);
  border-radius: 6px;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #111);
}

#estimatesView .est-filter-actions { display: flex; gap: 6px; align-items: flex-end; }

/* Table */
#estimatesView .est-table-wrap {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
}

#estimatesView .est-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

#estimatesView .est-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6b7280);
  background: var(--bg-subtle, #f9fafb);
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}

#estimatesView .est-row {
  cursor: pointer;
  transition: background 0.12s;
}

#estimatesView .est-row:hover { background: var(--bg-subtle, #f9fafb); }
#estimatesView .est-row:not(:last-child) td { border-bottom: 1px solid var(--border-light, #f3f4f6); }

#estimatesView .est-row td { padding: 11px 14px; }
#estimatesView .est-cell-name { font-weight: 600; color: var(--text-primary, #111); }
#estimatesView .est-cell-num { color: var(--text-muted, #6b7280); font-size: 0.8rem; }
#estimatesView .est-cell-estimator { color: var(--text-secondary, #4b5563); font-size: 0.85rem; }
#estimatesView .est-cell-date { color: var(--text-secondary, #4b5563); font-size: 0.8rem; white-space: nowrap; }
#estimatesView .est-cell-gallons { font-weight: 600; }
#estimatesView .est-cell-programs { white-space: nowrap; }

/* Status Badges */
#estimatesView .est-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

#estimatesView .est-badge-gray   { background: #f3f4f6; color: #374151; }
#estimatesView .est-badge-blue   { background: #dbeafe; color: #1d4ed8; }
#estimatesView .est-badge-green  { background: #dcfce7; color: #166534; }
#estimatesView .est-badge-slate  { background: #e2e8f0; color: #334155; }
#estimatesView .est-badge-red    { background: #fee2e2; color: #991b1b; }

/* Program Badges */
#estimatesView .est-program-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  margin-right: 3px;
}

#estimatesView .est-no-programs { color: var(--text-muted, #9ca3af); }

/* Loading State */
#estimatesView .est-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--text-muted, #6b7280);
  font-size: 0.85rem;
}

#estimatesView .est-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-light, #e5e7eb);
  border-top-color: var(--primary-green, #2d5a3d);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Empty State */
#estimatesView .est-empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted, #6b7280);
  font-size: 0.9rem;
}

#estimatesView .est-empty-icon { font-size: 2.4rem; margin-bottom: 10px; }

/* Evaluations Placeholder */
#estimatesView .est-placeholder-card {
  text-align: center;
  padding: 64px 20px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 12px;
  margin-top: 10px;
}

#estimatesView .est-placeholder-icon { font-size: 3rem; margin-bottom: 12px; }
#estimatesView .est-placeholder-card h3 { font-size: 1.1rem; margin: 0 0 6px; color: var(--text-primary, #111); }
#estimatesView .est-placeholder-card p { font-size: 0.88rem; color: var(--text-muted, #6b7280); margin: 0; }

/* Responsive */
@media (max-width: 900px) {
  #estimatesView .est-stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  #estimatesView .est-stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  #estimatesView .est-stat-card { padding: 12px 10px; }
  #estimatesView .est-stat-number { font-size: 1.3rem; }

  #estimatesView .est-filter-bar { flex-direction: column; align-items: stretch; }
  #estimatesView .est-filter-group { width: 100%; }
  #estimatesView .est-filter-group select,
  #estimatesView .est-filter-group input[type="date"] { width: 100%; }

  /* Card layout on mobile instead of table */
  #estimatesView .est-table thead { display: none; }
  #estimatesView .est-table,
  #estimatesView .est-table tbody,
  #estimatesView .est-table tr,
  #estimatesView .est-table td { display: block; }

  #estimatesView .est-row {
    padding: 12px 14px;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--card-bg, #fff);
  }

  #estimatesView .est-row td {
    padding: 2px 0;
    border: none !important;
  }

  #estimatesView .est-cell-name { font-size: 0.95rem; margin-bottom: 2px; }
  #estimatesView .est-cell-status { margin-top: 6px; }

  #estimatesView .est-cell-num::before { content: '#'; }
  #estimatesView .est-cell-gallons::before { content: 'Gallons: '; font-weight: 400; color: var(--text-muted, #6b7280); }
  #estimatesView .est-cell-estimator::before { content: 'Estimator: '; font-weight: 400; color: var(--text-muted, #6b7280); }
}

/* Dark Mode Overrides */
[data-theme="dark"] #estimatesView .est-badge-gray   { background: #374151; color: #d1d5db; }
[data-theme="dark"] #estimatesView .est-badge-blue   { background: rgba(37,99,235,0.2); color: #93c5fd; }
[data-theme="dark"] #estimatesView .est-badge-green  { background: rgba(22,163,74,0.2); color: #86efac; }
[data-theme="dark"] #estimatesView .est-badge-slate  { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] #estimatesView .est-badge-red    { background: rgba(153,27,27,0.2); color: #fca5a5; }
[data-theme="dark"] #estimatesView .est-program-badge { background: rgba(22,101,52,0.2); color: #86efac; border-color: rgba(22,101,52,0.4); }
[data-theme="dark"] #estimatesView .est-stat-card.est-stat-green { border-left-color: #22c55e; }
[data-theme="dark"] #estimatesView .est-stat-card.est-stat-amber { border-left-color: #f59e0b; }

/* ================================================================ */
/* ESTIMATE DETAIL VIEW                                              */
/* ================================================================ */

#estimatesView .est-detail-header { margin-bottom: 16px; }

#estimatesView .est-back-btn {
  background: none; border: none;
  color: var(--primary-green, #2d5a3d);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; padding: 6px 0; margin-bottom: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  transition: opacity 0.15s;
}
#estimatesView .est-back-btn:hover { opacity: 0.7; }

#estimatesView .est-detail-title {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
#estimatesView .est-detail-title h2 {
  font-size: 1.4rem; font-weight: 700;
  color: var(--text-primary, #111); margin: 0;
}
#estimatesView .est-detail-custnum {
  font-size: 0.85rem; color: var(--text-muted, #6b7280); font-weight: 500;
}
#estimatesView .est-detail-brand {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 3px 8px; border-radius: 4px;
  background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0;
}
#estimatesView .est-detail-brand.greenx {
  background: #ecfdf5; color: #065f46; border-color: #a7f3d0;
}

/* Action Bar */
#estimatesView .est-detail-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px;
  padding: 12px 16px; background: var(--card-bg, #fff);
  border: 1px solid var(--border-light, #e5e7eb); border-radius: 10px;
}
#estimatesView .est-action-btn {
  padding: 8px 16px; font-size: 0.82rem; font-weight: 600;
  border: 1px solid var(--border-light, #d1d5db); border-radius: 6px;
  cursor: pointer; transition: all 0.15s;
  background: var(--card-bg, #fff); color: var(--text-primary, #333);
  min-height: 36px;
}
#estimatesView .est-action-btn:hover { background: var(--bg-subtle, #f9fafb); }
#estimatesView .est-action-btn.est-btn-blue { background: #2563eb; color: #fff; border-color: #2563eb; }
#estimatesView .est-action-btn.est-btn-blue:hover { background: #1d4ed8; }
#estimatesView .est-action-btn.est-btn-green { background: #16a34a; color: #fff; border-color: #16a34a; }
#estimatesView .est-action-btn.est-btn-green:hover { background: #15803d; }
#estimatesView .est-action-btn.est-btn-slate { background: #475569; color: #fff; border-color: #475569; }
#estimatesView .est-action-btn.est-btn-slate:hover { background: #334155; }
#estimatesView .est-action-btn.est-btn-red-outline { background: transparent; color: #dc2626; border-color: #dc2626; }
#estimatesView .est-action-btn.est-btn-red-outline:hover { background: #fef2f2; }
#estimatesView .est-action-spacer { flex: 1; min-width: 20px; }

/* Two-Column Detail Body */
#estimatesView .est-detail-body {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start;
}

/* Detail Cards */
#estimatesView .est-detail-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 10px; padding: 18px;
}
#estimatesView .est-detail-left > .est-detail-card + .est-detail-card,
#estimatesView .est-detail-right > .est-detail-card + .est-detail-card { margin-top: 16px; }

#estimatesView .est-detail-card h3 {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted, #6b7280);
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
}

/* Customer Info Rows */
#estimatesView .est-info-row {
  display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.85rem;
}
#estimatesView .est-info-label { color: var(--text-muted, #6b7280); font-weight: 500; }
#estimatesView .est-info-value {
  color: var(--text-primary, #111); font-weight: 600;
  text-align: right; max-width: 60%; word-break: break-word;
}

/* Inventory Items */
#estimatesView .est-inv-group-title {
  font-size: 0.76rem; font-weight: 700; text-transform: uppercase;
  color: var(--primary-green, #2d5a3d); margin: 12px 0 6px; letter-spacing: 0.03em;
}
#estimatesView .est-inv-group-title:first-child { margin-top: 0; }
#estimatesView .est-inv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; font-size: 0.84rem;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
}
#estimatesView .est-inv-item:last-child { border-bottom: none; }
#estimatesView .est-inv-qty { font-weight: 700; color: var(--primary-green, #2d5a3d); min-width: 28px; }
#estimatesView .est-inv-species { font-weight: 600; color: var(--text-primary, #111); }
#estimatesView .est-inv-meta { font-size: 0.78rem; color: var(--text-muted, #6b7280); }
#estimatesView .est-inv-flags { font-size: 0.82rem; }

/* Programs & Gallons */
#estimatesView .est-prog-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border-light, #f3f4f6);
}
#estimatesView .est-prog-row:last-child { border-bottom: none; }
#estimatesView .est-prog-name {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: 0.76rem; font-weight: 700;
  background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0;
}
#estimatesView .est-prog-gal { font-weight: 700; font-size: 0.9rem; color: var(--text-primary, #111); }
#estimatesView .est-total-row {
  display: flex; justify-content: space-between;
  padding: 10px 0 0; margin-top: 8px;
  border-top: 2px solid var(--border-light, #e5e7eb);
  font-weight: 700; font-size: 0.95rem; color: var(--text-primary, #111);
}

/* Pricing */
#estimatesView .est-price-row {
  display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.85rem;
}
#estimatesView .est-price-total {
  display: flex; justify-content: space-between;
  padding: 10px 0 0; margin-top: 8px;
  border-top: 2px solid var(--border-light, #e5e7eb);
  font-weight: 700; font-size: 1.1rem; color: var(--primary-green, #2d5a3d);
}

/* Notes */
#estimatesView .est-note-section { margin-bottom: 12px; }
#estimatesView .est-note-section:last-child { margin-bottom: 0; }
#estimatesView .est-note-label {
  font-size: 0.72rem; font-weight: 600; color: var(--text-muted, #6b7280);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
}
#estimatesView .est-note-text {
  font-size: 0.85rem; color: var(--text-primary, #111);
  white-space: pre-wrap; line-height: 1.5;
}

/* Audit Trail */
#estimatesView .est-audit-line {
  font-size: 0.82rem; color: var(--text-secondary, #4b5563); padding: 3px 0;
}
#estimatesView .est-no-data {
  font-size: 0.84rem; color: var(--text-muted, #9ca3af); font-style: italic; padding: 8px 0;
}

/* Detail Responsive */
@media (max-width: 900px) {
  #estimatesView .est-detail-body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  #estimatesView .est-detail-title h2 { font-size: 1.15rem; }
  #estimatesView .est-detail-actions { flex-direction: column; }
  #estimatesView .est-action-btn { width: 100%; text-align: center; }
  #estimatesView .est-action-spacer { display: none; }
}

/* Dark Mode — Detail */
[data-theme="dark"] #estimatesView .est-detail-brand { background: rgba(22,101,52,0.2); color: #86efac; border-color: rgba(22,101,52,0.4); }
[data-theme="dark"] #estimatesView .est-prog-name { background: rgba(22,101,52,0.2); color: #86efac; border-color: rgba(22,101,52,0.4); }
[data-theme="dark"] #estimatesView .est-price-total { color: #86efac; }
[data-theme="dark"] #estimatesView .est-inv-qty { color: #86efac; }
[data-theme="dark"] #estimatesView .est-inv-group-title { color: #86efac; }
[data-theme="dark"] #estimatesView .est-action-btn { background: var(--card-bg, #1f2937); color: var(--text-primary, #e5e7eb); border-color: var(--border-light, #374151); }

/* ================================================================ */
/* ESTIMATES DASHBOARD VIEW (R3)                                     */
/* ================================================================ */

/* Header */
#estimatesDashboardView .ed-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
#estimatesDashboardView .ed-header h1 {
  font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 700;
  color: var(--text-primary, #111); margin: 0;
}
#estimatesDashboardView .ed-subtitle {
  font-size: 0.85rem; color: var(--text-muted, #6b7280); margin: 2px 0 0;
}
#estimatesDashboardView .ed-header-right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
#estimatesDashboardView .ed-select {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-light, #e5e7eb);
  font-family: 'Outfit', sans-serif; font-size: 0.85rem;
  background: var(--card-bg, #fff); color: var(--text-primary, #111);
  cursor: pointer;
}
#estimatesDashboardView .ed-date-input {
  padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border-light, #e5e7eb);
  font-family: 'Outfit', sans-serif; font-size: 0.82rem;
  background: var(--card-bg, #fff); color: var(--text-primary, #111);
}
#estimatesDashboardView #ed-customDates {
  display: flex; gap: 6px; align-items: center;
}
#estimatesDashboardView .ed-print-btn {
  font-size: 0.82rem !important; padding: 5px 12px !important;
}

/* Filter Bar */
#estimatesDashboardView .ed-filter-bar {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 20px;
  background: var(--card-bg, #fff); border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04); border: 1px solid var(--border-light, #f3f4f6);
}
#estimatesDashboardView .ed-filter-group {
  display: flex; flex-direction: column; gap: 4px;
}
#estimatesDashboardView .ed-filter-group label {
  font-size: 0.72rem; font-weight: 600; color: var(--text-muted, #6b7280);
  text-transform: uppercase; letter-spacing: 0.04em;
}
#estimatesDashboardView .ed-filter-group select {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-light, #e5e7eb);
  font-family: 'Outfit', sans-serif; font-size: 0.85rem;
  background: var(--card-bg, #fff); color: var(--text-primary, #111);
}
#estimatesDashboardView .ed-reset-link {
  font-size: 0.82rem; color: var(--primary-green, #2d5a3d); cursor: pointer;
  text-decoration: underline; padding-bottom: 6px;
}

/* KPI Cards */
#estimatesDashboardView .ed-kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 24px;
}
#estimatesDashboardView .ed-kpi-card {
  background: var(--card-bg, #fff); border-radius: 12px;
  padding: 20px 24px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--border-light, #f3f4f6);
}
#estimatesDashboardView .ed-kpi-value {
  font-size: 2rem; font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--primary-green, #2d5a3d);
}
#estimatesDashboardView .ed-kpi-label {
  font-size: 0.85rem; color: var(--text-muted, #888);
  margin-top: 4px; font-family: 'Outfit', sans-serif;
}
#estimatesDashboardView .ed-kpi-sub {
  font-size: 0.75rem; color: var(--text-muted, #aaa); margin-top: 2px;
}
#estimatesDashboardView .ed-kpi-bar {
  height: 6px; background: var(--border-light, #e5e7eb); border-radius: 3px;
  margin-top: 8px; overflow: hidden;
}
#estimatesDashboardView .ed-kpi-bar-fill {
  height: 100%; border-radius: 3px; transition: width 0.4s ease;
}

/* Charts */
#estimatesDashboardView .ed-charts-row {
  display: grid; grid-template-columns: 2fr 3fr; gap: 16px;
  margin-bottom: 16px;
}
#estimatesDashboardView .ed-chart-card {
  background: var(--card-bg, #fff); border-radius: 12px;
  padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--border-light, #f3f4f6);
}
#estimatesDashboardView .ed-chart-card h3 {
  font-size: 1rem; font-weight: 600; color: var(--text-primary, #333);
  margin: 0 0 16px; font-family: 'Outfit', sans-serif;
}
#estimatesDashboardView .ed-chart-wrap {
  position: relative; height: 280px;
}
#estimatesDashboardView .ed-chart-wrap-wide {
  height: 220px;
}
#estimatesDashboardView .ed-chart-full {
  margin-bottom: 16px;
}

/* Activity Feed */
#estimatesDashboardView .ed-activity-card {
  background: var(--card-bg, #fff); border-radius: 12px;
  padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--border-light, #f3f4f6);
  margin-bottom: 16px;
}
#estimatesDashboardView .ed-activity-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
#estimatesDashboardView .ed-activity-header h3 {
  font-size: 1rem; font-weight: 600; color: var(--text-primary, #333);
  margin: 0; font-family: 'Outfit', sans-serif;
}
#estimatesDashboardView .ed-activity-count {
  font-size: 0.82rem; color: var(--text-muted, #888);
}
#estimatesDashboardView .ed-table-wrap {
  overflow-x: auto;
}
#estimatesDashboardView .ed-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
#estimatesDashboardView .ed-table th {
  text-align: left; padding: 8px 12px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted, #6b7280);
  border-bottom: 2px solid var(--border-light, #e5e7eb);
}
#estimatesDashboardView .ed-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-light, #f3f4f6);
  color: var(--text-primary, #111);
}
#estimatesDashboardView .ed-row:hover {
  background: var(--hover-bg, #f9fafb);
}

/* R9: Complaint Dashboard Section */
#estimatesDashboardView .ed-complaints-section { margin-top: 24px; }
#estimatesDashboardView .ed-section-header {
  font-family: 'Outfit', sans-serif; font-size: 1.05rem;
  font-weight: 600; color: var(--text-primary, #111);
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light, #e5e7eb);
}
#estimatesDashboardView .ed-complaint-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
#estimatesDashboardView .ed-complaint-card {
  background: var(--card-bg, #fff); border-radius: 10px;
  padding: 16px; text-align: center; border: 1px solid var(--border-light, #e5e7eb);
}
#estimatesDashboardView .ed-cc-value {
  font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 700; line-height: 1.1;
}
#estimatesDashboardView .ed-cc-label {
  font-size: 0.78rem; color: var(--text-muted, #6b7280); margin-top: 4px; font-weight: 500;
}
#estimatesDashboardView .ed-cc-total .ed-cc-value { color: var(--primary-green, #2d5a3d); }
#estimatesDashboardView .ed-cc-high { border-left: 3px solid #ef4444; }
#estimatesDashboardView .ed-cc-high .ed-cc-value { color: #ef4444; }
#estimatesDashboardView .ed-cc-medium { border-left: 3px solid #d97706; }
#estimatesDashboardView .ed-cc-medium .ed-cc-value { color: #d97706; }
#estimatesDashboardView .ed-cc-low { border-left: 3px solid #6b7280; }
#estimatesDashboardView .ed-cc-low .ed-cc-value { color: #6b7280; }
#estimatesDashboardView .ed-complaint-empty {
  background: var(--card-bg, #fff); border-radius: 10px; padding: 20px;
  text-align: center; border: 1px solid var(--border-light, #e5e7eb);
  color: var(--text-muted, #6b7280); font-size: 0.9rem; grid-column: 1 / -1;
}
#estimatesDashboardView .ed-complaint-empty-icon { margin-right: 8px; }
#estimatesDashboardView .ed-complaints-body {
  display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start;
}
#estimatesDashboardView .ed-complaint-subhead {
  font-family: 'Outfit', sans-serif; font-size: 0.82rem; font-weight: 600;
  color: var(--text-primary, #333); text-transform: uppercase;
  letter-spacing: 0.5px; margin: 0 0 10px; padding: 0; border: none;
}
#estimatesDashboardView .ed-complaint-categories {
  background: var(--card-bg, #fff); border-radius: 10px;
  padding: 14px; border: 1px solid var(--border-light, #e5e7eb);
}
#estimatesDashboardView .ed-cat-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 0.82rem;
}
#estimatesDashboardView .ed-cat-label {
  width: 90px; text-align: right; color: var(--text-muted, #555); flex-shrink: 0; font-weight: 500;
}
#estimatesDashboardView .ed-cat-bar-wrap {
  flex: 1; background: var(--bg-light, #f3f4f6); border-radius: 4px; height: 14px; overflow: hidden;
}
#estimatesDashboardView .ed-cat-bar {
  height: 100%; background: var(--primary-green, #2d5a3d); border-radius: 4px;
  min-width: 4px; transition: width 0.3s ease;
}
#estimatesDashboardView .ed-cat-count {
  width: 24px; text-align: right; font-weight: 600; color: var(--text-primary, #333); font-size: 0.8rem;
}
#estimatesDashboardView .ed-complaint-feed {
  background: var(--card-bg, #fff); border-radius: 10px;
  padding: 14px; border: 1px solid var(--border-light, #e5e7eb); overflow-x: auto;
}
#estimatesDashboardView .ed-complaint-table th { font-size: 0.7rem; }
#estimatesDashboardView .ed-complaint-row td { font-size: 0.82rem; padding: 8px 10px; }
#estimatesDashboardView .ed-complaint-customer { font-weight: 600; white-space: nowrap; }
#estimatesDashboardView .ed-complaint-issue {
  color: var(--text-muted, #555); max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
#estimatesDashboardView .ed-complaint-cats { font-size: 0.75rem; color: var(--text-muted, #888); }
#estimatesDashboardView .ed-risk-dot { font-size: 0.9rem; }
#estimatesDashboardView .ed-action-badge {
  display: inline-block; font-size: 0.7rem; padding: 2px 8px;
  border-radius: 10px; font-weight: 600; white-space: nowrap;
}
#estimatesDashboardView .ed-action-escalate-to-leadership { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; }
#estimatesDashboardView .ed-action-call-customer { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
#estimatesDashboardView .ed-action-schedule-reservice { background: #eff6ff; color: #3b82f6; border: 1px solid #bfdbfe; }
#estimatesDashboardView .ed-action-offer-discount { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
#estimatesDashboardView .ed-action-monitor { background: #f9fafb; color: #6b7280; border: 1px solid #e5e7eb; }

/* R9: Estimate Detail — Complaint Analysis Card */
#estimatesView .est-complaint-risk-badge {
  display: inline-block; font-size: 0.75rem; padding: 3px 10px;
  border-radius: 12px; font-weight: 600; font-family: 'Outfit', sans-serif;
}
#estimatesView .est-complaint-sentiment {
  font-style: italic; color: var(--text-muted, #555); margin: 10px 0;
  font-size: 0.88rem; line-height: 1.4; padding: 8px 12px;
  background: var(--bg-light, #f9fafb); border-radius: 8px;
  border-left: 3px solid var(--border-light, #d1d5db);
}
#estimatesView .est-complaint-list { margin: 12px 0; }
#estimatesView .est-complaint-item {
  padding: 8px 0; border-bottom: 1px solid var(--border-light, #f1f5f9);
}
#estimatesView .est-complaint-item:last-child { border-bottom: none; }
#estimatesView .est-complaint-item-text { font-size: 0.88rem; color: var(--text-primary, #333); margin-bottom: 4px; }
#estimatesView .est-complaint-item-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#estimatesView .est-complaint-cat-badge {
  display: inline-block; font-size: 0.7rem; padding: 1px 8px; border-radius: 8px;
  background: #f3f4f6; color: #6b7280; font-weight: 500; text-transform: capitalize;
}
#estimatesView .est-complaint-context { font-size: 0.78rem; color: var(--text-muted, #888); }
#estimatesView .est-complaint-action {
  font-size: 0.85rem; margin: 10px 0 6px; padding: 8px 12px;
  background: #fffbeb; border-radius: 8px; border: 1px solid #fde68a; color: #92400e;
}
#estimatesView .est-complaint-timestamp { font-size: 0.75rem; color: var(--text-muted, #aaa); margin-top: 8px; }
#estimatesView .est-reanalyze-btn { margin-top: 10px; font-size: 0.78rem; padding: 4px 12px; }

/* Responsive */
@media (max-width: 900px) {
  #estimatesDashboardView .ed-kpi-row { grid-template-columns: repeat(2, 1fr); }
  #estimatesDashboardView .ed-charts-row { grid-template-columns: 1fr; }
  #estimatesDashboardView .ed-header { flex-direction: column; }
  #estimatesDashboardView .ed-complaint-cards { grid-template-columns: repeat(2, 1fr); }
  #estimatesDashboardView .ed-complaints-body { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #estimatesDashboardView .ed-kpi-row { grid-template-columns: 1fr; }
  #estimatesDashboardView .ed-filter-bar { flex-direction: column; gap: 10px; }
  #estimatesDashboardView .ed-kpi-value { font-size: 1.6rem; }
  #estimatesDashboardView .ed-chart-wrap { height: 220px; }
  #estimatesDashboardView .ed-complaint-cards { grid-template-columns: 1fr 1fr; }
}

/* Print */
@media print {
  .portal-sidebar, .portal-nav, .mobile-header, .bottom-nav,
  #estimatesDashboardView .ed-filter-bar,
  #estimatesDashboardView .ed-header-right,
  #estimatesDashboardView #ed-loadMore { display: none !important; }
  #estimatesDashboardView { width: 100% !important; padding: 0 !important; }
  #estimatesDashboardView .ed-kpi-card,
  #estimatesDashboardView .ed-chart-card,
  #estimatesDashboardView .ed-activity-card { box-shadow: none; border: 1px solid #ddd; }
  #estimatesDashboardView canvas { max-width: 100% !important; }
}

/* Dark Mode */
[data-theme="dark"] #estimatesDashboardView .ed-kpi-card,
[data-theme="dark"] #estimatesDashboardView .ed-chart-card,
[data-theme="dark"] #estimatesDashboardView .ed-activity-card,
[data-theme="dark"] #estimatesDashboardView .ed-filter-bar {
  background: var(--card-bg, #1f2937);
  border-color: var(--border-light, #374151);
}
[data-theme="dark"] #estimatesDashboardView .ed-select,
[data-theme="dark"] #estimatesDashboardView .ed-filter-group select,
[data-theme="dark"] #estimatesDashboardView .ed-date-input {
  background: var(--card-bg, #1f2937); color: var(--text-primary, #e5e7eb);
  border-color: var(--border-light, #374151);
}
[data-theme="dark"] #estimatesDashboardView .ed-row:hover {
  background: rgba(255,255,255,0.05);
}
[data-theme="dark"] #estimatesDashboardView .ed-complaint-card,
[data-theme="dark"] #estimatesDashboardView .ed-complaint-categories,
[data-theme="dark"] #estimatesDashboardView .ed-complaint-feed,
[data-theme="dark"] #estimatesDashboardView .ed-complaint-empty {
  background: var(--card-bg, #1f2937); border-color: var(--border-light, #374151);
}
[data-theme="dark"] #estimatesView .est-complaint-sentiment {
  background: var(--card-bg, #1f2937); border-color: var(--border-light, #374151);
}
[data-theme="dark"] #estimatesView .est-complaint-cat-badge {
  background: #374151; color: #9ca3af;
}
[data-theme="dark"] #estimatesView .est-complaint-action {
  background: #3730241a; border-color: #92400e40; color: #fbbf24;
}

