﻿/* ==========================================================================
   CRM Admin Theme — WhatsApp CRM
   Global dark/light theme for all Filament pages.
   Uses crm-theme-dark / crm-theme-light classes on <html>.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
    0. CSS VARIABLES — Dark mode (default)
   ========================================================================== */

:root {
  /* ---- Central primary color — overridden by crm-theme.js from localStorage ---- */
  --crm-primary: #16a34a;
  --crm-primary-hover: #15803d;
  --crm-primary-soft: rgba(22, 163, 74, 0.12);

  --crm-radius: 12px;
  --crm-radius-lg: 20px;
  --crm-font-ar: 'IBM Plex Sans Arabic', 'Cairo', 'Tajawal', sans-serif;
  --crm-font-en: 'Inter', sans-serif;
  --crm-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --crm-shadow-light: 0 4px 20px rgba(0, 0, 0, 0.06);
}

html.crm-theme-dark {
  --crm-bg: #0f172a;
  --crm-bg-deep: #020617;
  --crm-bg-soft: #111827;
  --crm-panel: #1e293b;
  --crm-panel-soft: #273449;
  --crm-panel-hover: #334155;
  --crm-border: rgba(148, 163, 184, 0.18);
  --crm-border-strong: rgba(148, 163, 184, 0.32);
  --crm-text: #f8fafc;
  --crm-text-soft: #e2e8f0;
  --crm-muted: #94a3b8;
  --crm-muted-soft: #64748b;
  --crm-accent: var(--crm-primary);
  --crm-accent-hover: var(--crm-primary-hover);
  --crm-accent-soft: var(--crm-primary-soft);
  --crm-danger: #ef4444;
  --crm-danger-soft: rgba(239, 68, 68, 0.16);
  --crm-warning: #f59e0b;
  --crm-warning-soft: rgba(245, 158, 11, 0.16);
  --crm-info: #38bdf8;
  --crm-info-soft: rgba(56, 189, 248, 0.16);

  /* Override Filament's gray palette with slate */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;
}

/* ==========================================================================
    0b. CSS VARIABLES — Light mode
   ========================================================================== */

html.crm-theme-light {
  --crm-bg: #f8fafc;
  --crm-bg-deep: #ffffff;
  --crm-bg-soft: #f1f5f9;
  --crm-panel: #ffffff;
  --crm-panel-soft: #f8fafc;
  --crm-panel-hover: #e2e8f0;
  --crm-border: rgba(15, 23, 42, 0.12);
  --crm-border-strong: rgba(15, 23, 42, 0.22);
  --crm-text: #0f172a;
  --crm-text-soft: #334155;
  --crm-muted: #64748b;
  --crm-muted-soft: #94a3b8;
  --crm-accent: var(--crm-primary);
  --crm-accent-hover: var(--crm-primary-hover);
  --crm-accent-soft: var(--crm-primary-soft);
  --crm-danger: #dc2626;
  --crm-danger-soft: rgba(220, 38, 38, 0.10);
  --crm-warning: #d97706;
  --crm-warning-soft: rgba(217, 119, 6, 0.10);
  --crm-info: #2563eb;
  --crm-info-soft: rgba(37, 99, 235, 0.10);
}

/* ==========================================================================
    1. GLOBAL — RTL, fonts, body background
   ========================================================================== */

html.crm-theme-dark body,
html.crm-theme-dark .fi-body,
html.crm-theme-light body,
html.crm-theme-light .fi-body {
  font-family: var(--crm-font-ar) !important;
}

/* English text fallback */
[dir="rtl"] :not(:lang(ar)) {
  font-family: var(--crm-font-en), var(--crm-font-ar) !important;
}

/* ==========================================================================
    2. BODY — RTL direction, background per mode
   ========================================================================== */

html.crm-theme-dark body,
html.crm-theme-dark .fi-body,
html.crm-theme-light body,
html.crm-theme-light .fi-body {
  direction: rtl !important;
}

html.crm-theme-dark body,
html.crm-theme-dark .fi-body {
  background-color: var(--crm-bg) !important;
  color: var(--crm-text) !important;
}

html.crm-theme-light body,
html.crm-theme-light .fi-body {
  background-color: var(--crm-bg) !important;
  color: var(--crm-text) !important;
}

html.crm-theme-dark .fi-layout,
html.crm-theme-light .fi-layout {
  background-color: var(--crm-bg) !important;
}

/* ==========================================================================
    3. SIDEBAR & TOPBAR
   ========================================================================== */

