/* ═══════════════════════════════════════════════════════════════
   Merlin Public Data — Neumorphic Design System (index.css)
   Ported from La Forge's index.css for Jinja2 + Tailwind CDN.
   Central source of truth for all component styles.
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Background — deep teal-black, the Merlin brand base */
  --color-background: #051218;
  --color-foreground: #EAEDF0;

  /* Primary - Gold (warmer, better contrast) */
  --color-primary: #F5C542;
  --color-primary-foreground: #0A0E14;

  /* Secondary - Blue (lighter for dark bg readability) */
  --color-secondary: #4F7FFF;
  --color-secondary-foreground: #EAEDF0;

  /* Accent (Gold) */
  --color-accent: #F5C542;
  --color-accent-foreground: #0A0E14;

  /* Tertiary - Teal (brighter, signals AI/system intelligence) */
  --color-tertiary: #14B8A6;
  --color-tertiary-foreground: #EAEDF0;

  /* Card — opaque surface with teal undertone */
  --color-card: #0C1E24;
  --color-card-foreground: #EAEDF0;

  /* Supporting Colors */
  --color-muted: #132028;
  --color-muted-foreground: #6B7280;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-ring: #F5C542;
  --color-destructive: #ef4444;
  --color-destructive-foreground: #EAEDF0;
  --color-surface: #ffffff;

  /* Surface tiers — opaque elevation steps */
  --color-surface-1: #0F2229;
  --color-surface-2: #142930;

  /* Status colors */
  --color-status-success: #34d399;
  --color-status-warning: #fbbf24;
  --color-status-info: #60a5fa;
  --color-status-danger: #f87171;

  /* Elevation shadows — clean single-direction */
  --shadow-neu-flat: 0 1px 3px rgba(0,0,0,0.24), 0 1px 2px rgba(0,0,0,0.18);
  --shadow-neu-hover: 0 4px 12px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.18);
  --shadow-neu-pressed: inset 0 1px 3px rgba(0,0,0,0.3);
  --shadow-neu-inset: inset 0 1px 2px rgba(0,0,0,0.2);
  --shadow-app-bar: 0 1px 0 rgba(255,255,255,0.06);
  --shadow-surface-lg: 0 24px 80px rgba(0,0,0,0.4);
  --shadow-surface-md: 0 8px 24px rgba(0,0,0,0.3);

  /* Glass compositing — RGB channel tokens */
  --glass-base: 17 24 32;
  --glass-deep: 10 14 20;
  --glass-border: 255 255 255;
  --glass-teal: 20 184 166;
  --primary-rgb: 245, 197, 66;

  /* Border Radius — tighter, more modern */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-app: 0.625rem;
  --radius-button: 0.5rem;
  --radius-input: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE
   ═══════════════════════════════════════════════════════════════ */
html.light {
  color-scheme: light;
  --color-background: #ebe4da;
  --color-foreground: #2d2a26;
  --color-primary: #cf6a20;
  --color-primary-foreground: #ffffff;
  --color-secondary: #295EE6;
  --color-secondary-foreground: #ffffff;
  --color-accent: #D97706;
  --color-accent-foreground: #ffffff;
  --color-tertiary: #0d9488;
  --color-tertiary-foreground: #ffffff;
  --color-card: #EDE7DD;
  --color-card-foreground: #2d2a26;
  --color-muted: #e0d9cf;
  --color-muted-foreground: #6b6560;
  --color-border: rgba(0, 0, 0, 0.10);
  --color-ring: #D97706;
  --color-destructive: #dc2626;
  --color-destructive-foreground: #ffffff;
  --color-surface: #1a2831;
  --color-surface-1: #F0EBE3;
  --color-surface-2: #E8E1D7;

  --color-status-success: #059669;
  --color-status-warning: #d97706;
  --color-status-info: #2563eb;
  --color-status-danger: #dc2626;

  /* Standard elevation shadows — no neumorphism */
  --neu-shadow-dark: rgba(0, 0, 0, 0.06);
  --neu-shadow-light: rgba(0, 0, 0, 0.03);
  --shadow-neu-flat: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-neu-hover: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-neu-pressed: inset 0 1px 3px rgba(0,0,0,0.1);
  --shadow-neu-inset: inset 0 1px 2px rgba(0,0,0,0.08);
  --shadow-app-bar: 0 1px 0 rgba(0,0,0,0.06);
  --shadow-surface-lg: 0 24px 80px rgba(0,0,0,0.1);
  --shadow-surface-md: 0 8px 24px rgba(0,0,0,0.08);

  --primary-rgb: 217, 119, 6;

  /* Glass compositing — light mode */
  --glass-base: 240 235 228;
  --glass-deep: 230 224 216;
}

html.light body {
  background: var(--color-background) !important;
  color: var(--color-foreground);
}

