/* ============================================================================
   BookingPenguin - Custom Styles
   Note: Most styling uses Tailwind CSS via CDN. This file is for custom styles.
   ============================================================================ */

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

/* Base styles */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.animate-slideIn {
  animation: slideIn 0.3s ease-out;
}

.animate-pulse-custom {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Form focus states */
input:focus, select:focus, textarea:focus {
  outline: none;
}

/* Lighter placeholder text */
::placeholder {
  color: rgba(148, 163, 184, 0.4);
  opacity: 1;
}

/* Password toggle button */
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #94a3b8;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: #64748b;
}

.password-toggle:focus {
  outline: none;
}

.password-wrapper {
  position: relative;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Loading spinner */
.spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #2563eb;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Card hover effect */
.card-hover {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-hover:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

/* Status badge colors */
.badge-pending {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-assigned {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-accepted {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-completed {
  background-color: #dcfce7;
  color: #166534;
}

.badge-cancelled {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Sidebar navigation */
.nav-link {
  position: relative;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background-color: #f8fafc;
  color: #0f172a;
}

.nav-link.active {
  background-color: #f1f5f9;
  color: #0f172a;
  font-weight: 600;
}

/* Modal overlay */
.modal-overlay {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

/* Gradient background for auth pages */
.auth-gradient {
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
}

/* Logo text */
.logo-text {
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Divider with text */
.divider-with-text {
  display: flex;
  align-items: center;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

.divider-with-text::before,
.divider-with-text::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.divider-with-text::before {
  margin-right: 1rem;
}

.divider-with-text::after {
  margin-left: 1rem;
}

/* Responsive utilities */
@media (max-width: 768px) {
  .sidebar-mobile {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar-mobile.open {
    transform: translateX(0);
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
}

/* ============================================================================
   DARK MODE
   All dark mode overrides use html.dark selector to flip colors.
   This avoids touching any existing Tailwind classes in the HTML files.
   ============================================================================ */

/* ---- Smooth transition ---- */
body,
main, aside, nav, header, footer, section,
div, form, table, thead, tbody, tr, td, th,
input, select, textarea, button,
a, p, span, h1, h2, h3, h4, h5, h6, label, li, ul,
.nav-link, .card-hover, .modal-overlay {
  transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease;
}

/* ---- Theme toggle button ---- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: transparent;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-icon-light { display: none; }
.theme-icon-dark  { display: block; }

html.dark .theme-toggle {
  border-color: #475569;
  color: #94a3b8;
}
html.dark .theme-toggle:hover {
  background-color: #334155;
  color: #e2e8f0;
}
html.dark .theme-icon-light { display: block; }
html.dark .theme-icon-dark  { display: none; }

/* ============================================================
   BACKGROUNDS
   ============================================================ */

/* Page body / outermost backgrounds */
html.dark body {
  background-color: #0f172a;
  color: #e2e8f0;
}
html.dark .bg-white {
  background-color: #1e293b !important;
}

/* Page-level backgrounds (full-page, outermost containers) */
html.dark .bg-gray-50,
html.dark .bg-slate-50 {
  background-color: #0f172a !important;
}
html.dark .bg-arctic-white {
  background-color: #0f172a !important;
}

/* Element-level backgrounds (tabs, badges, sections inside cards) */
html.dark .bg-gray-100,
html.dark .bg-slate-100 {
  background-color: #334155 !important;
}

/* Secondary button/element backgrounds */
html.dark .bg-gray-200,
html.dark .bg-slate-200 {
  background-color: #334155 !important;
}
html.dark .bg-gray-300,
html.dark .bg-slate-300 {
  background-color: #475569 !important;
}

/* Tailwind's arbitrary value metric cards in admin/staff */
html.dark [class*="bg-[rgb(237,241,255)"] {
  background-color: #1e3a5f !important;
}
html.dark [class*="bg-[rgb(237"] {
  background-color: #1e3a5f !important;
}

/* Arctic blue landing sections */
html.dark .bg-arctic-blue {
  background-color: #0f172a !important;
}

/* Slightly lighter cards for nested elements */
html.dark .bg-slate-50\/50,
html.dark .bg-slate-50\/80 {
  background-color: #1e293b !important;
}

/* Input fields — recessed into cards for clear visual separation */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.dark select,
html.dark textarea {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
  border-width: 1px !important;
  border-style: solid !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
  color: rgba(148, 163, 184, 0.5) !important;
}

/* ============================================================
   TEXT
   ============================================================ */
html.dark .text-slate-900,
html.dark .text-gray-900 {
  color: #e2e8f0 !important;
}
html.dark .text-deep-charcoal {
  color: #e2e8f0 !important;
}
html.dark .text-slate-800,
html.dark .text-gray-800,
html.dark .text-slate-700,
html.dark .text-gray-700 {
  color: #cbd5e1 !important;
}

/* Colored 800-level text — lighten for dark backgrounds */
html.dark .text-red-800    { color: #fca5a5 !important; }
html.dark .text-green-800  { color: #6ee7b7 !important; }
html.dark .text-blue-800   { color: #93c5fd !important; }
html.dark .text-amber-800  { color: #fde68a !important; }
html.dark .text-purple-800 { color: #c4b5fd !important; }
html.dark .text-slate-600,
html.dark .text-gray-600 {
  color: #94a3b8 !important;
}
html.dark .text-slate-500,
html.dark .text-gray-500 {
  color: #64748b !important;
}
html.dark .text-slate-400,
html.dark .text-gray-400 {
  color: #94a3b8 !important;
}
html.dark .text-slate-300,
html.dark .text-gray-300 {
  color: #64748b !important;
}

/* ============================================================
   BORDERS
   ============================================================ */
html.dark .border-slate-50,
html.dark .border-gray-50,
html.dark .border-slate-100,
html.dark .border-gray-100,
html.dark .border-slate-200,
html.dark .border-gray-200,
html.dark .border-slate-100\/50 {
  border-color: #334155 !important;
}
html.dark .border-slate-300,
html.dark .border-gray-300 {
  border-color: #475569 !important;
}
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
  border-color: #334155 !important;
}

/* ============================================================
   SHADOWS
   ============================================================ */
html.dark .shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.3) !important;
}
html.dark .shadow-md,
html.dark .shadow {
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.35), 0 2px 4px -2px rgba(0,0,0,0.3) !important;
}
html.dark .shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3) !important;
}
html.dark .shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.4), 0 8px 10px -6px rgba(0,0,0,0.3) !important;
}

/* ============================================================
   SIDEBAR & NAVIGATION (Admin / Staff portals)
   ============================================================ */
html.dark .nav-link:hover {
  background-color: #253347;
  color: #e2e8f0;
}
html.dark .nav-link.active {
  background-color: #334155;
  color: #f1f5f9;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
html.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ============================================================
   SPINNER
   ============================================================ */
html.dark .spinner {
  border-color: #334155;
  border-top-color: #38bdf8;
}

/* ============================================================
   STATUS BADGES (keep colors but darken backgrounds slightly)
   ============================================================ */
html.dark .badge-pending  { background-color: #78350f; color: #fef3c7; }
html.dark .badge-assigned { background-color: #1e3a8a; color: #dbeafe; }
html.dark .badge-accepted { background-color: #064e3b; color: #d1fae5; }
html.dark .badge-completed{ background-color: #14532d; color: #dcfce7; }
html.dark .badge-cancelled{ background-color: #7f1d1d; color: #fee2e2; }

/* ============================================================
   DIVIDERS
   ============================================================ */
html.dark .divider-with-text { color: #64748b; }
html.dark .divider-with-text::before,
html.dark .divider-with-text::after { border-bottom-color: #334155; }

/* ============================================================
   PASSWORD TOGGLE
   ============================================================ */
html.dark .password-toggle { color: #64748b; }
html.dark .password-toggle:hover { color: #94a3b8; }

/* ============================================================
   MODAL OVERLAY
   ============================================================ */
html.dark .modal-overlay {
  background-color: rgba(0, 0, 0, 0.7);
}

/* ============================================================
   CARD HOVER
   ============================================================ */
html.dark .card-hover:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   AUTH PAGES — left panel gradient (login/signup)
   ============================================================ */
html.dark .left-panel-gradient {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
}
html.dark .glass-card {
  background: rgba(30,41,59,0.6) !important;
  border-color: rgba(71,85,105,0.5) !important;
}

/* ============================================================
   SUBSCRIBE PAGE — dark hero already dark, comparison table
   ============================================================ */
html.dark .compare-table tr {
  border-bottom-color: #334155;
}
html.dark .compare-table .pro-col {
  background: rgba(14,165,233,0.08);
}
html.dark .compare-table th {
  color: #94a3b8;
}

/* ============================================================
   MISC OVERRIDES — Colored Section Backgrounds
   ============================================================ */

/* 50-level alert/section backgrounds */
html.dark .bg-red-50      { background-color: rgba(127,29,29,0.2) !important; }
html.dark .bg-green-50    { background-color: rgba(6,78,59,0.2)  !important; }
html.dark .bg-blue-50     { background-color: rgba(30,58,138,0.2) !important; }
html.dark .bg-amber-50    { background-color: rgba(120,53,15,0.3) !important; }
html.dark .bg-emerald-50  { background-color: rgba(6,78,59,0.2) !important; }
html.dark .bg-yellow-50   { background-color: rgba(120,53,15,0.3) !important; }
html.dark .bg-orange-50   { background-color: rgba(154,52,18,0.2) !important; }
html.dark .bg-purple-100  { background-color: rgba(88,28,135,0.25) !important; }
html.dark .bg-purple-50   { background-color: rgba(88,28,135,0.2) !important; }
html.dark .bg-orange-50   { background-color: rgba(124,45,18,0.2) !important; }
html.dark .bg-indigo-50   { background-color: rgba(49,46,129,0.2) !important; }

/* 200-level borders */
html.dark .border-red-200      { border-color: rgba(127,29,29,0.5) !important; }
html.dark .border-green-200    { border-color: rgba(6,78,59,0.5) !important; }
html.dark .border-blue-200     { border-color: rgba(30,58,138,0.5) !important; }
html.dark .border-amber-200    { border-color: rgba(120,53,15,0.5) !important; }
html.dark .border-yellow-200   { border-color: rgba(120,53,15,0.5) !important; }
html.dark .border-orange-200   { border-color: rgba(154,52,18,0.5) !important; }
html.dark .border-purple-200   { border-color: rgba(88,28,135,0.5) !important; }
html.dark .border-orange-200   { border-color: rgba(124,45,18,0.5) !important; }

/* 100-level borders */
html.dark .border-green-100    { border-color: rgba(6,78,59,0.3) !important; }
html.dark .border-blue-100     { border-color: rgba(30,58,138,0.3) !important; }
html.dark .border-red-100      { border-color: rgba(127,29,29,0.3) !important; }

/* 300-level borders (used inside colored sections) */
html.dark .border-blue-300     { border-color: rgba(37,99,235,0.4) !important; }
html.dark .border-red-300      { border-color: rgba(239,68,68,0.4) !important; }
html.dark .border-green-300    { border-color: rgba(16,185,129,0.4) !important; }
html.dark .border-amber-300    { border-color: rgba(245,158,11,0.4) !important; }
html.dark .border-purple-300   { border-color: rgba(139,92,246,0.4) !important; }

/* 700-level text on colored backgrounds */
html.dark .text-red-700    { color: #fca5a5 !important; }
html.dark .text-green-700  { color: #6ee7b7 !important; }
html.dark .text-blue-700   { color: #93c5fd !important; }
html.dark .text-amber-700  { color: #fde68a !important; }
html.dark .text-yellow-700 { color: #fde68a !important; }
html.dark .text-orange-700 { color: #fdba74 !important; }
html.dark .text-purple-700 { color: #c4b5fd !important; }

/* ============================================================
   STATUS BADGES (100-level Tailwind backgrounds)
   ============================================================ */
html.dark .bg-red-100    { background-color: rgba(127,29,29,0.3) !important; }
html.dark .bg-yellow-100 { background-color: rgba(120,53,15,0.3) !important; }
html.dark .bg-blue-100   { background-color: rgba(30,58,138,0.3) !important; }
html.dark .bg-green-100  { background-color: rgba(6,78,59,0.3) !important; }
html.dark .bg-purple-100 { background-color: rgba(88,28,135,0.3) !important; }
html.dark .bg-orange-100 { background-color: rgba(124,45,18,0.3) !important; }

/* ============================================================
   DESTRUCTIVE & ACCENT TEXT COLORS
   ============================================================ */
html.dark .text-red-600    { color: #fca5a5 !important; }
html.dark .text-red-500    { color: #f87171 !important; }
html.dark .text-green-600  { color: #6ee7b7 !important; }
html.dark .text-blue-600   { color: #93c5fd !important; }
html.dark .text-purple-600 { color: #c4b5fd !important; }
html.dark .text-amber-600  { color: #fde68a !important; }
html.dark .text-orange-600 { color: #fdba74 !important; }

/* ============================================================
   HOVER STATE OVERRIDES
   ============================================================ */

/* Table & list hover */
html.dark tr { border-bottom-color: #334155; }
html.dark .hover\:bg-slate-50:hover  { background-color: #334155 !important; }
html.dark .hover\:bg-gray-50:hover   { background-color: #334155 !important; }
html.dark .hover\:bg-gray-100:hover  { background-color: #334155 !important; }
html.dark .hover\:bg-gray-200:hover  { background-color: #475569 !important; }
html.dark .hover\:bg-gray-300:hover  { background-color: #475569 !important; }
html.dark .hover\:bg-slate-200:hover { background-color: #475569 !important; }

/* Colored hover states */
html.dark .hover\:bg-red-50:hover    { background-color: rgba(127,29,29,0.2) !important; }
html.dark .hover\:bg-blue-50:hover   { background-color: rgba(30,58,138,0.2) !important; }
html.dark .hover\:bg-green-50:hover  { background-color: rgba(6,78,59,0.2) !important; }
html.dark .hover\:bg-blue-200:hover  { background-color: rgba(30,58,138,0.4) !important; }

/* Text hover states */
html.dark .hover\:text-gray-600:hover  { color: #e2e8f0 !important; }
html.dark .hover\:text-gray-900:hover  { color: #f1f5f9 !important; }
html.dark .hover\:text-slate-900:hover { color: #f1f5f9 !important; }

/* Button hover accent adjustments */
html.dark .hover\:bg-blue-700:hover { background-color: #1d4ed8 !important; }
html.dark .hover\:bg-red-700:hover  { background-color: #b91c1c !important; }

/* Landing page does not use dark mode */

/* Onboarding page */
html.dark .bg-arctic-blue { background-color: #0f172a !important; }

/* Booking form summary */
html.dark .bg-gradient-to-br.from-slate-50 { background: #1e293b !important; }

/* Subscription status card gradients */
html.dark .bg-gradient-to-r.from-slate-50.to-white,
html.dark .bg-gradient-to-r.from-slate-50.to-slate-100 {
  background: linear-gradient(to right, #1e293b 0%, #334155 100%) !important;
}

/* Subscription card icon background */
html.dark .bg-slate-200 { background-color: #334155 !important; }

/* Subscription plan cards - ensure proper dark styling */
html.dark .rounded-2xl.bg-white { background-color: #1e293b !important; }
html.dark .rounded-2xl.bg-white .text-slate-400 { color: #94a3b8 !important; }

/* ============================================================
   ICE-BLUE GRADIENT BUTTONS → Dark Blue/Black in Dark Mode
   Targets paywall button, subscribe page CTA buttons, etc.
   ============================================================ */
html.dark .from-sky-100,
html.dark [class*="from-sky-100"] {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0c4a6e 100%) !important;
  color: #e2e8f0 !important;
  border-color: #1e3a5f !important;
  box-shadow: 0 4px 15px -3px rgba(14,165,233,0.2), 0 2px 6px -2px rgba(0,0,0,0.3) !important;
}
html.dark .from-sky-100:hover,
html.dark [class*="from-sky-100"]:hover {
  background: linear-gradient(135deg, #1e293b 0%, #1e4976 50%, #0e5a85 100%) !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 8px 25px -5px rgba(14,165,233,0.3), 0 4px 10px -4px rgba(0,0,0,0.4) !important;
}

/* Starter/Premium plan buttons (bg-slate-100 on subscribe page) */
html.dark .btn-subscribe.bg-slate-100,
html.dark .btn-subscribe[class*="bg-slate-100"] {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border: 1px solid #334155 !important;
}
html.dark .btn-subscribe.bg-slate-100:hover,
html.dark .btn-subscribe[class*="bg-slate-100"]:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
}

/* ============================================================
   STRONGER INPUT OVERRIDES (settings, forms, etc.)
   Some pages use Tailwind @apply bg-white or inline bg-white
   ============================================================ */
html.dark .input-field,
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="number"],
html.dark input[type="tel"],
html.dark input[type="url"],
html.dark input[type="search"],
html.dark input[type="date"],
html.dark input[type="time"],
html.dark input[type="datetime-local"],
html.dark select,
html.dark textarea {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
  border-width: 1px !important;
  border-style: solid !important;
}
html.dark .input-field:focus,
html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: #0ea5e9 !important;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12) !important;
}

/* Tailwind ring utilities in dark mode */
html.dark .ring-1 {
  --tw-ring-color: #334155 !important;
}
html.dark .focus\:ring-blue-500:focus {
  --tw-ring-color: rgba(14,165,233,0.3) !important;
}

/* Settings tab buttons — bg-slate-100 and hover:bg-slate-200
   are now handled in BACKGROUNDS and HOVER STATE OVERRIDES above. */

/* Plan cards on subscribe page */
html.dark .plan-card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

/* ============================================================
   BUSINESS SWITCHER DROPDOWN
   ============================================================ */
/* Dropdown menu container */
html.dark #business-switcher-menu {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
/* Logo box beside company name */
html.dark .switcher-logo-box {
  background-color: #334155 !important;
  border-color: #475569 !important;
}
/* Hover state for switcher items */
html.dark #business-switcher-menu .hover\:bg-gray-50:hover {
  background-color: #334155 !important;
}
/* Active/current business highlight */
html.dark #business-switcher-menu .bg-blue-50 {
  background-color: rgba(30,58,138,0.3) !important;
}
/* Switcher dividers */
html.dark #business-switcher-menu .border-slate-50 {
  border-color: #334155 !important;
}

/* ============================================================
   WORK GALLERY
   ============================================================ */

/* Top bar */
.gallery-top-bar {
  margin-bottom: 1.5rem;
}
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.gallery-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: #1e293b;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.gallery-upload-btn:hover {
  background: #334155;
}
.gallery-upload-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filters */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.gallery-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.gallery-search-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
  pointer-events: none;
}
.gallery-search-input {
  width: 100%;
  padding: 0.5rem 0.5rem 0.5rem 2rem;
  font-size: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  color: #334155;
  outline: none;
  transition: border-color 0.15s;
}
.gallery-search-input:focus {
  border-color: #94a3b8;
}
.gallery-filter-select {
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  color: #334155;
  outline: none;
  cursor: pointer;
}

/* Photo grid - uniform cards */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Photo card */
.gallery-card {
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.gallery-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.gallery-card-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f1f5f9;
  line-height: 0;
}
.gallery-card-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.2s;
}
.gallery-card:hover .gallery-card-img {
  transform: scale(1.03);
}
.gallery-card-info {
  padding: 0.625rem 0.75rem;
}
.gallery-card-caption {
  font-size: 0.75rem;
  font-weight: 500;
  color: #334155;
  margin-bottom: 0.375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.gallery-card-uploader {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.625rem;
  color: #64748b;
}
.gallery-card-avatar {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 600;
  flex-shrink: 0;
}
.gallery-card-date {
  font-size: 0.625rem;
  color: #94a3b8;
  white-space: nowrap;
}
.gallery-card-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  color: #ef4444;
}
.gallery-card:hover .gallery-card-delete {
  opacity: 1;
}
.gallery-card-delete:hover {
  background: #fef2f2;
}

/* Empty state */
.gallery-empty {
  text-align: center;
  padding: 4rem 2rem;
}

/* ============================================================
   GALLERY MODALS (upload, lightbox, confirm)
   ============================================================ */

/* Shared backdrop */
.gallery-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Upload panel */
.gallery-upload-panel {
  background: #fff;
  border-radius: 1rem;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.gallery-upload-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
}
.gallery-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.375rem;
  transition: color 0.15s;
}
.gallery-modal-close:hover {
  color: #334155;
}
.gallery-upload-body {
  padding: 1.25rem;
}
.gallery-upload-footer {
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid #f1f5f9;
}
.gallery-upload-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Dropzone */
.gallery-dropzone {
  border: 2px dashed #e2e8f0;
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.gallery-dropzone:hover,
.gallery-dropzone-active {
  border-color: #94a3b8;
  background: #f8fafc;
}

/* Upload previews */
.gallery-upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.gallery-preview-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.5rem;
}
.gallery-preview-img-wrap {
  position: relative;
  border-radius: 0.375rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
  line-height: 0;
}
.gallery-preview-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.gallery-preview-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.gallery-preview-remove:hover {
  background: rgba(239,68,68,0.8);
}
.gallery-preview-caption {
  width: 100%;
  padding: 0.375rem 0.5rem;
  font-size: 0.625rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  background: #fff;
  outline: none;
}

/* Progress bar */
.gallery-upload-progress {
  margin-bottom: 0.75rem;
}
.gallery-progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.gallery-progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 3px;
  transition: width 0.3s;
  width: 0%;
}

/* Buttons */
.gallery-btn-secondary {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
}
.gallery-btn-secondary:hover {
  background: #e2e8f0;
}
.gallery-btn-danger {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
}
.gallery-btn-danger:hover {
  background: #dc2626;
}
.gallery-btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  background: #1e293b;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
}
.gallery-btn-secondary-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  cursor: pointer;
}

/* Confirm dialog */
.gallery-confirm-panel {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.25rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

/* ============================================================
   GALLERY LIGHTBOX
   ============================================================ */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
}
.gallery-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.gallery-lightbox-img-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  min-height: 300px;
  max-height: 70vh;
  overflow: hidden;
}
.gallery-lightbox-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
.gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  z-index: 2;
}
.gallery-lightbox-nav:hover {
  background: rgba(255,255,255,0.3);
}
.gallery-lightbox-prev { left: 0.75rem; }
.gallery-lightbox-next { right: 0.75rem; }

.gallery-lightbox-info {
  padding: 0.75rem 1rem;
  border-top: 1px solid #f1f5f9;
}
.gallery-lightbox-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}
.gallery-lightbox-caption {
  font-size: 0.8125rem;
  color: #334155;
  line-height: 1.5;
}
.gallery-lightbox-action {
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  background: #f1f5f9;
  border: none;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gallery-lightbox-action:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.gallery-lightbox-action-danger:hover {
  background: #fef2f2;
  color: #ef4444;
}

/* Caption edit */
.gallery-caption-edit {
  padding: 0.25rem 0;
}
.gallery-caption-input {
  width: 100%;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  outline: none;
  color: #334155;
}
.gallery-caption-input:focus {
  border-color: #94a3b8;
}

/* ============================================================
   GALLERY DARK MODE
   ============================================================ */

html.dark .gallery-card {
  background: #1e293b;
  border-color: #334155;
}
html.dark .gallery-card-caption {
  color: #e2e8f0;
}
html.dark .gallery-card-uploader {
  color: #94a3b8;
}
html.dark .gallery-card-date {
  color: #64748b;
}
html.dark .gallery-card-img-wrap {
  background: #0f172a;
}
html.dark .gallery-card-delete {
  background: rgba(30,41,59,0.9);
}
html.dark .gallery-card-delete:hover {
  background: rgba(127,29,29,0.5);
}

html.dark .gallery-search-input,
html.dark .gallery-filter-select {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #475569;
}
html.dark .gallery-search-input:focus,
html.dark .gallery-filter-select:focus {
  border-color: #0ea5e9;
}

html.dark .gallery-upload-panel,
html.dark .gallery-confirm-panel {
  background: #1e293b;
  border-color: #334155;
}
html.dark .gallery-upload-header {
  border-color: #334155;
}
html.dark .gallery-upload-footer {
  border-color: #334155;
}
html.dark .gallery-dropzone {
  border-color: #475569;
}
html.dark .gallery-dropzone:hover,
html.dark .gallery-dropzone-active {
  border-color: #64748b;
  background: #0f172a;
}
html.dark .gallery-preview-item {
  background: #0f172a;
  border-color: #334155;
}
html.dark .gallery-preview-caption {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}
html.dark .gallery-progress-bar {
  background: #334155;
}
html.dark .gallery-btn-secondary,
html.dark .gallery-btn-secondary-small {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}
html.dark .gallery-btn-secondary:hover,
html.dark .gallery-btn-secondary-small:hover {
  background: #475569;
}

html.dark .gallery-lightbox-content {
  background: #1e293b;
}
html.dark .gallery-lightbox-info {
  border-color: #334155;
}
html.dark .gallery-lightbox-caption {
  color: #e2e8f0;
}
html.dark .gallery-lightbox-action {
  background: #334155;
  color: #94a3b8;
}
html.dark .gallery-lightbox-action:hover {
  background: #475569;
  color: #e2e8f0;
}
html.dark .gallery-lightbox-action-danger:hover {
  background: rgba(127,29,29,0.4);
  color: #f87171;
}
html.dark .gallery-caption-input {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}
html.dark .gallery-caption-input:focus {
  border-color: #0ea5e9;
}

html.dark .gallery-empty h3 {
  color: #94a3b8;
}
html.dark .gallery-empty p {
  color: #64748b;
}

/* ───────────────────────────────────────────────────────────────────────────
   SEARCH COMMAND PALETTE
   ─────────────────────────────────────────────────────────────────────────── */

/* Dropdown container */
#search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 4px 10px -5px rgba(0, 0, 0, 0.04);
  max-height: 340px;
  overflow-y: auto;
  z-index: 100;
  padding: 4px 0;
}

#search-dropdown.hidden {
  display: none;
}

/* Scrollbar styling */
#search-dropdown::-webkit-scrollbar {
  width: 4px;
}
#search-dropdown::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
#search-dropdown::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Category labels */
.search-category-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 8px 12px 4px 12px;
  user-select: none;
}

/* Result item */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  border-radius: 6px;
  margin: 0 4px;
}
.search-result-item:hover,
.search-result-item.search-result-active {
  background-color: #f1f5f9;
}

/* Result icon */
.search-result-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #64748b;
}

/* Result label */
.search-result-label {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Category badge */
.search-result-badge {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Empty state */
.search-empty-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  color: #94a3b8;
  font-size: 12px;
}
.search-empty-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.5;
}

/* Ctrl+K hint on input */
#sidebar-search-wrap::after {
  content: 'Ctrl+K';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 600;
  color: #cbd5e1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
  line-height: 1.4;
}

/* Hide hint when input has value */
#sidebar-search-wrap.has-value::after {
  display: none;
}


/* ── Dark Mode ─────────────────────────────────────────────────────────── */

html.dark #search-dropdown {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 4px 10px -5px rgba(0, 0, 0, 0.2);
}
html.dark #search-dropdown::-webkit-scrollbar-thumb {
  background: #475569;
}
html.dark #search-dropdown::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

html.dark .search-category-label {
  color: #64748b;
}

html.dark .search-result-item:hover,
html.dark .search-result-item.search-result-active {
  background-color: #334155;
}

html.dark .search-result-icon {
  color: #94a3b8;
}

html.dark .search-result-label {
  color: #e2e8f0;
}

html.dark .search-result-badge {
  color: #64748b;
  background: #0f172a;
}

html.dark .search-empty-state {
  color: #64748b;
}

html.dark #sidebar-search-wrap::after {
  color: #475569;
  background: #0f172a;
  border-color: #334155;
}

/* ───────────────────────────────────────────────────────────────────────────
   AI BUSINESS ASSISTANT PANEL
   ─────────────────────────────────────────────────────────────────────────── */

/* Panel container */
.ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100vw;
  background: #ffffff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.06);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-panel-open {
  transform: translateX(0);
}

/* Panel overlay */
#ai-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9999;
  transition: opacity 0.2s ease;
}
#ai-panel-overlay.hidden {
  display: none;
}

/* Header */
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.ai-panel-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-panel-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0c4a6e;
  flex-shrink: 0;
}
.ai-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1.2;
}
.ai-panel-subtitle {
  font-size: 10px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.2;
}
.ai-panel-header-actions {
  display: flex;
  gap: 4px;
}
.ai-panel-action-btn {
  padding: 6px;
  border-radius: 6px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ai-panel-action-btn:hover {
  background: #f1f5f9;
  color: #475569;
}

/* Messages area */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-messages::-webkit-scrollbar {
  width: 4px;
}
.ai-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Welcome message */
.ai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 16px 16px;
  gap: 12px;
}
.ai-welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0c4a6e;
}
.ai-welcome-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.ai-welcome-text {
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
  max-width: 280px;
}
.ai-welcome-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}
.ai-suggestion {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.ai-suggestion:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
  color: #0369a1;
}

/* Message bubbles */
.ai-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: aiFadeIn 0.2s ease;
}
@keyframes aiFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-message-user {
  flex-direction: row-reverse;
}
.ai-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-msg-avatar-user {
  background: #1e293b;
  color: #ffffff;
}
.ai-msg-avatar-ai {
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  color: #0c4a6e;
}
.ai-msg-content {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.65;
  max-width: 80%;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ai-message-user .ai-msg-content {
  background: #1e293b;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.ai-message-ai .ai-msg-content {
  background: #f1f5f9;
  color: #334155;
  border-bottom-left-radius: 4px;
}

/* Typing indicator dots */
.ai-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px !important;
}
.ai-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: aiDotBounce 1.2s infinite ease-in-out;
}
.ai-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.ai-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes aiDotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Input area */
.ai-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px 4px 4px 14px;
  transition: border-color 0.15s ease;
}
.ai-input-wrap:focus-within {
  border-color: #7dd3fc;
}
.ai-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12px;
  line-height: 1.5;
  color: #334155;
  resize: none;
  outline: none;
  padding: 6px 0;
  min-height: 20px;
  max-height: 100px;
  font-family: inherit;
}
.ai-input::placeholder {
  color: #94a3b8;
}
.ai-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  color: #0c4a6e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}
.ai-send-btn:hover {
  opacity: 0.9;
}
.ai-send-btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ai-input-hint {
  display: flex;
  justify-content: space-between;
  padding: 4px 4px 0;
  font-size: 9px;
  color: #94a3b8;
}

/* Settings toggle */
.ai-settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}
.ai-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
  outline: none;
  border: none;
  flex-shrink: 0;
}
.ai-toggle-switch:checked {
  background: #6366f1;
}
.ai-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.ai-toggle-switch:checked::after {
  transform: translateX(16px);
}


/* ── Dark Mode ─────────────────────────────────────────────────────────── */

html.dark .ai-panel {
  background: #1e293b;
  border-color: #334155;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}
html.dark .ai-panel-header {
  border-color: #334155;
}
html.dark .ai-panel-title {
  color: #e2e8f0;
}
html.dark .ai-panel-action-btn:hover {
  background: #334155;
  color: #e2e8f0;
}
html.dark .ai-messages::-webkit-scrollbar-thumb {
  background: #475569;
}
html.dark .ai-welcome-title {
  color: #e2e8f0;
}
html.dark .ai-welcome-text {
  color: #94a3b8;
}
html.dark .ai-suggestion {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}
html.dark .ai-suggestion:hover {
  border-color: #6366f1;
  color: #a5b4fc;
  background: #1e293b;
}
html.dark .ai-message-user .ai-msg-content {
  background: #6366f1;
  color: #ffffff;
}
html.dark .ai-message-ai .ai-msg-content {
  background: #334155;
  color: #e2e8f0;
}
html.dark .ai-typing-dots span {
  background: #64748b;
}
html.dark .ai-input-area {
  border-color: #334155;
}
html.dark .ai-input-wrap {
  background: #0f172a;
  border-color: #334155;
}
html.dark .ai-input {
  color: #e2e8f0;
}
html.dark .ai-input::placeholder {
  color: #64748b;
}
html.dark .ai-toggle-switch {
  background: #475569;
}
html.dark .ai-toggle-switch:checked {
  background: #6366f1;
}
html.dark #ai-panel-overlay {
  background: rgba(0, 0, 0, 0.5);
}

/* Responsive: smaller screens */
@media (max-width: 480px) {
  .ai-panel {
    width: 100vw;
  }
}

/* ============================================================================
   ANALYTICS DASHBOARD
   ============================================================================ */

/* Header */
.an-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}
.an-header-left { display: flex; flex-direction: column; gap: 2px; }
.an-title { font-size: 20px; font-weight: 700; color: #0f172a; margin: 0; letter-spacing: -0.02em; }
.an-subtitle { font-size: 12px; color: #64748b; margin: 0; }
.an-header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.an-select {
  padding: 7px 30px 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  background: #fff;
  cursor: pointer;
  outline: none;
  appearance: auto;
}
.an-select:focus { border-color: #94a3b8; }
.an-custom-range { display: flex; align-items: center; gap: 6px; }
.an-date-input {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: #334155;
  background: #f8fafc;
  outline: none;
}
.an-date-sep { font-size: 11px; color: #94a3b8; }
.an-apply-btn {
  padding: 7px 14px;
  background: #0f172a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.an-apply-btn:hover { background: #1e293b; }
.an-refresh-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}
.an-refresh-btn:hover { background: #f1f5f9; color: #334155; }

/* Export Dropdown */
.an-export-wrap { position: relative; }
.an-export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.an-export-btn:hover { background: #f1f5f9; }
.an-export-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  z-index: 50;
  min-width: 180px;
  padding: 4px;
  animation: anFadeIn 0.15s ease;
}
.an-export-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}
.an-export-item:hover { background: #f1f5f9; }

/* Loader */
.an-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: #64748b;
  font-size: 13px;
}
.an-loader-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* KPI Strip */
.an-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.an-kpi-card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(226,232,240,0.6);
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.an-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.an-kpi-accent {
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.an-kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.an-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}
.an-kpi-change {
  font-size: 11px;
  color: #94a3b8;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.an-kpi-vs { color: #94a3b8; }
.an-trend-up { color: #10b981; display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.an-trend-down { color: #ef4444; display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }

/* Tab Navigation */
.an-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 20px;
  overflow-x: auto;
}
.an-tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.an-tab-btn:hover { color: #334155; }
.an-tab-btn.active {
  color: #2563eb;
  font-weight: 600;
  border-bottom-color: #2563eb;
}
.an-tab-content { animation: anFadeIn 0.25s ease; }
@keyframes anFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.an-card {
  background: #fff;
  border: 1px solid rgba(226,232,240,0.6);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  margin-bottom: 16px;
}
.an-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 14px 0;
}

/* Grids */
.an-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 0; }
.an-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.an-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }

/* Chart Container */
.an-chart-container { height: 260px; position: relative; }
.an-chart-lg { height: 320px; }

/* Mini KPI (used in sub-tabs) */
.an-kpi-mini {
  position: relative;
  background: #fff;
  border: 1px solid rgba(226,232,240,0.6);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  overflow: hidden;
}
.an-kpi-mini::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.an-kpi-mini-label {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.an-kpi-mini-value {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.01em;
}
.an-kpi-mini-text { font-size: 14px; }

/* Tables */
.an-table-wrap { overflow-x: auto; }
.an-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.an-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.an-table td {
  padding: 10px 12px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}
.an-table tbody tr:hover { background: #f8fafc; }
.an-table-total td { border-top: 2px solid #e2e8f0; background: #f8fafc; }

/* Badges */
.an-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}
.an-badge-completed { background: #dcfce7; color: #166534; }

/* Client cell */
.an-client-cell { display: flex; flex-direction: column; }
.an-client-name { font-weight: 600; color: #0f172a; }
.an-client-email { font-size: 11px; color: #94a3b8; }

/* Pagination */
.an-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  border-top: 1px solid #f1f5f9;
  margin-top: 8px;
}
.an-page-info { font-size: 11px; color: #94a3b8; }
.an-page-btns { display: flex; gap: 6px; }
.an-page-btn {
  padding: 5px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.an-page-btn:hover { background: #f1f5f9; }

/* Empty State */
.an-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  color: #94a3b8;
  font-size: 13px;
}

/* Staff Leaderboard */
.an-leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.an-leaderboard-row:last-child { border-bottom: none; }
.an-lb-rank { width: 36px; flex-shrink: 0; text-align: center; }
.an-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
}
.an-medal-gold { background: #fef3c7; color: #92400e; }
.an-medal-silver { background: #e2e8f0; color: #475569; }
.an-medal-bronze { background: #fed7aa; color: #9a3412; }
.an-lb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.an-lb-info { flex: 1; min-width: 0; }
.an-lb-name { font-size: 13px; font-weight: 600; color: #0f172a; }
.an-lb-stats { font-size: 11px; color: #94a3b8; margin-top: 1px; }
.an-lb-bar-wrap {
  width: 100px;
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.an-lb-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* AI Analyst Placeholder */
.an-ai-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 24px;
  border-radius: 16px;
  border: 1px solid rgba(186,230,253,0.5);
  background: linear-gradient(180deg, rgba(240,249,255,0.6) 0%, rgba(255,255,255,0) 100%);
  overflow: hidden;
}
.an-ai-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(125,211,252,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.an-ai-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  color: #0c4a6e;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  position: relative;
}
.an-ai-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  color: #0c4a6e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.an-ai-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
}
.an-ai-desc {
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
  max-width: 420px;
  margin: 0 0 24px 0;
}
.an-ai-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 380px;
}
.an-ai-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  text-align: left;
}
.an-ai-feature svg { color: #0ea5e9; flex-shrink: 0; }

/* ---- DARK MODE ---- */
html.dark .an-title { color: #e2e8f0; }
html.dark .an-subtitle { color: #94a3b8; }
html.dark .an-select { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html.dark .an-date-input { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html.dark .an-apply-btn { background: #e2e8f0; color: #0f172a; }
html.dark .an-refresh-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }
html.dark .an-refresh-btn:hover { background: #334155; color: #e2e8f0; }
html.dark .an-export-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark .an-export-btn:hover { background: #334155; }
html.dark .an-export-menu { background: #1e293b; border-color: #334155; box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
html.dark .an-export-item { color: #e2e8f0; }
html.dark .an-export-item:hover { background: #334155; }
html.dark .an-loader { color: #94a3b8; }
html.dark .an-loader-spinner { border-color: #334155; border-top-color: #2563eb; }
html.dark .an-kpi-card { background: #1e293b; border-color: #334155; }
html.dark .an-kpi-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
html.dark .an-kpi-label { color: #94a3b8; }
html.dark .an-kpi-value { color: #e2e8f0; }
html.dark .an-tabs { border-color: #334155; }
html.dark .an-tab-btn { color: #94a3b8; }
html.dark .an-tab-btn:hover { color: #e2e8f0; }
html.dark .an-tab-btn.active { color: #60a5fa; border-bottom-color: #60a5fa; }
html.dark .an-card { background: #1e293b; border-color: #334155; }
html.dark .an-card-title { color: #e2e8f0; }
html.dark .an-kpi-mini { background: #1e293b; border-color: #334155; }
html.dark .an-kpi-mini-label { color: #94a3b8; }
html.dark .an-kpi-mini-value { color: #e2e8f0; }
html.dark .an-table th { color: #94a3b8; border-color: #334155; }
html.dark .an-table td { color: #cbd5e1; border-color: rgba(51,65,85,0.5); }
html.dark .an-table tbody tr:hover { background: rgba(51,65,85,0.3); }
html.dark .an-table-total td { border-color: #475569; background: rgba(51,65,85,0.3); }
html.dark .an-badge-completed { background: rgba(22,163,74,0.15); color: #4ade80; }
html.dark .an-client-name { color: #e2e8f0; }
html.dark .an-pagination { border-color: #334155; }
html.dark .an-page-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark .an-page-btn:hover { background: #334155; }
html.dark .an-empty-state { color: #64748b; }
html.dark .an-leaderboard-row { border-color: rgba(51,65,85,0.5); }
html.dark .an-lb-name { color: #e2e8f0; }
html.dark .an-lb-bar-wrap { background: #334155; }
html.dark .an-medal { background: #334155; color: #94a3b8; }
html.dark .an-medal-gold { background: rgba(251,191,36,0.15); color: #fbbf24; }
html.dark .an-medal-silver { background: rgba(148,163,184,0.15); color: #94a3b8; }
html.dark .an-medal-bronze { background: rgba(251,146,60,0.15); color: #fb923c; }
html.dark .an-ai-placeholder { border-color: rgba(125,211,252,0.2); background: linear-gradient(180deg, rgba(14,165,233,0.05) 0%, rgba(30,41,59,0) 100%); }
html.dark .an-ai-title { color: #e2e8f0; }
html.dark .an-ai-desc { color: #94a3b8; }
html.dark .an-ai-feature { background: #1e293b; border-color: #334155; color: #cbd5e1; }

/* ---- LEARNING & MODULES DARK MODE ---- */

/* Card base */
html.dark .learning-category {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

/* Category header band (all gradient variants) */
html.dark .learning-category [class*="bg-gradient-to-r"] {
  background: linear-gradient(to right, #1e3a5f 0%, #1e293b 100%) !important;
  border-color: #334155 !important;
}
/* Category title and sub-count text inside header band */
html.dark .learning-category [class*="bg-gradient-to-r"] h3,
html.dark .learning-category [class*="bg-gradient-to-r"] p {
  color: #e2e8f0 !important;
}
/* Icon circles in the category header */
html.dark .learning-category [class*="bg-gradient-to-r"] [class*="bg-emerald-100"],
html.dark .learning-category [class*="bg-gradient-to-r"] [class*="bg-blue-100"],
html.dark .learning-category [class*="bg-gradient-to-r"] [class*="bg-purple-100"],
html.dark .learning-category [class*="bg-gradient-to-r"] [class*="bg-orange-100"],
html.dark .learning-category [class*="bg-gradient-to-r"] [class*="bg-rose-100"],
html.dark .learning-category [class*="bg-gradient-to-r"] [class*="bg-cyan-100"],
html.dark .learning-category [class*="bg-gradient-to-r"] [class*="bg-indigo-100"] {
  background-color: rgba(255,255,255,0.12) !important;
}
html.dark .learning-category [class*="bg-gradient-to-r"] svg {
  color: #93c5fd !important;
}

/* Module row hover */
html.dark .learning-module:hover {
  background-color: #334155 !important;
}
/* Module title */
html.dark .learning-module .font-medium.text-gray-900,
html.dark .learning-module p.font-medium {
  color: #e2e8f0 !important;
}
/* Module description */
html.dark .learning-module .text-gray-500,
html.dark .learning-module p.text-gray-500 {
  color: #94a3b8 !important;
}
/* Module read-time */
html.dark .learning-module .text-gray-400,
html.dark .learning-module p.text-gray-400 {
  color: #64748b !important;
}

/* Module number/icon badge (inside cards) */
html.dark .learning-module [class*="bg-emerald-100"],
html.dark .learning-module [class*="bg-blue-100"],
html.dark .learning-module [class*="bg-purple-100"],
html.dark .learning-module [class*="bg-orange-100"],
html.dark .learning-module [class*="bg-rose-100"],
html.dark .learning-module [class*="bg-cyan-100"],
html.dark .learning-module [class*="bg-indigo-100"] {
  background-color: #334155 !important;
}
html.dark .learning-module svg {
  color: #93c5fd !important;
}

/* "Coming Soon" badge — replace amber with indigo/slate */
html.dark .learning-module .bg-amber-100 {
  background-color: #312e81 !important;
}
html.dark .learning-module .text-amber-700 {
  color: #a5b4fc !important;
}

/* Search input */
html.dark #learning-search-input {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html.dark #learning-search-input::placeholder {
  color: #64748b !important;
}

/* ---- CLIENTS PAGE — "Unregistered" BADGE DARK MODE ---- */
html.dark #section-clients .bg-amber-100 {
  background-color: #1e3a5f !important;
}
html.dark #section-clients .text-amber-700 {
  color: #93c5fd !important;
}

/* ---- STAFF PAYMENTS PAGE DARK MODE ---- */

/* Page title */
html.dark #section-payments > h2 {
  color: #e2e8f0 !important;
}

/* ── Summary KPI Cards ── */
/* Unpaid (orange) card */
html.dark #section-payments .bg-orange-50 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
html.dark #section-payments .text-orange-600 {
  color: #fb923c !important;
}
/* Awaiting (blue) card */
html.dark #section-payments .bg-blue-50 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
html.dark #section-payments .text-blue-600 {
  color: #60a5fa !important;
}
/* Paid (green) card */
html.dark #section-payments .bg-green-50 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
html.dark #section-payments .text-green-600 {
  color: #4ade80 !important;
}
/* All Time (slate) card */
html.dark #section-payments .bg-slate-50:not(.payment-filter-btn) {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
html.dark #section-payments .text-slate-700 {
  color: #cbd5e1 !important;
}
/* Admin Revenue (purple) card */
html.dark #section-payments .bg-purple-50 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
html.dark #section-payments .text-purple-600 {
  color: #a78bfa !important;
}
/* Shared KPI label & sublabel colors */
html.dark #section-payments .text-slate-500 {
  color: #94a3b8 !important;
}
html.dark #section-payments .text-slate-400 {
  color: #64748b !important;
}
html.dark #section-payments .border-slate-100\/50 {
  border-color: #334155 !important;
}

/* ── Filter Tab Buttons ── */
html.dark #section-payments .payment-filter-btn {
  background-color: #334155 !important;
  color: #94a3b8 !important;
}
html.dark #section-payments .payment-filter-btn.active {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

/* ── Admin Revenue Collapsible Section ── */
html.dark #company-revenue-section {
  background-color: rgba(139, 92, 246, 0.08) !important;
  border-color: #334155 !important;
}
html.dark #company-revenue-section h4 {
  color: #c4b5fd !important;
}
html.dark #company-revenue-section .text-purple-600,
html.dark #company-revenue-section .text-purple-700 {
  color: #a78bfa !important;
}
/* Revenue list item cards */
html.dark #company-revenue-list .bg-white {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
html.dark #company-revenue-list .text-gray-900 {
  color: #e2e8f0 !important;
}
html.dark #company-revenue-list .text-gray-600 {
  color: #94a3b8 !important;
}
html.dark #company-revenue-list .text-gray-500 {
  color: #64748b !important;
}

/* ── Payments List Container ── */
html.dark #section-payments > .bg-white {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
html.dark #section-payments .divide-slate-50 > div {
  border-color: #334155 !important;
}

/* Payment row hover */
html.dark #payments-list > div:hover {
  background-color: #334155 !important;
}
/* Staff name & amount */
html.dark #payments-list .text-gray-900 {
  color: #e2e8f0 !important;
}
/* Service name */
html.dark #payments-list .text-gray-600 {
  color: #94a3b8 !important;
}
/* Date, rate, created text */
html.dark #payments-list .text-gray-500 {
  color: #64748b !important;
}

/* Status badges in dark mode */
html.dark #payments-list .bg-orange-100 {
  background-color: rgba(251, 146, 60, 0.15) !important;
}
html.dark #payments-list .text-orange-700 {
  color: #fb923c !important;
}
html.dark #payments-list .bg-blue-100 {
  background-color: rgba(96, 165, 250, 0.15) !important;
}
html.dark #payments-list .text-blue-700 {
  color: #60a5fa !important;
}
html.dark #payments-list .bg-green-100 {
  background-color: rgba(74, 222, 128, 0.15) !important;
}
html.dark #payments-list .text-green-700 {
  color: #4ade80 !important;
}

/* "Mark Paid" button */
html.dark #payments-list .bg-green-600 {
  background-color: #16a34a !important;
}

/* Loading & empty state */
html.dark #payments-loading .text-slate-600 {
  color: #94a3b8 !important;
}
html.dark #payments-empty .text-slate-600 {
  color: #94a3b8 !important;
}
html.dark #payments-empty .text-slate-400 {
  color: #64748b !important;
}

/* ---- SERVICE FORM TOGGLE SWITCH DARK MODE ---- */
/* Off state: visible dark slate track */
html.dark #section-forms input.peer + div {
  background-color: #475569 !important;
  border: 1px solid #64748b;
}
/* On state: bright blue with glow so users can clearly see it's active */
html.dark #section-forms input.peer:checked + div {
  background-color: #3b82f6 !important;
  border-color: #60a5fa;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5), 0 0 2px rgba(59, 130, 246, 0.3);
}
/* Knob visibility in dark mode */
html.dark #section-forms input.peer + div::after {
  border-color: #64748b !important;
}
html.dark #section-forms input.peer:checked + div::after {
  border-color: white !important;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .an-kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .an-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .an-kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .an-grid-2 { grid-template-columns: 1fr; }
  .an-grid-3 { grid-template-columns: 1fr; }
  .an-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .an-header { flex-direction: column; align-items: flex-start; }
  .an-header-right { width: 100%; flex-wrap: wrap; }
  .an-lb-bar-wrap { display: none; }
}
@media (max-width: 480px) {
  .an-kpi-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .an-grid-4 { grid-template-columns: 1fr; }
  .an-kpi-value { font-size: 18px; }
  .an-tabs { gap: 0; }
  .an-tab-btn { padding: 8px 12px; font-size: 12px; }
}