/* --- Sidebar --- */
html.crm-theme-dark .fi-sidebar {
  background-color: var(--crm-bg) !important;
  border-right: 1px solid var(--crm-border) !important;
  border-left: none !important;
  box-shadow: none !important;
  --tw-ring-color: transparent !important;
}

html.crm-theme-light .fi-sidebar {
  background-color: var(--crm-bg-deep) !important;
  border-right: 1px solid var(--crm-border) !important;
  border-left: none !important;
  box-shadow: 0 0 0 1px var(--crm-border) !important;
  --tw-ring-color: transparent !important;
}

html.crm-theme-dark .fi-sidebar-header {
  background-color: var(--crm-bg) !important;
  border-bottom: 1px solid var(--crm-border) !important;
  box-shadow: none !important;
  --tw-ring-color: transparent !important;
}

html.crm-theme-light .fi-sidebar-header {
  background-color: var(--crm-bg-deep) !important;
  border-bottom: 1px solid var(--crm-border) !important;
  box-shadow: none !important;
  --tw-ring-color: transparent !important;
}

html.crm-theme-dark .fi-sidebar-nav {
  color: var(--crm-text-soft) !important;
}

html.crm-theme-light .fi-sidebar-nav {
  color: var(--crm-text-soft) !important;
}

/* Active sidebar item: fi-active is on fi-sidebar-item (parent), button is child */
html.crm-theme-dark .fi-active .fi-sidebar-item-button,
html.crm-theme-dark .fi-sidebar-item-button.fi-active {
  background-color: var(--crm-accent-soft) !important;
  color: var(--crm-accent) !important;
}

html.crm-theme-light .fi-active .fi-sidebar-item-button,
html.crm-theme-light .fi-sidebar-item-button.fi-active {
  background-color: var(--crm-accent-soft) !important;
  color: var(--crm-accent) !important;
}

html.crm-theme-dark .fi-sidebar-item-button:hover {
  background-color: var(--crm-panel) !important;
  color: var(--crm-text) !important;
}

html.crm-theme-light .fi-sidebar-item-button:hover {
  background-color: var(--crm-panel-soft) !important;
  color: var(--crm-text) !important;
}

html.crm-theme-dark .fi-sidebar-item-label,
html.crm-theme-dark .fi-sidebar-item-icon {
  color: inherit !important;
}

html.crm-theme-light .fi-sidebar-item-label,
html.crm-theme-light .fi-sidebar-item-icon {
  color: inherit !important;
}

html.crm-theme-dark .fi-sidebar-group-label {
  color: var(--crm-muted) !important;
}

html.crm-theme-light .fi-sidebar-group-label {
  color: var(--crm-muted) !important;
}

/* --- Topbar ---
   fi-topbar is the outer <div>; bg-white is on the inner <nav> (no fi- class) */