/* ═══════════════════════════════════════════════════════════════
   GLASS CARD — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
.glass-card {
  background: var(--color-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-app);
  box-shadow: var(--shadow-neu-flat);
  transition: all 0.2s ease;
}

html.light .glass-card {
  background: var(--color-card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-neu-flat);
}

/* Glass Transparent (sidebar, topbar) */
.glass-transparent {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-app);
}
html.light .glass-transparent {
  background: rgba(235, 228, 218, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Glass utility — removed per Precision Glass 2026 */
.glass {
  background: var(--color-card);
}

/* Modal glass card */
.modal-backdrop .glass-card {
  background: var(--color-card);
}
html.light .modal-backdrop .glass-card {
  background: var(--color-card);
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS — Neumorphic Glass
   ═══════════════════════════════════════════════════════════════ */

/* Primary Button — Gold tint */
.btn-primary {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-height: 2.75rem;
  border-radius: var(--radius-button);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.15s ease;
  background: rgba(var(--primary-rgb), 0.12);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
@media (min-width: 768px) {
  .btn-primary { padding: 0.5rem 1rem; min-height: 2.5rem; font-size: 0.875rem; }
}
.btn-primary:hover {
  transform: translateY(-1px);
  background: rgba(var(--primary-rgb), 0.18);
  border-color: rgba(var(--primary-rgb), 0.35);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-primary::before { display: none; }
.btn-primary:hover::before { display: none; }

html.light .btn-primary {
  background: rgba(var(--primary-rgb), 0.1);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  color: #92400e;
  box-shadow: var(--shadow-neu-flat);
}
html.light .btn-primary:hover {
  background: rgba(var(--primary-rgb), 0.16);
  border-color: rgba(var(--primary-rgb), 0.3);
  box-shadow: var(--shadow-neu-hover);
}
html.light .btn-primary:active {
  box-shadow: var(--shadow-neu-pressed);
}

/* Accent Button — Solid Gold CTA */
.btn-accent {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-height: 2.75rem;
  border-radius: var(--radius-button);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.15s ease;
  background: var(--color-primary);
  border: none;
  color: var(--color-primary-foreground);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
@media (min-width: 768px) {
  .btn-accent { padding: 0.5rem 1rem; min-height: 2.5rem; font-size: 0.875rem; }
}
.btn-accent:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
}
.btn-accent:active {
  transform: scale(0.98);
  filter: brightness(0.95);
  box-shadow: 0 1px 4px rgba(var(--primary-rgb), 0.2);
}
.btn-accent::before { display: none; }
.btn-accent:hover::before { display: none; }

html.light .btn-accent {
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}
html.light .btn-accent:hover {
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.4);
}

/* Secondary Button — Blue ghost */
.btn-secondary {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-height: 2.75rem;
  border-radius: var(--radius-button);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.15s ease;
  background: rgba(79, 127, 255, 0.1);
  border: 1px solid rgba(79, 127, 255, 0.2);
  color: var(--color-secondary);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
@media (min-width: 768px) {
  .btn-secondary { padding: 0.5rem 1rem; min-height: 2.5rem; font-size: 0.875rem; }
}
.btn-secondary:hover {
  transform: translateY(-1px);
  background: rgba(79, 127, 255, 0.16);
  border-color: rgba(79, 127, 255, 0.3);
}
.btn-secondary:active { transform: scale(0.98); }
.btn-secondary::before { display: none; }
.btn-secondary:hover::before { display: none; }

html.light .btn-secondary {
  background: rgba(41, 94, 230, 0.08);
  border: 1px solid rgba(41, 94, 230, 0.15);
  color: #1d4ed8;
  box-shadow: none;
}
html.light .btn-secondary:hover {
  background: rgba(41, 94, 230, 0.14);
  border-color: rgba(41, 94, 230, 0.25);
}

/* Glass Button — ghost style */
.btn-glass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-button);
  font-weight: 500;
  transition: all 0.15s ease;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-foreground);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
@media (min-width: 768px) {
  .btn-glass { padding: 0.5rem 1rem; min-height: 2.5rem; font-size: 0.875rem; }
}
.btn-glass:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
}
.btn-glass:active { transform: scale(0.98); }

html.light .btn-glass {
  background: var(--color-card);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--color-foreground);
  font-weight: 600;
  box-shadow: var(--shadow-neu-flat);
}
html.light .btn-glass:hover {
  background: var(--color-card);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: var(--shadow-neu-hover);
}
html.light .btn-glass:active { box-shadow: var(--shadow-neu-pressed); }

/* Destructive Button — Red ghost */
.btn-destructive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-button);
  font-weight: 600;
  transition: all 0.15s ease;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  cursor: pointer;
  font-family: inherit;
}
@media (min-width: 768px) {
  .btn-destructive { padding: 0.5rem 1rem; min-height: 2.5rem; font-size: 0.875rem; }
}
.btn-destructive:hover {
  transform: translateY(-1px);
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-destructive:active { transform: scale(0.98); }

html.light .btn-destructive {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.15);
  color: #b91c1c;
  box-shadow: none;
}
html.light .btn-destructive:hover {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.25);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--color-muted-foreground);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--color-foreground); }
html.light .btn-ghost:hover { background: rgba(0, 0, 0, 0.04); }

/* Icon-Only Button — clean */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  min-height: 2.75rem;
  min-width: 2.75rem;
  border-radius: var(--radius-button);
  transition: all 0.15s ease;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-muted-foreground);
  cursor: pointer;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-foreground);
}
.btn-icon:active { transform: scale(0.95); }

html.light .btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-muted-foreground);
}
html.light .btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-foreground);
}
html.light .btn-icon:active {
  background: rgba(0, 0, 0, 0.08);
}

/* Small button variant */
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; min-height: 36px; }

/* ═══════════════════════════════════════════════════════════════
   INPUTS — Neumorphic Carved
   ═══════════════════════════════════════════════════════════════ */
