:root {
  /* Brand Colors — aligned with the landing palette (single source of truth) */
  --primary: #1d4ed8;          /* Blue-700 — dimmed from bright blue-600 */
  --primary-deep: #1e3a8a;     /* Royal Blue */
  --primary-dark: #0c1e4a;     /* Deep Navy */
  --primary-active: #1e40af;   /* Blue-800 — deeper hover/active */
  --primary-light: #93c5fd;    /* Soft Azure */
  --primary-mist: #eff6ff;     /* Pale wash */

  /* Brand surface gradient (sidebar + hero/section panels). Deep navy with a
     restrained indigo lift — premium without the flat "bright blue" look. */
  --brand-surface-from: #0b1430;
  --brand-surface-mid:  #16244e;
  --brand-surface-to:   #213363;
  --accent: #1d4ed8;           /* Blue-700 */
  --accent-cyan: #06b6d4;
  --accent-violet: #7c3aed;

  /* Status Colors (Themed) */
  --success: #15803d;
  --success-bg: #f0fdf4;
  --warning: #b45309;
  --error: #be123c;

  /* UI Colors — flat slate background to match the landing (--ink-50) */
  --bg-main: #f8fafc;
  --bg-workspace: #f8fafc;
  --bg-primary-soft: rgba(29, 78, 216, 0.04);
  --border-themed: rgba(29, 78, 216, 0.08);
  --border-primary-soft: rgba(29, 78, 216, 0.1);
  --text-white: #ffffff;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  /* Readable font sizes */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
}

/* Base Tints & Utilities */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-primary { background-color: var(--primary) !important; }
.bg-primary-soft { background-color: var(--bg-primary-soft) !important; }
.border-primary { border-color: var(--primary) !important; }
.border-primary-soft { border-color: var(--border-primary-soft) !important; }

/* General & Layout Helpers */
[x-cloak] {
  display: none !important;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

.dashboard-workspace {
  background-color: var(--bg-workspace);
  min-height: 100vh;
}

.themed-card {
  background: var(--text-white);
  border: 1px solid var(--border-themed);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
  transition: all 0.3s ease;
}

.themed-card:hover {
  border-color: rgba(29, 78, 216, 0.2);
  box-shadow: 0 10px 15px -3px rgba(29, 78, 216, 0.05);
}

.themed-card-tint {
  background: rgba(29, 78, 216, 0.02) !important;
  border: 1px solid rgba(29, 78, 216, 0.05) !important;
}

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

::-webkit-scrollbar-track {
  background: var(--primary-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-active);
  border-radius: 4px;
}

/* Shared brand gradient. A deep, refined navy (rather than a flat bright blue)
   gives the sidebar and hero/section panels a more premium, less "default"
   feel; blue is kept as an accent only. Tune via the --brand-surface-* tokens. */
.brand-gradient {
  background: linear-gradient(160deg, var(--brand-surface-from) 0%, var(--brand-surface-mid) 55%, var(--brand-surface-to) 100%);
}
.brand-dots::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Sidebar Styles - Deep Royal Minimalist */
.sidebar-main-gradient {
  background: linear-gradient(160deg, var(--brand-surface-from) 0%, var(--brand-surface-mid) 60%, var(--brand-surface-to) 100%) !important;
}

.sidebar-header-area {
  position: relative;
  z-index: 30;
  background: rgba(0, 0, 0, 0.1) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-link {
  position: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-white);
  transition: all 0.2s ease;
  overflow: hidden;
  text-decoration: none;
  margin: 1px 6px;
  min-height: 36px;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-white);
}

.sidebar-link.active {
  background: var(--primary-active) !important;
  color: var(--text-white);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--primary-light);
  transition: all 0.2s ease;
  opacity: 0.85;
}

.sidebar-link.active .sidebar-icon {
  color: var(--text-white);
  opacity: 1;
}

.sidebar-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 3px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--primary-light);
  margin-top: 4px;
  opacity: 0.85;
  cursor: pointer;
  user-select: none;
  transition: opacity .15s;
}
.sidebar-section-label:hover { opacity: 1; }
.sidebar-section-label::after {
  content: "▾";
  font-size: 10px;
  margin-left: auto;
  transition: transform .2s;
  opacity: 0.6;
}
.sidebar-section-label.collapsed::after { transform: rotate(-90deg); }
.sidebar-section-body { overflow: hidden; transition: max-height .2s ease; max-height: 1500px; }
.sidebar-section-body.collapsed { max-height: 0; }