html.crm-theme-dark .fi-topbar,
html.crm-theme-dark .fi-topbar nav {
  background-color: var(--crm-bg-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
  box-shadow: none !important;
  --tw-ring-color: transparent !important;
  --tw-shadow: none !important;
}

html.crm-theme-light .fi-topbar,
html.crm-theme-light .fi-topbar nav {
  background-color: var(--crm-bg-deep) !important;
  border-bottom: 1px solid var(--crm-border) !important;
  box-shadow: none !important;
  --tw-ring-color: transparent !important;
  --tw-shadow: none !important;
}

html.crm-theme-dark .fi-topbar nav *,
html.crm-theme-light .fi-topbar nav * {
  --tw-ring-color: transparent;
}

/* ==========================================================================
    4. PANELS / CARDS / SECTIONS
   ========================================================================== */

html.crm-theme-dark .fi-section,
html.crm-theme-dark .fi-section-content-ctn,
html.crm-theme-dark .fi-modal-window,
html.crm-theme-dark .fi-dropdown-list,
html.crm-theme-dark .fi-notification,
html.crm-theme-dark .fi-simple-main {
  background-color: var(--crm-panel) !important;
  --tw-ring-color: var(--crm-border) !important;
  box-shadow: var(--crm-shadow) !important;
}

html.crm-theme-light .fi-section,
html.crm-theme-light .fi-section-content-ctn,
html.crm-theme-light .fi-modal-window,
html.crm-theme-light .fi-dropdown-list,
html.crm-theme-light .fi-notification,
html.crm-theme-light .fi-simple-main {
  background-color: var(--crm-panel) !important;
  --tw-ring-color: var(--crm-border) !important;
  box-shadow: var(--crm-shadow-light) !important;
}

/* Sticky modal header/footer (when stickyHeader or stickyFooter is true) */
html.crm-theme-dark .fi-sticky {
  background-color: var(--crm-panel) !important;
  border-color: var(--crm-border) !important;
}

html.crm-theme-light .fi-sticky {
  background-color: var(--crm-panel) !important;
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .fi-section-header {
  background-color: var(--crm-bg-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-light .fi-section-header {
  background-color: var(--crm-panel-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-section-header-heading,
html.crm-theme-light .fi-section-header-heading {
  color: var(--crm-text) !important;
}

html.crm-theme-dark .fi-main,
html.crm-theme-light .fi-main {
  background-color: var(--crm-bg) !important;
}

html.crm-theme-dark .fi-main-ctn,
html.crm-theme-light .fi-main-ctn {
  max-width: 100% !important;
  padding: 0 !important;
}

/* ==========================================================================
    5. TABLES
   ========================================================================== */

/* fi-ta-ctn is the outermost table wrapper with bg-white — must override first */
html.crm-theme-dark .fi-ta-ctn {
  background-color: var(--crm-panel) !important;
  box-shadow: var(--crm-shadow) !important;
  --tw-ring-color: var(--crm-border) !important;
}

html.crm-theme-light .fi-ta-ctn {
  background-color: var(--crm-panel) !important;
  box-shadow: var(--crm-shadow-light) !important;
  --tw-ring-color: var(--crm-border) !important;
}

/* Individual table record rows also carry bg-white */
html.crm-theme-dark .fi-ta-record {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-dark .fi-ta-record:hover {
  background-color: var(--crm-panel-hover) !important;
}

html.crm-theme-light .fi-ta-record {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-light .fi-ta-record:hover {
  background-color: var(--crm-panel-hover) !important;
}

/* fi-ta-header-ctn is the actual Filament class (fi-ta-header was wrong) */
html.crm-theme-dark .fi-ta-header,
html.crm-theme-dark .fi-ta-header-ctn,
html.crm-theme-dark .fi-ta-header-toolbar {
  background-color: var(--crm-bg-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-light .fi-ta-header,
html.crm-theme-light .fi-ta-header-ctn,
html.crm-theme-light .fi-ta-header-toolbar {
  background-color: var(--crm-panel-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-ta-header-cell {
  background-color: var(--crm-bg) !important;
  color: var(--crm-text-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-light .fi-ta-header-cell {
  background-color: var(--crm-bg-soft) !important;
  color: var(--crm-text-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-ta-row {
  background-color: var(--crm-panel) !important;
  border-radius: var(--crm-radius) !important;
}

html.crm-theme-light .fi-ta-row {
  background-color: var(--crm-panel) !important;
  border-radius: var(--crm-radius) !important;
}

html.crm-theme-dark .fi-ta-row:hover,
html.crm-theme-light .fi-ta-row:hover {
  background-color: var(--crm-panel-hover) !important;
}

html.crm-theme-dark .fi-ta-row.fi-ta-row-selected,
html.crm-theme-light .fi-ta-row.fi-ta-row-selected {
  background-color: var(--crm-accent-soft) !important;
}

html.crm-theme-dark .fi-ta-pagination,
html.crm-theme-light .fi-ta-pagination {
  background-color: var(--crm-panel) !important;
  border: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-ta-empty-state,
html.crm-theme-light .fi-ta-empty-state {
  background-color: transparent !important;
  padding: 60px 20px !important;
}

html.crm-theme-dark .fi-ta-filters,
html.crm-theme-dark .fi-ta-filters-above-content-ctn {
  background-color: var(--crm-bg-soft) !important;
  border-top: 1px solid var(--crm-border) !important;
}

html.crm-theme-light .fi-ta-filters,
html.crm-theme-light .fi-ta-filters-above-content-ctn {
  background-color: var(--crm-panel-soft) !important;
  border-top: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-ta-bulk-actions,
html.crm-theme-light .fi-ta-bulk-actions {
  background-color: var(--crm-panel) !important;
  border: 1px solid var(--crm-border) !important;
}

/* ==========================================================================
    6. FORMS
   ========================================================================== */

html.crm-theme-dark .fi-input-wrp,
html.crm-theme-light .fi-input-wrp {
  background-color: var(--crm-bg-soft) !important;
  border: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-input-wrp:focus-within,
html.crm-theme-light .fi-input-wrp:focus-within {
  border-color: var(--crm-accent) !important;
  box-shadow: 0 0 0 3px var(--crm-accent-soft) !important;
}

html.crm-theme-dark .fi-input,
html.crm-theme-light .fi-input {
  color: var(--crm-text) !important;
}

html.crm-theme-dark .fi-select,
html.crm-theme-light .fi-select {
  background-color: var(--crm-bg-soft) !important;
  border: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-checkbox,
html.crm-theme-light .fi-checkbox {
  background-color: var(--crm-bg-soft) !important;
  border-color: var(--crm-border-strong) !important;
}

html.crm-theme-dark .fi-checkbox:checked,
html.crm-theme-light .fi-checkbox:checked {
  background-color: var(--crm-accent) !important;
  border-color: var(--crm-accent) !important;
}

html.crm-theme-dark .fi-field-label,
html.crm-theme-light .fi-field-label {
  color: var(--crm-text-soft) !important;
}

/* ==========================================================================
    7. BUTTONS
   ========================================================================== */

html.crm-theme-dark .fi-btn-color-gray {
  background-color: var(--crm-panel) !important;
  border: 1px solid var(--crm-border) !important;
  color: var(--crm-muted) !important;
}

html.crm-theme-light .fi-btn-color-gray {
  background-color: var(--crm-panel-soft) !important;
  border: 1px solid var(--crm-border) !important;
  color: var(--crm-muted) !important;
}

html.crm-theme-dark .fi-btn-color-gray:hover,
html.crm-theme-light .fi-btn-color-gray:hover {
  background-color: var(--crm-panel-hover) !important;
  color: var(--crm-text) !important;
}

html.crm-theme-dark .fi-btn-color-primary,
html.crm-theme-light .fi-btn-color-primary {
  background-color: var(--crm-accent) !important;
  border-color: var(--crm-accent) !important;
  color: #fff !important;
}

html.crm-theme-dark .fi-btn-color-primary:hover,
html.crm-theme-light .fi-btn-color-primary:hover {
  background-color: var(--crm-accent-hover) !important;
}

/* ==========================================================================
    8. BADGES
   ========================================================================== */

html.crm-theme-dark .fi-badge-color-success,
html.crm-theme-light .fi-badge-color-success {
  color: var(--crm-accent) !important;
  background-color: var(--crm-accent-soft) !important;
  border-color: var(--crm-accent-soft) !important;
}

html.crm-theme-dark .fi-badge-color-danger {
  color: var(--crm-danger) !important;
  background-color: var(--crm-danger-soft) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

html.crm-theme-light .fi-badge-color-danger {
  color: var(--crm-danger) !important;
  background-color: var(--crm-danger-soft) !important;
  border-color: rgba(220, 38, 38, 0.3) !important;
}

html.crm-theme-dark .fi-badge-color-warning {
  color: var(--crm-warning) !important;
  background-color: var(--crm-warning-soft) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

html.crm-theme-light .fi-badge-color-warning {
  color: var(--crm-warning) !important;
  background-color: var(--crm-warning-soft) !important;
  border-color: rgba(217, 119, 6, 0.3) !important;
}

html.crm-theme-dark .fi-badge-color-info {
  color: var(--crm-info) !important;
  background-color: var(--crm-info-soft) !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
}

html.crm-theme-light .fi-badge-color-info {
  color: var(--crm-info) !important;
  background-color: var(--crm-info-soft) !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
}

html.crm-theme-dark .fi-badge-color-gray {
  color: var(--crm-muted) !important;
  background-color: rgba(148, 163, 184, 0.1) !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
}

html.crm-theme-light .fi-badge-color-gray {
  color: var(--crm-muted) !important;
  background-color: rgba(100, 116, 139, 0.1) !important;
  border-color: rgba(100, 116, 139, 0.2) !important;
}

/* ==========================================================================
    9. MODALS & DROPDOWNS
   ========================================================================== */

html.crm-theme-dark .fi-modal-window,
html.crm-theme-light .fi-modal-window {
  background-color: var(--crm-panel) !important;
  border: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-modal-header {
  background-color: var(--crm-bg-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-light .fi-modal-header {
  background-color: var(--crm-panel-soft) !important;
  border-bottom: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-modal-footer {
  background-color: var(--crm-bg-soft) !important;
  border-top: 1px solid var(--crm-border) !important;
}

html.crm-theme-light .fi-modal-footer {
  background-color: var(--crm-panel-soft) !important;
  border-top: 1px solid var(--crm-border) !important;
}

html.crm-theme-dark .fi-dropdown-list,
html.crm-theme-light .fi-dropdown-list {
  background-color: var(--crm-panel) !important;
  border: 1px solid var(--crm-border) !important;
  padding: 4px !important;
}

html.crm-theme-dark .fi-dropdown-item,
html.crm-theme-light .fi-dropdown-item {
  color: var(--crm-muted) !important;
}

html.crm-theme-dark .fi-dropdown-item:hover,
html.crm-theme-light .fi-dropdown-item:hover {
  background-color: var(--crm-bg-soft) !important;
  color: var(--crm-text) !important;
}

html.crm-theme-dark .fi-dropdown-item.fi-active,
html.crm-theme-light .fi-dropdown-item.fi-active {
  background-color: var(--crm-accent-soft) !important;
  color: var(--crm-accent) !important;
}

/* ==========================================================================
    10. GLOBAL TEXT & BG COLOR OVERRIDES
    Filament uses Tailwind gray utility classes; override inside crm-theme modes.
   ========================================================================== */

/* Primary text colors */
html.crm-theme-dark .fi-body .text-gray-950,
html.crm-theme-dark .fi-body .text-gray-900 {
  color: var(--crm-text) !important;
}
html.crm-theme-dark .fi-body .text-gray-700,
html.crm-theme-dark .fi-body .text-gray-800 {
  color: var(--crm-text-soft) !important;
}
html.crm-theme-dark .fi-body .text-gray-500,
html.crm-theme-dark .fi-body .text-gray-600 {
  color: var(--crm-muted) !important;
}
html.crm-theme-dark .fi-body .text-gray-400 {
  color: var(--crm-muted-soft) !important;
}

/* Background overrides — panels, headers, etc. */
html.crm-theme-dark .fi-body .bg-gray-50 {
  background-color: var(--crm-bg-soft) !important;
}
html.crm-theme-dark .fi-body .bg-gray-100 {
  background-color: var(--crm-panel) !important;
}
html.crm-theme-dark .fi-body .bg-gray-200 {
  background-color: var(--crm-panel-hover) !important;
}
html.crm-theme-dark .fi-body .bg-gray-800,
html.crm-theme-dark .fi-body .bg-gray-900 {
  background-color: var(--crm-bg-soft) !important;
}

/* Border overrides */
html.crm-theme-dark .fi-body .border-gray-200,
html.crm-theme-dark .fi-body .border-gray-300,
html.crm-theme-dark .fi-body .divide-gray-200 > * {
  border-color: var(--crm-border) !important;
}
html.crm-theme-dark .fi-body .ring-gray-950\/5 {
  --tw-ring-color: var(--crm-border) !important;
}

/* Light mode — keep white backgrounds, just ensure borders are correct */
html.crm-theme-light .fi-body .border-gray-200,
html.crm-theme-light .fi-body .border-gray-300 {
  border-color: var(--crm-border) !important;
}

/* ==========================================================================
    10b. SCROLLBARS
   ========================================================================== */

::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

::-webkit-scrollbar-track {
  background: transparent !important;
}

::-webkit-scrollbar-thumb {
  background: var(--crm-border) !important;
  border-radius: 999px !important;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--crm-border-strong) !important;
}

* {
  scrollbar-width: thin !important;
  scrollbar-color: var(--crm-border) transparent !important;
}

/* ==========================================================================
    11. RTL LAYOUT FIXES
   ========================================================================== */

html.crm-theme-dark .fi-sidebar,
html.crm-theme-light .fi-sidebar {
  border-right: 1px solid var(--crm-border) !important;
  border-left: none !important;
}

html.crm-theme-dark .fi-breadcrumbs ol,
html.crm-theme-light .fi-breadcrumbs ol {
  gap: 6px !important;
}

html.crm-theme-dark .fi-ta-cell .dir-ltr,
html.crm-theme-dark .fi-ta-cell code,
html.crm-theme-dark .fi-ta-cell .font-mono,
html.crm-theme-light .fi-ta-cell .dir-ltr,
html.crm-theme-light .fi-ta-cell code,
html.crm-theme-light .fi-ta-cell .font-mono {
  direction: ltr !important;
  display: inline-block !important;
}

/* ==========================================================================
    12. ACCESSIBILITY
   ========================================================================== */

html.crm-theme-dark *:focus-visible,
html.crm-theme-light *:focus-visible {
  outline: 2px solid var(--crm-accent) !important;
  outline-offset: 2px !important;
}

/* ==========================================================================
    13. NOTIFICATIONS DROPDOWN
   ========================================================================== */

html.crm-theme-light .fi-notification {
  background-color: var(--crm-panel) !important;
  border: 1px solid var(--crm-border) !important;
}

/* ==========================================================================
    14. CUSTOM PAGE OVERRIDES — Dark mode
   ========================================================================== */

/* --- Reports & Settings --- */
html.crm-theme-dark .reports-page .bg-white,
html.crm-theme-dark .settings-page .bg-white {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-dark .reports-page .bg-gray-50,
html.crm-theme-dark .reports-page .bg-gray-100,
html.crm-theme-dark .settings-page .bg-gray-50,
html.crm-theme-dark .settings-page .bg-gray-100 {
  background-color: var(--crm-bg-soft) !important;
}

html.crm-theme-dark .reports-page .bg-gray-200,
html.crm-theme-dark .settings-page .bg-gray-200 {
  background-color: var(--crm-panel-hover) !important;
}

html.crm-theme-dark .reports-page .bg-gray-700,
html.crm-theme-dark .reports-page .bg-gray-800,
html.crm-theme-dark .settings-page .bg-gray-700,
html.crm-theme-dark .settings-page .bg-gray-800 {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-dark .reports-page .text-gray-900,
html.crm-theme-dark .settings-page .text-gray-900 {
  color: var(--crm-text) !important;
}

html.crm-theme-dark .reports-page .text-gray-500,
html.crm-theme-dark .reports-page .text-gray-600,
html.crm-theme-dark .reports-page .text-gray-700,
html.crm-theme-dark .settings-page .text-gray-500,
html.crm-theme-dark .settings-page .text-gray-600,
html.crm-theme-dark .settings-page .text-gray-700 {
  color: var(--crm-muted) !important;
}

html.crm-theme-dark .reports-page .text-gray-400,
html.crm-theme-dark .settings-page .text-gray-400 {
  color: var(--crm-muted-soft) !important;
}

html.crm-theme-dark .reports-page .border-gray-200,
html.crm-theme-dark .reports-page .border-gray-100,
html.crm-theme-dark .reports-page .border-gray-300,
html.crm-theme-dark .settings-page .border-gray-200,
html.crm-theme-dark .settings-page .border-gray-100,
html.crm-theme-dark .settings-page .border-gray-300,
html.crm-theme-dark .settings-page .border-gray-700 {
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .reports-page .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html.crm-theme-dark .reports-page .divide-y > :not([hidden]) ~ :not([hidden]),
html.crm-theme-dark .settings-page .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html.crm-theme-dark .settings-page .divide-y > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .reports-page tr:hover,
html.crm-theme-dark .reports-page table tbody tr:hover,
html.crm-theme-dark .settings-page tr:hover,
html.crm-theme-dark .reports-page .hover\:bg-gray-200:hover,
html.crm-theme-dark .reports-page .hover\:bg-gray-50:hover,
html.crm-theme-dark .settings-page .hover\:bg-gray-200:hover,
html.crm-theme-dark .settings-page .hover\:bg-gray-50:hover {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-dark .reports-page select,
html.crm-theme-dark .reports-page input[type="date"],
html.crm-theme-dark .reports-page input[type="text"],
html.crm-theme-dark .settings-page select,
html.crm-theme-dark .settings-page input[type="date"],
html.crm-theme-dark .settings-page input[type="text"],
html.crm-theme-dark .settings-page input[type="number"] {
  background-color: var(--crm-bg-soft) !important;
  border-color: var(--crm-border) !important;
  color: var(--crm-text) !important;
}

html.crm-theme-dark .reports-page select:focus,
html.crm-theme-dark .reports-page input[type="date"]:focus,
html.crm-theme-dark .settings-page select:focus,
html.crm-theme-dark .settings-page input[type="date"]:focus {
  border-color: var(--crm-accent) !important;
  box-shadow: 0 0 0 3px var(--crm-accent-soft) !important;
}

html.crm-theme-dark .reports-page td,
html.crm-theme-dark .reports-page th {
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .reports-page .bg-emerald-50,
html.crm-theme-dark .settings-page .bg-emerald-50 {
  background-color: var(--crm-accent-soft) !important;
}
html.crm-theme-dark .reports-page .text-emerald-700,
html.crm-theme-dark .reports-page .text-emerald-600,
html.crm-theme-dark .settings-page .text-emerald-700,
html.crm-theme-dark .settings-page .text-emerald-600 {
  color: var(--crm-accent) !important;
}
html.crm-theme-dark .reports-page .text-emerald-300,
html.crm-theme-dark .reports-page .text-emerald-400,
html.crm-theme-dark .settings-page .text-emerald-300,
html.crm-theme-dark .settings-page .text-emerald-400 {
  color: var(--crm-accent) !important;
}

html.crm-theme-dark .reports-page .bg-amber-50,
html.crm-theme-dark .settings-page .bg-amber-50 {
  background-color: var(--crm-warning-soft) !important;
}
html.crm-theme-dark .reports-page .text-amber-700,
html.crm-theme-dark .reports-page .text-amber-600,
html.crm-theme-dark .settings-page .text-amber-700,
html.crm-theme-dark .settings-page .text-amber-600 {
  color: var(--crm-warning) !important;
}

html.crm-theme-dark .reports-page .bg-rose-50,
html.crm-theme-dark .reports-page .bg-red-50,
html.crm-theme-dark .settings-page .bg-rose-50 {
  background-color: var(--crm-danger-soft) !important;
}
html.crm-theme-dark .reports-page .text-rose-700,
html.crm-theme-dark .reports-page .text-rose-600,
html.crm-theme-dark .reports-page .text-red-600,
html.crm-theme-dark .settings-page .text-rose-700,
html.crm-theme-dark .settings-page .text-rose-600 {
  color: var(--crm-danger) !important;
}

html.crm-theme-dark .reports-page .bg-blue-50,
html.crm-theme-dark .reports-page .bg-cyan-50,
html.crm-theme-dark .settings-page .bg-blue-50 {
  background-color: var(--crm-info-soft) !important;
}
html.crm-theme-dark .reports-page .text-blue-700,
html.crm-theme-dark .reports-page .text-blue-600,
html.crm-theme-dark .settings-page .text-blue-700,
html.crm-theme-dark .settings-page .text-blue-600 {
  color: var(--crm-info) !important;
}

html.crm-theme-dark .reports-page .bg-indigo-50,
html.crm-theme-dark .settings-page .bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.16) !important;
}
html.crm-theme-dark .reports-page .text-indigo-700,
html.crm-theme-dark .reports-page .text-indigo-600,
html.crm-theme-dark .settings-page .text-indigo-700,
html.crm-theme-dark .settings-page .text-indigo-600 {
  color: #818cf8 !important;
}

html.crm-theme-dark .reports-page .bg-violet-50,
html.crm-theme-dark .settings-page .bg-violet-50 {
  background-color: rgba(139, 92, 246, 0.16) !important;
}
html.crm-theme-dark .reports-page .text-violet-700,
html.crm-theme-dark .reports-page .text-violet-600,
html.crm-theme-dark .settings-page .text-violet-700,
html.crm-theme-dark .settings-page .text-violet-600 {
  color: #a78bfa !important;
}

html.crm-theme-dark .reports-page .bg-orange-50 {
  background-color: rgba(249, 115, 22, 0.16) !important;
}
html.crm-theme-dark .reports-page .text-orange-700,
html.crm-theme-dark .reports-page .text-orange-600 {
  color: #fb923c !important;
}

html.crm-theme-dark .settings-page .bg-emerald-900\/20,
html.crm-theme-dark .settings-page .bg-amber-900\/20,
html.crm-theme-dark .settings-page .bg-rose-900\/20,
html.crm-theme-dark .settings-page .bg-blue-900\/20 {
  background-color: transparent !important;
}

html.crm-theme-dark .settings-page label:not(.inline-flex) {
  color: var(--crm-text-soft) !important;
}

html.crm-theme-dark .settings-page input[type="checkbox"] {
  border-color: var(--crm-border-strong) !important;
  background-color: var(--crm-bg-soft) !important;
}

html.crm-theme-dark .settings-page input[type="checkbox"]:checked {
  background-color: var(--crm-accent) !important;
  border-color: var(--crm-accent) !important;
}

/* --- Permissions Page --- */
html.crm-theme-dark .permissions-page .bg-white,
html.crm-theme-dark .permissions-page .bg-gray-50,
html.crm-theme-dark .permissions-page .bg-gray-100 {
  background-color: var(--crm-bg-soft) !important;
}

html.crm-theme-dark .permissions-page .text-gray-900,
html.crm-theme-dark .permissions-page .text-gray-700,
html.crm-theme-dark .permissions-page .text-gray-600 {
  color: var(--crm-text) !important;
}

html.crm-theme-dark .permissions-page .text-gray-500,
html.crm-theme-dark .permissions-page .text-gray-400 {
  color: var(--crm-muted) !important;
}

html.crm-theme-dark .permissions-page .border-gray-200,
html.crm-theme-dark .permissions-page .border-gray-300,
html.crm-theme-dark .permissions-page .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html.crm-theme-dark .permissions-page .border-b {
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .permissions-page th {
  color: var(--crm-muted) !important;
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .permissions-page td {
  color: var(--crm-text) !important;
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .permissions-page tr:hover,
html.crm-theme-dark .permissions-page .hover\:bg-gray-50:hover {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-dark .permissions-page input[type="checkbox"] {
  border-color: var(--crm-border-strong) !important;
  background-color: var(--crm-bg-soft) !important;
}

html.crm-theme-dark .permissions-page input[type="checkbox"]:checked {
  background-color: var(--crm-accent) !important;
  border-color: var(--crm-accent) !important;
}

/* --- My Profile Page --- */
html.crm-theme-dark .my-profile-page .bg-white {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-dark .my-profile-page .bg-gray-50,
html.crm-theme-dark .my-profile-page .bg-gray-100 {
  background-color: var(--crm-bg-soft) !important;
}

html.crm-theme-dark .my-profile-page .text-gray-900 {
  color: var(--crm-text) !important;
}
html.crm-theme-dark .my-profile-page .text-gray-500 {
  color: var(--crm-muted) !important;
}
html.crm-theme-dark .my-profile-page .text-gray-700,
html.crm-theme-dark .my-profile-page .text-gray-600 {
  color: var(--crm-text-soft) !important;
}

html.crm-theme-dark .my-profile-page .border-gray-200 {
  border-color: var(--crm-border) !important;
}
html.crm-theme-dark .my-profile-page .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html.crm-theme-dark .my-profile-page .divide-y > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--crm-border) !important;
}

html.crm-theme-dark .my-profile-page th {
  color: var(--crm-muted) !important;
  border-color: var(--crm-border) !important;
}
html.crm-theme-dark .my-profile-page td {
  color: var(--crm-text) !important;
  border-color: var(--crm-border) !important;
}
html.crm-theme-dark .my-profile-page tr:hover,
html.crm-theme-dark .my-profile-page .hover\:bg-gray-50:hover {
  background-color: var(--crm-panel) !important;
}

html.crm-theme-dark .my-profile-page .bg-emerald-50 {
  background-color: var(--crm-accent-soft) !important;
}
html.crm-theme-dark .my-profile-page .text-emerald-700,
html.crm-theme-dark .my-profile-page .text-emerald-600 {
  color: var(--crm-accent) !important;
}
html.crm-theme-dark .my-profile-page .bg-amber-50 {
  background-color: var(--crm-warning-soft) !important;
}
html.crm-theme-dark .my-profile-page .text-amber-700,
html.crm-theme-dark .my-profile-page .text-amber-600 {
  color: var(--crm-warning) !important;
}
html.crm-theme-dark .my-profile-page .bg-rose-50,
html.crm-theme-dark .my-profile-page .bg-red-100 {
  background-color: var(--crm-danger-soft) !important;
}
html.crm-theme-dark .my-profile-page .text-rose-700,
html.crm-theme-dark .my-profile-page .text-rose-600,
html.crm-theme-dark .my-profile-page .text-red-600 {
  color: var(--crm-danger) !important;
}
html.crm-theme-dark .my-profile-page .bg-blue-50 {
  background-color: var(--crm-info-soft) !important;
}
html.crm-theme-dark .my-profile-page .text-blue-700,
html.crm-theme-dark .my-profile-page .text-blue-600 {
  color: var(--crm-info) !important;
}
html.crm-theme-dark .my-profile-page .bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.16) !important;
}
html.crm-theme-dark .my-profile-page .text-indigo-700,
html.crm-theme-dark .my-profile-page .text-indigo-600 {
  color: #818cf8 !important;
}
html.crm-theme-dark .my-profile-page .bg-orange-50 {
  background-color: rgba(249, 115, 22, 0.16) !important;
}
html.crm-theme-dark .my-profile-page .text-orange-700,
html.crm-theme-dark .my-profile-page .text-orange-600 {
  color: #fb923c !important;
}

/* ==========================================================================
    15. CHAT WORKSPACE INTEGRATION
    These apply in both modes (Dashboard SPA hides Filament shell)
   ========================================================================== */

/* Hide Filament topbar on dashboard — custom topbar is inside page content */
body.fi-body:has(.app) .fi-topbar {
  display: none !important;
}

/* Remove default padding so chat workspace fills the content area */
body.fi-body:has(.app) .fi-main {
  padding: 0 !important;
  max-width: 100% !important;
}

body.fi-body:has(.app) .fi-main-ctn {
  padding: 0 !important;
}

/* ==========================================================================
    16. HIDE FILAMENT'S BUILT-IN THEME SWITCHER
    We manage dark/light globally via crm-theme.js — Filament's own toggle
    is hidden to prevent two competing theme systems.
   ========================================================================== */

.fi-theme-switcher {
  display: none !important;
}

/* ==========================================================================
    17. REPORTS PAGE — Shared light mode overrides
    In light mode, native bg-white/text-gray-900 classes are correct.
    Only need to fix the reports-page-specific dark selector from the blade.
   ========================================================================== */

html.crm-theme-light .reports-page table tbody tr:hover {
  background-color: rgba(16, 185, 129, 0.04) !important;
}

html.crm-theme-dark .reports-page table tbody tr:hover {
  background-color: rgba(16, 185, 129, 0.08) !important;
}