.input-glass {
  background: var(--color-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-input);
  padding: 0.75rem 1rem;
  min-height: 3rem;
  font-size: 1rem;
  color: var(--color-foreground);
  transition: all 0.15s ease;
  outline: none;
  width: 100%;
  font-family: 'Geist', system-ui, sans-serif;
  box-shadow: var(--shadow-neu-inset);
}
@media (min-width: 1024px) {
  .input-glass { padding: 0.625rem 1rem; min-height: auto; }
}
.input-glass:focus {
  border-color: rgba(var(--primary-rgb), 0.4);
  box-shadow: var(--shadow-neu-inset), 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}
.input-glass::placeholder { color: rgba(156, 163, 175, 0.6); }
.input-glass:disabled { opacity: 0.5; cursor: not-allowed; }

html.light .input-glass {
  background: var(--color-card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--color-foreground);
  box-shadow: var(--shadow-neu-inset);
}
html.light .input-glass:focus {
  border-color: rgba(var(--primary-rgb), 0.3);
  box-shadow: var(--shadow-neu-inset), 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}
html.light .input-glass::placeholder { color: rgba(45, 42, 38, 0.45); }

/* Select Glass (dropdown) */
.select-glass {
  background: var(--color-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-input);
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  min-height: 3rem;
  width: 100%;
  font-size: 1rem;
  color: var(--color-foreground);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-neu-inset);
  font-family: inherit;
}
.select-glass:focus {
  border-color: rgba(var(--primary-rgb), 0.4);
  box-shadow: var(--shadow-neu-inset), 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}
html.light .select-glass {
  background-color: var(--color-card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--color-foreground);
  box-shadow: var(--shadow-neu-inset);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b6560' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* ═══════════════════════════════════════════════════════════════
   TABS — Segmented Glass / Pill
   ═══════════════════════════════════════════════════════════════ */

/* Segmented Tabs Container */
.tabs-glass {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: var(--radius-button);
  background: var(--color-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-neu-inset);
  overflow-x: auto;
}
html.light .tabs-glass {
  background: rgba(240, 235, 228, 0.6);
  border: none;
  box-shadow: var(--shadow-neu-inset);
}

/* Tab Button (inactive) */
.tabs-glass-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  min-height: 2.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  color: color-mix(in srgb, var(--color-foreground) 55%, transparent);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
}
@media (min-width: 640px) {
  .tabs-glass-tab { gap: 0.5rem; padding: 0.5rem 1rem; min-height: 2.5rem; font-size: 0.875rem; }
}
.tabs-glass-tab:hover:not(.tabs-glass-tab-active):not(:disabled) {
  color: var(--color-foreground);
  background: color-mix(in srgb, var(--color-card) 40%, transparent);
}
.tabs-glass-tab-active {
  background: var(--color-card);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--color-foreground);
  font-weight: 600;
  box-shadow: var(--shadow-neu-flat);
}
html.light .tabs-glass-tab-active {
  background: rgba(240, 235, 228, 0.85);
  border-color: transparent;
  color: var(--color-foreground);
  font-weight: 600;
  box-shadow: var(--shadow-neu-flat);
}

/* Pill Tab */
.pill-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  min-height: 2rem;
  border-radius: 9999px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.pill-tab:hover {
  color: var(--color-foreground);
  background: rgba(255, 255, 255, 0.04);
}
.pill-tab.pill-tab-active {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--color-primary);
  border-color: rgba(var(--primary-rgb), 0.25);
  font-weight: 600;
}
.pill-tab:active { transform: scale(0.95); }

html.light .pill-tab {
  background: transparent;
  border-color: transparent;
  color: var(--color-muted-foreground);
}
html.light .pill-tab:hover { background: rgba(0, 0, 0, 0.04); color: var(--color-foreground); }
html.light .pill-tab.pill-tab-active {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: rgba(var(--primary-rgb), 0.2);
  color: var(--color-primary);
  box-shadow: var(--shadow-neu-flat);
}

/* ═══════════════════════════════════════════════════════════════
   DATE / PERIOD BUTTONS — Neumorphic
   (Previously inline in fdi.html / publications.html)
   ═══════════════════════════════════════════════════════════════ */
.date-mode-btn,
.period-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.625rem;
  min-height: 1.75rem;
  border-radius: var(--radius-button);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-muted-foreground);
  font-family: inherit;
}
.date-mode-btn:hover:not(.active),
.period-btn:hover:not(.active) {
  color: var(--color-foreground);
  background: rgba(255, 255, 255, 0.04);
}
.date-mode-btn.active,
.period-btn.active {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(var(--primary-rgb), 0.25);
  font-weight: 600;
}