.sidebar-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 10px 6px;
}
.sidebar-collapse-all {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--primary-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity .15s, background .15s;
}
.sidebar-collapse-all:hover { opacity: 1; background: rgba(255,255,255,0.12); }

.sidebar-user-footer-gradient {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%), var(--primary-dark) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.user-avatar-gradient {
  background: var(--primary-active) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Auth Layout Animations */
@keyframes bg-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animate-bg-flow {
  background-size: 400% 400%;
  animation: bg-flow 15s ease infinite;
}

/* =============================================
   TOAST NOTIFICATION SYSTEM
   ============================================= */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
  width: calc(100vw - 40px);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  pointer-events: all;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.toast.toast-hiding {
  animation: toast-out 0.25s ease-in forwards;
}

.toast-success {
  background: rgba(240, 253, 244, 0.97);
  border-color: rgba(134, 239, 172, 0.4);
  color: #15803d;
}

.toast-error {
  background: rgba(255, 241, 242, 0.97);
  border-color: rgba(252, 165, 165, 0.4);
  color: #be123c;
}

.toast-info {
  background: rgba(239, 246, 255, 0.97);
  border-color: rgba(147, 197, 253, 0.4);
  color: var(--primary);
}

.toast-warning {
  background: rgba(255, 251, 235, 0.97);
  border-color: rgba(252, 211, 77, 0.4);
  color: #b45309;
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

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

.toast-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
  line-height: 1.45;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  opacity: 0.5;
  transition: opacity 0.15s;
  color: inherit;
  margin-top: -1px;
}

.toast-close:hover {
  opacity: 1;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 12px 12px;
  animation: toast-progress linear forwards;
  opacity: 0.5;
}

.toast-success .toast-progress { background: #22c55e; }
.toast-error .toast-progress { background: #f43f5e; }
.toast-info .toast-progress { background: var(--primary); }
.toast-warning .toast-progress { background: #f59e0b; }

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 120px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(24px) scale(0.94);
    max-height: 0;
    margin-bottom: -10px;
  }
}

@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Focus Improvements for Accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to content link for accessibility */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 8px;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-size: 12px;
  font-weight: 700;
  z-index: 10000;
  transition: top 0.2s;
}

.skip-to-content:focus {
  top: 0;
}

/* =============================================
   QUICK FILTER BADGES (Attendance / Tables)
   ============================================= */

.quick-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 32px;
}

.quick-filter-btn:hover {
  background: var(--bg-primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.quick-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* =============================================
   TABLE SCROLL HINT (mobile)
   ============================================= */

.table-scroll-wrapper {
  position: relative;
}

.table-scroll-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 32px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
  pointer-events: none;
  border-radius: 0 8px 8px 0;
}

@media (min-width: 768px) {
  .table-scroll-wrapper::after {
    display: none;
  }
}

/* =============================================
   STAT CARD IMPROVEMENTS
   ============================================= */

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.08);
  border-color: rgba(29, 78, 216, 0.2);
}

.stat-card-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.01em;
  margin-bottom: 3px;
}

.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.1;
}

/* =============================================
   FORM FILTER LABEL GROUP
   ============================================= */

.filter-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

/* =============================================
   TABLE HEADER READABILITY
   ============================================= */

/* Minimum 12px for all table column headers */
th {
  font-size: 12px !important;
}

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

/* Ensure modal dialogs are visually clear and accessible */
[role="dialog"] {
  outline: none;
}

/* Action button minimum touch targets */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border-radius: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* =============================================
   MOBILE TOUCH TARGETS
   ============================================= */

@media (max-width: 767px) {
  .sidebar-link {
    padding: 10px 10px;
    min-height: 44px;
  }

  /* Larger pagination buttons on mobile */
  .pagination-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* Larger quick-filter buttons on mobile */
  .quick-filter-btn {
    padding: 7px 12px;
    min-height: 40px;
    font-size: 12px;
  }

  /* Larger action buttons on mobile */
  .action-btn {
    min-width: 40px;
    min-height: 40px;
  }
}