html.light .date-mode-btn,
html.light .period-btn {
  background: transparent;
  border-color: transparent;
}
html.light .date-mode-btn.active,
html.light .period-btn.active {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--color-primary);
  border-color: rgba(var(--primary-rgb), 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   FILTER TAB — Admin pages
   ═══════════════════════════════════════════════════════════════ */
.filter-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  min-height: 2rem;
  border-radius: var(--radius-button);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-muted-foreground);
  font-family: inherit;
}
.filter-tab.active {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--color-primary);
  border-color: rgba(var(--primary-rgb), 0.25);
  font-weight: 600;
}
html.light .filter-tab {
  background: transparent;
  border-color: transparent;
}
html.light .filter-tab.active {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--color-primary);
  border-color: rgba(var(--primary-rgb), 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   DATA TABLE — Neumorphic
   (Previously inline in control-tower, admin-users, admin-costs)
   ═══════════════════════════════════════════════════════════════ */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  position: relative;
}
@media (max-width: 767px) {
  .table-container::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(var(--glass-deep), 0.8), transparent);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
  }
  .table-container.scrolled-right::after { opacity: 0; }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: var(--color-background);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted-foreground);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(var(--glass-border), 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .data-table th { font-size: 11px; padding: 12px 16px; }
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(var(--glass-border), 0.04);
  font-size: 12px;
}
@media (min-width: 768px) {
  .data-table td { padding: 12px 16px; font-size: 13px; }
}
.data-table tr:hover {
  background-color: color-mix(in srgb, var(--color-surface) 3%, transparent);
}
.data-table tr.selected {
  background-color: rgba(var(--primary-rgb), 0.08);
}
.data-table tr.issue-row {
  background-color: rgba(239, 68, 68, 0.04);
}
.data-table tr.issue-row:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

html.light .data-table th {
  background: var(--color-background);
  color: var(--color-muted-foreground);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
html.light .data-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
html.light .data-table tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* ═══════════════════════════════════════════════════════════════
   CHECKBOXES — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
input[type="checkbox"].neu-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  background: var(--color-background);
  border: none;
  box-shadow: var(--shadow-neu-inset);
}
input[type="checkbox"].neu-checkbox:checked {
  background: linear-gradient(135deg, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary) 85%, #000) 100%);
  box-shadow: var(--shadow-neu-flat);
}
input[type="checkbox"].neu-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 2px;
  width: 5px; height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"].neu-checkbox:focus {
  outline: none;
  box-shadow: var(--shadow-neu-inset), 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}
input[type="checkbox"].neu-checkbox:hover:not(:checked) {
  box-shadow: var(--shadow-neu-inset), 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

html.light input[type="checkbox"].neu-checkbox {
  background: var(--color-card);
  box-shadow: var(--shadow-neu-inset);
}
html.light input[type="checkbox"].neu-checkbox:checked {
  box-shadow: var(--shadow-neu-flat);
}

/* ═══════════════════════════════════════════════════════════════
   FILTER CHIPS — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--color-primary);
  border-radius: 9999px;
  transition: all 0.2s ease;
  border: 1px solid rgba(var(--primary-rgb), 0.2);
}
.filter-chip:hover {
  background: rgba(var(--primary-rgb), 0.15);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.15);
}
.filter-chip button {
  padding: 2px;
  border-radius: 9999px;
  transition: all 0.2s ease;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}
.filter-chip button:hover {
  background: rgba(var(--primary-rgb), 0.25);
}

/* ═══════════════════════════════════════════════════════════════
   POPOVER — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
.neu-popover {
  animation: popoverIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--color-card);
  box-shadow: var(--shadow-surface-lg);
  border-radius: var(--radius-app);
}
html.light .neu-popover {
  background: var(--color-card);
  box-shadow: var(--shadow-surface-md);
}
@keyframes popoverIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════════════
   COMPANY / DOCUMENT CARD (list items)
   ═══════════════════════════════════════════════════════════════ */
.company-card,
.document-card {
  transition: all 0.25s ease;
  border-left: 3px solid transparent;
  position: relative;
}
.company-card::before,
.document-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.05) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.company-card:hover,
.document-card:hover {
  background-color: rgba(var(--primary-rgb), 0.02);
  border-left-color: rgba(var(--primary-rgb), 0.4);
}
.company-card:hover::before,
.document-card:hover::before { opacity: 1; }
.company-card.selected,
.document-card.selected {
  background-color: rgba(var(--primary-rgb), 0.06);
  border-left-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   METRIC CARDS — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
.metric-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-app);
  background: var(--color-card);
  border: 1px solid rgba(var(--glass-border), 0.06);
  box-shadow: var(--shadow-neu-flat);
  transition: all 0.2s ease;
  overflow: hidden;
  min-width: 0;
}
@media (min-width: 640px) {
  .metric-card { gap: 10px; padding: 12px 14px; }
}
@media (min-width: 768px) {
  .metric-card { gap: 14px; padding: 18px 20px; }
}
.metric-card:hover {
  box-shadow: var(--shadow-neu-hover);
}

html.light .metric-card {
  background: var(--color-card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-neu-flat);
}
html.light .metric-card:hover {
  box-shadow: var(--shadow-neu-hover);
}

.metric-card .icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 8px -2px var(--badge-shadow, rgba(0,0,0,0.1));
}
@media (min-width: 640px) {
  .metric-card .icon-badge { width: 36px; height: 36px; border-radius: 10px; }
}
@media (min-width: 768px) {
  .metric-card .icon-badge { width: 44px; height: 44px; border-radius: 12px; }
}
.metric-card .icon-badge svg {
  width: 16px; height: 16px;
}
@media (min-width: 640px) {
  .metric-card .icon-badge svg { width: 18px; height: 18px; }
}
@media (min-width: 768px) {
  .metric-card .icon-badge svg { width: 22px; height: 22px; }
}
.metric-card .card-content { flex: 1; min-width: 0; }
.metric-label {
  font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--color-muted-foreground); margin-bottom: 1px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
@media (min-width: 640px) { .metric-label { font-size: 9px; margin-bottom: 2px; } }
@media (min-width: 768px) { .metric-label { font-size: 11px; } }
.metric-value {
  font-size: 1rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em;
  color: var(--color-foreground);
}
@media (min-width: 640px) { .metric-value { font-size: 1.25rem; } }
@media (min-width: 768px) { .metric-value { font-size: 1.625rem; } }
.metric-sublabel { font-size: 11px; color: var(--color-muted-foreground); margin-top: 2px; }

/* Icon badge color variants */
.icon-badge.amber { background: linear-gradient(135deg, rgba(245,158,11,0.2) 0%, rgba(245,158,11,0.1) 100%); color: #f59e0b; --badge-shadow: rgba(245, 158, 11, 0.25); }
.icon-badge.teal { background: linear-gradient(135deg, rgba(20,184,166,0.2) 0%, rgba(20,184,166,0.1) 100%); color: #2dd4bf; --badge-shadow: rgba(20, 184, 166, 0.25); }
.icon-badge.violet { background: linear-gradient(135deg, rgba(139,92,246,0.2) 0%, rgba(139,92,246,0.1) 100%); color: #a78bfa; --badge-shadow: rgba(139, 92, 246, 0.25); }
.icon-badge.rose { background: linear-gradient(135deg, rgba(244,63,94,0.2) 0%, rgba(244,63,94,0.1) 100%); color: #fb7185; --badge-shadow: rgba(244, 63, 94, 0.25); }
.icon-badge.orange { background: linear-gradient(135deg, rgba(234,88,12,0.2) 0%, rgba(234,88,12,0.1) 100%); color: #fb923c; --badge-shadow: rgba(234, 88, 12, 0.25); }
.icon-badge.slate { background: linear-gradient(135deg, rgba(100,116,139,0.2) 0%, rgba(100,116,139,0.1) 100%); color: #94a3b8; --badge-shadow: rgba(100, 116, 139, 0.2); }
.icon-badge.blue { background: linear-gradient(135deg, rgba(59,130,246,0.2) 0%, rgba(59,130,246,0.1) 100%); color: #60a5fa; --badge-shadow: rgba(59, 130, 246, 0.25); }
.icon-badge.emerald { background: linear-gradient(135deg, rgba(16,185,129,0.2) 0%, rgba(16,185,129,0.1) 100%); color: #34d399; --badge-shadow: rgba(16, 185, 129, 0.25); }

/* ═══════════════════════════════════════════════════════════════
   BADGES — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.badge-success { background: rgba(34, 197, 94, 0.1); color: var(--color-status-success); }
.badge-warning { background: rgba(234, 179, 8, 0.1); color: var(--color-status-warning); }
.badge-error { background: rgba(239, 68, 68, 0.1); color: var(--color-status-danger); }
.badge-info { background: rgba(var(--primary-rgb), 0.1); color: var(--color-primary); }
.badge-neutral { background: rgba(100, 116, 139, 0.1); color: var(--color-muted-foreground); }

/* ═══════════════════════════════════════════════════════════════
   COST BAR (progress bar)
   ═══════════════════════════════════════════════════════════════ */
.cost-bar {
  height: 6px;
  background: rgba(var(--glass-border), 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.cost-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 85%, #000));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   ACTION BUTTONS — Admin tables
   ═══════════════════════════════════════════════════════════════ */
.action-btn {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.action-btn:hover { transform: translateY(-1px); }
.action-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════
   DATE INPUT — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
.date-input {
  font-size: 12px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: var(--color-background);
  color: var(--color-foreground);
  box-shadow: var(--shadow-neu-inset);
  transition: all 0.2s ease;
  font-family: inherit;
}
.date-input:focus {
  outline: none;
  box-shadow: var(--shadow-neu-inset), 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   APP BAR — Glassmorphic
   ═══════════════════════════════════════════════════════════════ */
.app-bar { box-shadow: var(--shadow-app-bar); }
.app-bar-header {
  background: var(--color-card);
  box-shadow: var(--shadow-app-bar);
}
html.light .app-bar {
  background: var(--color-card) !important;
  box-shadow: var(--shadow-app-bar) !important;
}
html.light .app-bar-header {
  background: var(--color-card);
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT — Sidebar, Transitions
   ═══════════════════════════════════════════════════════════════ */
.sidebar-transition { transition: width 0.3s ease, transform 0.3s ease; }
.main-transition { transition: margin-left 0.3s ease; }
.modal-backdrop { background: rgba(0, 0, 0, 0.6); }
html.light .modal-backdrop { background: rgba(0, 0, 0, 0.3); }
.touch-target { min-height: 44px; min-width: 44px; }
.interactive:active { transform: scale(0.98); }

/* ── Light Mode: Merlin Background ──────────────────────────── */
html.light .merlin-background {
  background: linear-gradient(165deg, #ede6dc 0%, #e8e0d4 50%, #ebe4da 100%);
}
html.light .merlin-background__image {
  background:
    radial-gradient(ellipse 130% 110% at 55% 130%, rgba(212, 120, 47, 0.22) 0%, transparent 65%),
    radial-gradient(ellipse 200% 160% at 25% -50%, rgba(14, 145, 149, 0.20) 0%, transparent 60%);
  opacity: 1;
}
html.light .merlin-background__grid {
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(212, 120, 47, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 120, 47, 0.18) 1px, transparent 1px);
}

/* ── Sidebar & Top Bar ──────────────────────────────────────── */
#sidebar {
  background: var(--color-card);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

html.light #sidebar {
  background: var(--color-card);
  box-shadow: var(--shadow-surface-md);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}
html.light #sidebar .border-white\/10,
html.light #sidebar .border-b {
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html.light #sidebar .text-white\/90,
html.light #sidebar .text-white {
  color: var(--color-foreground) !important;
}
html.light #sidebar .text-gray-400,
html.light #sidebar .text-gray-500 {
  color: var(--color-muted-foreground) !important;
}
html.light #sidebar a:hover .text-white,
html.light #sidebar .hover\:text-white:hover {
  color: var(--color-foreground) !important;
}
html.light #sidebar .hover\:bg-white\/5:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* Top bar */
#topbar {
  background: var(--color-card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-app-bar);
}
html.light #topbar {
  background: var(--color-card);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}
html.light #topbar .text-gray-300,
html.light #topbar .text-gray-400 {
  color: var(--color-muted-foreground) !important;
}
html.light #topbar .hover\:bg-white\/5:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* Notification popover light mode */
html.light #notification-popover {
  background: var(--color-card);
  border-color: var(--color-border);
}
html.light #notification-popover .text-gray-300 {
  color: var(--color-muted-foreground) !important;
}
html.light #notification-popover .hover\:bg-white\/5:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

/* Sidebar overlay light mode */
html.light #sidebar-overlay {
  background: rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   SKELETON / LOADING
   ═══════════════════════════════════════════════════════════════ */
.skeleton,
.loading-skeleton {
  background: linear-gradient(90deg, var(--color-card) 25%, rgba(var(--primary-rgb), 0.08) 50%, var(--color-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-button);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Page loader overlay */
.page-loader {
  position: absolute;
  inset: 0;
  background: var(--color-background);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.page-loader.active { opacity: 1; pointer-events: auto; }

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */
.page-content { animation: pageEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-slide-up { animation: slideUp 0.5s ease-out forwards; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-scale-in { animation: scaleIn 0.4s ease-out forwards; }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.card-enter { animation: cardSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards; opacity: 0; }
@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.card-enter:nth-child(1) { animation-delay: 0.05s; }
.card-enter:nth-child(2) { animation-delay: 0.1s; }
.card-enter:nth-child(3) { animation-delay: 0.15s; }
.card-enter:nth-child(4) { animation-delay: 0.2s; }
.card-enter:nth-child(5) { animation-delay: 0.25s; }
.card-enter:nth-child(6) { animation-delay: 0.3s; }
.card-enter:nth-child(7) { animation-delay: 0.35s; }
.card-enter:nth-child(8) { animation-delay: 0.4s; }

/* Breathing dot (status indicators) */
.breathing-dot {
  width: 0.75rem; height: 0.75rem;
  border-radius: 9999px;
  background: var(--color-primary);
  animation: breathe 2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 20px 5px rgba(var(--primary-rgb), 0.2); }
}

/* Status dot with pulse */
.status-dot { width: 8px; height: 8px; border-radius: 50%; position: relative; }
.status-dot.active::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid currentColor; opacity: 0.3;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(1.5); opacity: 0; } }

/* Text shimmer */
@keyframes text-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.text-shimmer {
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-tertiary) 50%, var(--color-primary) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: text-shimmer 3s ease-in-out infinite;
}

/* Focus ring */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-background), 0 0 0 4px var(--color-primary);
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgb(var(--glass-base) / 0.5); border-radius: 5px; }
::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb), 0.3); border-radius: 5px; border: 2px solid rgb(var(--glass-base) / 0.5); }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--primary-rgb), 0.5); }
* { scrollbar-width: thin; scrollbar-color: rgba(var(--primary-rgb), 0.3) rgb(var(--glass-base) / 0.5); }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