/* =============================================
   PRINT STYLES
   ============================================= */

@media print {
  aside, header, footer, .no-print {
    display: none !important;
  }
  main {
    padding: 0 !important;
  }
  body {
    background: #fff !important;
  }
}

/* =============================================
   BRANCH SELECTOR (Select2) — dark sidebar theme
   ============================================= */

#branch-select-wrap .select2-container { width: 100% !important; }

/* The single-selection box defaults to a white background; scope to the wrapper
   (which always contains the generated container) so the override wins even if
   the branch-s2 container class isn't applied. */
#branch-select-wrap .select2-container--default .select2-selection--single {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
}
#branch-select-wrap .select2-container--default .select2-selection--single .select2-selection__rendered {
  background: transparent !important;
  color: #fff !important;
}

/* Closed control (containerCssClass='branch-s2' lands on .select2-container in 4.0.x) */
.select2-container--default.branch-s2 .select2-selection--single {
  height: 32px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0.5rem;
  transition: border-color .15s, background-color .15s;
}
.select2-container--default.branch-s2 .select2-selection--single:hover {
  border-color: rgba(255, 255, 255, 0.20);
}
.select2-container--default.branch-s2.select2-container--open .select2-selection--single {
  border-color: rgba(255, 255, 255, 0.30);
  background: rgba(255, 255, 255, 0.10);
}
.select2-container--default.branch-s2 .select2-selection__rendered {
  color: #fff;
  font-size: 0.75rem;
  line-height: 30px;
  padding-left: 0.625rem;
  padding-right: 1.5rem;
}
.select2-container--default.branch-s2 .select2-selection__placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.select2-container--default.branch-s2 .select2-selection__arrow {
  height: 30px;
  right: 4px;
}
.select2-container--default.branch-s2 .select2-selection__arrow b {
  border-color: rgba(255, 255, 255, 0.5) transparent transparent transparent;
}
.select2-container--default.branch-s2.select2-container--open .select2-selection__arrow b {
  border-color: transparent transparent rgba(255, 255, 255, 0.5) transparent;
}