html.light ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.03); }
html.light ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border: 2px solid rgba(0, 0, 0, 0.03); }
html.light ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }
html.light * { scrollbar-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.03); }

/* ═══════════════════════════════════════════════════════════════
   SAFE AREA / iOS
   ═══════════════════════════════════════════════════════════════ */
.pt-safe { padding-top: max(1rem, env(safe-area-inset-top)); }
.pb-safe { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }

/* Mobile sidebar */
@media (max-width: 1023px) {
  #sidebar {
    max-height: 100vh;
    max-height: 100dvh;
    background: var(--color-card);
    box-shadow: var(--shadow-surface-lg);
  }
  #sidebar-overlay { -webkit-tap-highlight-color: transparent; }
}
body.sidebar-open { overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .card-enter { animation: none !important; opacity: 1 !important; }
  .breathing-dot { animation: none !important; }
  .page-content { animation: none !important; }
  .text-shimmer { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE — Neumorphic
   ═══════════════════════════════════════════════════════════════ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--color-card) 50%, transparent);
  box-shadow: var(--shadow-neu-flat);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  color: var(--color-muted-foreground);
}
.theme-toggle:hover {
  box-shadow: var(--shadow-neu-hover);
  color: var(--color-primary);
}
.theme-toggle:active {
  box-shadow: var(--shadow-neu-pressed);
  transform: scale(0.95);
}
html.light .theme-toggle {
  background: var(--color-card);
  box-shadow: var(--shadow-neu-flat);
}
html.light .theme-toggle:hover {
  box-shadow: var(--shadow-neu-hover);
}
html.light .theme-toggle:active {
  box-shadow: var(--shadow-neu-pressed);
}

/* ═══════════════════════════════════════════════════════════════
   GLOW EFFECTS
   ═══════════════════════════════════════════════════════════════ */
.glow-teal:hover { box-shadow: 0 0 30px rgba(var(--primary-rgb), 0.2); }
.glow-amber:hover { box-shadow: 0 0 30px rgba(245, 158, 11, 0.2); }

/* ═══════════════════════════════════════════════════════════════
   EXPANDABLE TABLE ROWS (admin-costs)
   ═══════════════════════════════════════════════════════════════ */
.service-row { transition: background-color 0.15s ease; }
.toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.subservice-row {
  transition: all 0.2s ease;
  background-color: var(--color-background);
}
.subservice-row td {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  font-size: 10px !important;
  border-bottom: 1px solid rgba(var(--glass-border), 0.08);
}
@media (min-width: 768px) {
  .subservice-row td { font-size: 11px !important; }
}
.subservice-row .cost-bar { height: 3px; }

/* ═══════════════════════════════════════════════════════════════
   ALERT / TOAST
   ═══════════════════════════════════════════════════════════════ */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-button);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.alert-info { background: rgba(41,94,230,0.1); border: 1px solid rgba(41,94,230,0.2); color: var(--color-secondary); }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); color: var(--color-status-success); }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: var(--color-destructive); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: var(--color-status-warning); }

/* ═══════════════════════════════════════════════════════════════
   ROLE SELECT (admin-users)
   ═══════════════════════════════════════════════════════════════ */
.role-select {
  font-size: 12px;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  min-width: 70px;
  background: var(--color-background);
  color: var(--color-foreground);
  box-shadow: var(--shadow-neu-inset);
}
@media (max-width: 639px) {
  .role-select { font-size: 10px; padding: 2px 4px; }
  .action-buttons-container { flex-direction: column; align-items: flex-end; }
  .action-btn { font-size: 10px; padding: 3px 6px; }
}

/* ═══════════════════════════════════════════════════════════════
   LOADER — Pulsing yellow dot
   ═══════════════════════════════════════════════════════════════ */
.loader-mark {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulseGlow 1.4s ease-in-out infinite;
  display: inline-block;
}
.loader-mark.loader-sm { width: 8px; height: 8px; }
.loader-mark.loader-xs { width: 6px; height: 6px; }
.loader-mark.loader-lg { width: 18px; height: 18px; }
.loader-mark img, .loader-mark svg { display: none; }
@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.85; box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.5); }
  50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 16px 6px rgba(var(--primary-rgb), 0.25); }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE POPOVER (publications filters)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 639px) {
  #filters-popover {
    position: fixed !important;
    left: 1rem !important;
    right: 1rem !important;
    top: auto !important;
    bottom: 1rem !important;
    width: auto !important;
    max-width: none !important;
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* Scrollbar for filters bar */
.overflow-x-auto::-webkit-scrollbar { height: 4px; }
.overflow-x-auto::-webkit-scrollbar-track { background: transparent; }
.overflow-x-auto::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb), 0.3); border-radius: 2px; }

/* ═══════════════════════════════════════════════════════════════
   CALENDAR (misc)
   ═══════════════════════════════════════════════════════════════ */