/* Dropdown panel — force every layer dark so no default-white shows through */
.branch-s2-dropdown.select2-dropdown {
  background: #0c1e4a !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.branch-s2-dropdown .select2-results,
.branch-s2-dropdown .select2-results__options {
  background: #0c1e4a !important;
}
.branch-s2-dropdown .select2-search--dropdown {
  padding: 6px;
  background: #0c1e4a !important;
}
.branch-s2-dropdown .select2-search__field {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0.375rem;
  color: #fff;
  font-size: 0.75rem;
  padding: 5px 8px;
  outline: none;
}
.branch-s2-dropdown .select2-search__field::placeholder { color: rgba(255, 255, 255, 0.4); }
.branch-s2-dropdown .select2-results__option {
  background: transparent;          /* default rows inherit the dark panel */
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.75rem;
  padding: 6px 10px;
}
.branch-s2-dropdown .select2-results__option--highlighted {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #fff !important;
}
.branch-s2-dropdown .select2-results__option[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

/* =============================================================
   DARK MODE
   Toggled by adding `dark` to <html> (see LokuTheme in the layout).
   Strategy: remap the common neutral surface/text utilities used across
   the app so existing pages inherit a coherent dark theme without a
   per-page rewrite. Brand gradient panels keep their own colours.
   ============================================================= */
html { color-scheme: light; }
html.dark { color-scheme: dark; }

html.dark {
  --bg-main: #0b1220;
  --bg-workspace: #0b1220;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --border-themed: rgba(255, 255, 255, 0.08);
}

html.dark body { background-color: #0b1220; color: #e2e8f0; }

/* Card surfaces */
html.dark .themed-card,
html.dark .stat-card {
  background: #0f1b33;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
html.dark .themed-card:hover,
html.dark .stat-card:hover { border-color: rgba(147, 197, 253, 0.35); }
html.dark .themed-card-tint {
  background: rgba(255, 255, 255, 0.025) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Neutral Tailwind utilities remapped for content areas */
html.dark .bg-white { background-color: #0f1b33 !important; }
html.dark .bg-slate-50,
html.dark .bg-gray-50 { background-color: #0b1220 !important; }
html.dark .bg-slate-100,
html.dark .bg-gray-100 { background-color: #1e293b !important; }
html.dark .text-slate-900,
html.dark .text-slate-800 { color: #e8eef7 !important; }
html.dark .text-slate-700,
html.dark .text-slate-600 { color: #cbd5e1 !important; }
html.dark .text-slate-500,
html.dark .text-slate-400 { color: #94a3b8 !important; }
html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-gray-100,
html.dark .border-gray-200 { border-color: rgba(255, 255, 255, 0.08) !important; }
html.dark .divide-slate-50 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: rgba(255, 255, 255, 0.06) !important; }

/* Common arbitrary surface colours used in the header/search controls */
html.dark .bg-\[\#f1f5f9\] { background-color: #1e293b !important; }
html.dark .bg-\[\#f8fafc\] { background-color: #0b1220 !important; }
html.dark .border-\[\#bfdbfe\] { border-color: rgba(147, 197, 253, 0.25) !important; }

/* Form controls */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
  background-color: #0b1220;
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.12);
}

/* Brand panels keep light pills/buttons for contrast */
html.dark .brand-gradient .bg-white,
html.dark .auth-brand-panel .bg-white { background-color: #fff !important; }
html.dark .brand-gradient .text-slate-800,
html.dark .brand-gradient .text-slate-900 { color: inherit !important; }

/* Dampen the bright brand-blue gradients so they sit within the dark theme
   instead of glowing. Applies to the sidebar and the hero/organisation cards. */
html.dark .sidebar-main-gradient {
  background: linear-gradient(160deg, #0a1326 0%, #0d1b38 55%, #0f2042 100%) !important;
}
html.dark .sidebar-header-area { background: rgba(0, 0, 0, 0.25) !important; }
html.dark .brand-gradient {
  background: linear-gradient(160deg, #0c1730 0%, #13264c 55%, #16294f 100%) !important;
}
html.dark .brand-gradient,
html.dark .sidebar-main-gradient { box-shadow: none; }

/* Hover variants of the neutral surface utilities. Without these, hovering a
   header/menu item re-applied the light background while the text was already
   remapped to light — making it disappear. Keep hovers subtle and dark. */
html.dark .hover\:bg-white:hover { background-color: #16243f !important; }
html.dark .hover\:bg-slate-50:hover,
html.dark .hover\:bg-slate-50\/50:hover,
html.dark .hover\:bg-slate-50\/60:hover,
html.dark .hover\:bg-gray-50:hover,
html.dark .hover\:bg-\[\#f1f5f9\]:hover { background-color: rgba(255, 255, 255, 0.05) !important; }
html.dark .hover\:bg-slate-100:hover,
html.dark .hover\:bg-slate-100\/70:hover,
html.dark .hover\:bg-gray-100:hover { background-color: rgba(255, 255, 255, 0.08) !important; }

/* Pastel icon-tile backgrounds (used on KPI cards, quick-access tiles, list
   avatars). The light *-50/*-100 fills look washed-out on dark, so map them to
   a translucent tint of the same hue; the coloured icon/text stays readable. */
html.dark .bg-primary\/5  { background-color: rgba(147, 197, 253, 0.10) !important; }
html.dark .bg-amber-50,   html.dark .bg-amber-100   { background-color: rgba(180, 83, 9, 0.16) !important; }
html.dark .bg-rose-50,    html.dark .bg-rose-100    { background-color: rgba(190, 18, 60, 0.16) !important; }
html.dark .bg-emerald-50, html.dark .bg-emerald-100 { background-color: rgba(5, 150, 105, 0.16) !important; }
html.dark .bg-blue-50,    html.dark .bg-blue-100    { background-color: rgba(29, 78, 216, 0.16) !important; }
html.dark .bg-indigo-50,  html.dark .bg-indigo-100  { background-color: rgba(79, 70, 229, 0.16) !important; }
html.dark .bg-violet-50,  html.dark .bg-violet-100  { background-color: rgba(124, 58, 237, 0.16) !important; }

html.dark .border-primary\/10 { border-color: rgba(147, 197, 253, 0.20) !important; }
html.dark .border-amber-100,   html.dark .border-amber-200   { border-color: rgba(180, 83, 9, 0.30) !important; }
html.dark .border-rose-100,    html.dark .border-rose-200    { border-color: rgba(190, 18, 60, 0.30) !important; }
html.dark .border-emerald-100, html.dark .border-emerald-200 { border-color: rgba(5, 150, 105, 0.30) !important; }
html.dark .border-blue-100,    html.dark .border-blue-200    { border-color: rgba(29, 78, 216, 0.30) !important; }
html.dark .border-indigo-100,  html.dark .border-indigo-200  { border-color: rgba(79, 70, 229, 0.30) !important; }

/* =============================================================
   COMMAND PALETTE (Ctrl/Cmd + K)
   ============================================================= */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(8, 15, 30, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.cmdk-panel {
  width: 100%; max-width: 620px;
  background: #fff; border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 60px rgba(2, 8, 23, 0.35);
  overflow: hidden;
  animation: cmdk-in 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
html.dark .cmdk-panel { background: #0f1b33; border-color: rgba(255, 255, 255, 0.1); }
@keyframes cmdk-in { from { opacity: 0; transform: translateY(-8px) scale(0.99); } to { opacity: 1; transform: none; } }
.cmdk-search {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}
html.dark .cmdk-search { border-color: rgba(255, 255, 255, 0.08); }
.cmdk-search input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-size: 15px; color: inherit; padding: 0;
}
.cmdk-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.cmdk-group-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-subtle); padding: 10px 12px 4px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
}
.cmdk-item .cmdk-item-title { color: inherit; }
html.dark .cmdk-item { color: #cbd5e1; }
.cmdk-item.active { background: var(--bg-primary-soft); color: var(--primary); }
html.dark .cmdk-item.active { background: rgba(147, 197, 253, 0.12); color: #bfdbfe; }
.cmdk-item .cmdk-item-section { margin-left: auto; font-size: 10px; opacity: 0.55; font-weight: 600; }
.cmdk-empty { padding: 32px 16px; text-align: center; font-size: 13px; color: var(--text-subtle); }
.cmdk-footer {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 16px; border-top: 1px solid rgba(15, 23, 42, 0.07);
  font-size: 10.5px; color: var(--text-subtle);
}
html.dark .cmdk-footer { border-color: rgba(255, 255, 255, 0.08); }
.cmdk-kbd {
  font-family: inherit; font-size: 10px; font-weight: 700;
  border: 1px solid rgba(15, 23, 42, 0.15); border-radius: 5px;
  padding: 1px 5px; background: rgba(15, 23, 42, 0.03);
}
html.dark .cmdk-kbd { border-color: rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.05); }

/* =============================================================
   NOTIFICATION CENTER
   ============================================================= */
.notif-dot {
  position: absolute; top: 1px; right: 1px;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 999px; background: var(--error); color: #fff;
  font-size: 9px; font-weight: 800; line-height: 15px; text-align: center;
  border: 2px solid #fff;
}
html.dark .notif-dot { border-color: #0f1b33; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px;
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px; box-shadow: 0 16px 40px rgba(2, 8, 23, 0.18);
  z-index: 60; overflow: hidden;
}
html.dark .notif-panel { background: #0f1b33; border-color: rgba(255, 255, 255, 0.1); }
.notif-item {
  display: flex; gap: 11px; padding: 11px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
  text-decoration: none; transition: background 0.12s;
}
html.dark .notif-item { border-color: rgba(255, 255, 255, 0.06); }
.notif-item:hover { background: rgba(15, 23, 42, 0.025); }
html.dark .notif-item:hover { background: rgba(255, 255, 255, 0.04); }
.notif-ico {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.notif-ico.tone-amber { background: #fffbeb; color: #b45309; }
.notif-ico.tone-rose  { background: #fff1f2; color: #be123c; }
.notif-ico.tone-blue  { background: #eff6ff; color: #1d4ed8; }
html.dark .notif-ico.tone-amber { background: rgba(180, 83, 9, 0.15); color: #fcd34d; }
html.dark .notif-ico.tone-rose  { background: rgba(190, 18, 60, 0.15); color: #fda4af; }
html.dark .notif-ico.tone-blue  { background: rgba(29, 78, 216, 0.18); color: #93c5fd; }