.calendar-day { transition: all 0.15s ease; }
.calendar-day:hover { transform: scale(1.1); }
.calendar-day.has-data { cursor: pointer; }
.calendar-day.has-fdi { box-shadow: 0 0 0 2px var(--color-primary); }
.calendar-day.has-ide { box-shadow: 0 0 0 2px #8b5cf6; }

/* ── PDF viewer (index.html standalone) ─────────────────────── */
.pdf-frame { min-height: 400px; height: calc(100vh - 140px); }
@media (max-width: 768px) {
  .pdf-frame { min-height: 300px; height: 50vh; }
}
.pdf-list-container { min-height: 200px; max-height: calc(100vh - 184px); }
@media (max-width: 768px) {
  .pdf-list-container { max-height: 40vh; }
}

/* ── Mobile sidebar overlay (index.html standalone) ─────────── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }
@media (max-width: 1024px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.mobile-open { transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════
   SHADOW UTILITY
   ═══════════════════════════════════════════════════════════════ */
.shadow-neu { box-shadow: var(--shadow-neu-flat); }
.shadow-neu-hover { box-shadow: var(--shadow-neu-hover); }
.shadow-neu-pressed { box-shadow: var(--shadow-neu-pressed); }

/* ═══════════════════════════════════════════════════════════════
   FOUNDER BADGES
   ═══════════════════════════════════════════════════════════════ */
.founder-badge-company {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}
html.light .founder-badge-company {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
}

.founder-badge-person {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}
html.light .founder-badge-person {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.founder-badge-foreign {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #4ade80;
}
html.light .founder-badge-foreign {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

/* ═══════════════════════════════════════════════════════════════
   STATUS BADGES
   ═══════════════════════════════════════════════════════════════ */
.status-retenu {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500;
  background: rgba(34, 197, 94, 0.1); color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
html.light .status-retenu {
  background: rgba(34, 197, 94, 0.08); color: #16a34a;
  border-color: rgba(34, 197, 94, 0.15);
}

.status-exclu {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500;
  background: rgba(239, 68, 68, 0.1); color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
html.light .status-exclu {
  background: rgba(239, 68, 68, 0.08); color: #dc2626;
  border-color: rgba(239, 68, 68, 0.15);
}

.status-pending {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500;
  background: rgba(251, 191, 36, 0.1); color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
}
html.light .status-pending {
  background: rgba(251, 191, 36, 0.08); color: #d97706;
  border-color: rgba(251, 191, 36, 0.15);
}

.status-error {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500;
  background: rgba(239, 68, 68, 0.1); color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
html.light .status-error {
  background: rgba(239, 68, 68, 0.08); color: #dc2626;
  border-color: rgba(239, 68, 68, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
.toast-success {
  background: rgba(34, 197, 94, 0.12); color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .toast-success {
  background: rgba(34, 197, 94, 0.08); color: #16a34a;
  border-color: rgba(34, 197, 94, 0.2);
}

.toast-error {
  background: rgba(239, 68, 68, 0.12); color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .toast-error {
  background: rgba(239, 68, 68, 0.08); color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

.toast-warning {
  background: rgba(251, 191, 36, 0.12); color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .toast-warning {
  background: rgba(251, 191, 36, 0.08); color: #d97706;
  border-color: rgba(251, 191, 36, 0.2);
}

.toast-info {
  background: rgba(59, 130, 246, 0.12); color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .toast-info {
  background: rgba(59, 130, 246, 0.08); color: #2563eb;
  border-color: rgba(59, 130, 246, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   FILTER CHIPS & CARDS — Light mode
   ═══════════════════════════════════════════════════════════════ */
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem;
  background: var(--color-card); color: var(--color-muted-foreground);
  border: 1px solid var(--color-border); cursor: pointer;
  transition: all 0.15s ease;
}
.filter-chip:hover { background: rgba(var(--glass-teal), 0.1); color: var(--color-foreground); }
.filter-chip.active {
  background: rgba(var(--primary-rgb), 0.15);
  border-color: rgba(var(--primary-rgb), 0.3);
  color: var(--color-primary);
}

.company-card {
  background: var(--color-card); border-radius: var(--radius-app);
  border: 1px solid var(--color-border); padding: 1rem;
  box-shadow: var(--shadow-neu-flat); transition: all 0.2s ease;
}
.company-card:hover { box-shadow: var(--shadow-neu-hover); transform: translateY(-1px); }
html.light .company-card {
  background: rgba(240, 235, 228, 0.6);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-neu-flat);
}

.document-card {
  background: var(--color-card); border-radius: var(--radius-app);
  border: 1px solid var(--color-border); padding: 0.75rem;
  transition: all 0.15s ease;
}
.document-card:hover { background: rgba(var(--glass-teal), 0.08); }
html.light .document-card {
  background: rgba(240, 235, 228, 0.5);
  border-color: rgba(0, 0, 0, 0.08);
}
html.light .document-card:hover {
  background: rgba(240, 235, 228, 0.8);
}

/* ═══════════════════════════════════════════════════════════════
   ICON BADGE — Light mode
   ═══════════════════════════════════════════════════════════════ */
.icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: var(--radius-app);
  background: rgba(var(--glass-teal), 0.12);
  color: var(--color-tertiary);
}
html.light .icon-badge {
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--color-accent);
}

/* ═══════════════════════════════════════════════════════════════
   ALERT BOXES
   ═══════════════════════════════════════════════════════════════ */
.alert-warning {
  background: rgba(251, 191, 36, 0.1); color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .alert-warning {
  background: rgba(251, 191, 36, 0.08); color: #92400e;
  border-color: rgba(251, 191, 36, 0.2);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1); color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .alert-success {
  background: rgba(34, 197, 94, 0.08); color: #166534;
  border-color: rgba(34, 197, 94, 0.2);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1); color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .alert-error {
  background: rgba(239, 68, 68, 0.08); color: #991b1b;
  border-color: rgba(239, 68, 68, 0.2);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1); color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2); border-radius: var(--radius-app);
  padding: 0.75rem 1rem;
}
html.light .alert-info {
  background: rgba(59, 130, 246, 0.08); color: #1e40af;
  border-color: rgba(59, 130, 246, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE TOUCH TARGETS
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .date-mode-btn, .period-btn, .filter-tab, .pill-tab {
    min-height: 44px; min-width: 44px;
    padding-left: 0.75rem; padding-right: 0.75rem;
  }
  .btn-sm { min-height: 40px; padding: 0.5rem 1rem; }
  .btn-icon { min-width: 44px; min-height: 44px; }
  .filter-chip { min-height: 36px; padding: 0.375rem 0.75rem; }
  .input-glass, .select-glass { min-height: 44px; font-size: 16px; }
  .neu-checkbox { min-width: 20px; min-height: 20px; }
}

/* ═══════════════════════════════════════════════════════════════
   MODAL RESPONSIVE SPLIT
   ═══════════════════════════════════════════════════════════════ */
.modal-split {
  display: flex; flex-direction: column; gap: 1rem;
}
@media (min-width: 768px) {
  .modal-split { flex-direction: row; }
}
.modal-panel {
  width: 100%;
}
@media (min-width: 768px) {
  .modal-panel { width: 50%; }
}

/* ─── Minimal Utilities (for login page which doesn't have Tailwind) ─── */
.hidden { display: none !important; }
.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }
