/* theme.css — Light + Blue professional palette
   Light is now the DEFAULT. Dark stays available via the topbar toggle. */

:root {
  /* LIGHT MODE (default) */
  --sidebar-brand: #0F172A;
  --bg-main:       #F8FAFC;
  --bg-card:       #FFFFFF;
  --bg-card-soft:  #F1F5F9;
  --text-primary:  #0F172A;
  --text-muted:    #475569;
  --text-soft:     #94A3B8;
  --action-blue:   #2563EB;
  --action-blue-dark: #1E40AF;
  --action-blue-soft: #DBEAFE;
  --accent-pink:   #2563EB;        /* aliased to blue */
  --border-color:  #E2E8F0;
  --border-strong: #CBD5E1;
  --positive:      #059669;
  --positive-soft: #D1FAE5;
  --danger:        #DC2626;
  --danger-soft:   #FEE2E2;
  --amber:         #D97706;
  --amber-soft:    #FEF3C7;
}

[data-theme="dark"] {
  --sidebar-brand: #0B0F19;
  --bg-main:       #111827;
  --bg-card:       #1F2937;
  --bg-card-soft:  #0E0E0E;
  --text-primary:  #F9FAFB;
  --text-muted:    #94A3B8;
  --text-soft:     #64748B;
  --action-blue:   #3B82F6;
  --action-blue-dark: #2563EB;
  --action-blue-soft: #1E3A8A;
  --accent-pink:   #3B82F6;
  --border-color:  #2A2A2A;
  --border-strong: #3A3A3A;
  --positive:      #10B981;
  --positive-soft: #064E3B;
  --danger:        #EF4444;
  --danger-soft:   #7F1D1D;
  --amber:         #F59E0B;
  --amber-soft:    #78350F;
}

/* Smooth transitions */
html, body, .ck-themed, .ck-themed * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Root surfaces */
html, body {
  background-color: var(--bg-main) !important;
  color: var(--text-primary);
}

/* Dark/light toggle re-enabled — show the topbar button */
#ckThemeToggle { display: inline-flex !important; }

/* Hide the floating green webphone pill (triggered from topbar instead) */
#ck-phone .ck-pill {
  opacity: 0;
  pointer-events: none;
  width: 1px !important;
  height: 1px !important;
  box-shadow: none !important;
}

/* Hide the floating purple AI brain (now in topbar) */
#brain-fab {
  display: none !important;
}

/* Hide the topbar Brien bell (moved INSIDE the AI Brain panel header) */
.tb-brien-bell-btn {
  display: none !important;
}

/* ============================================================
   AGGRESSIVE LIGHT-MODE OVERRIDES
   The compiled bundle has hundreds of inline-styled elements with
   hardcoded dark hex codes. We override them at the CSS level for
   light mode to look right without rewriting every component.
   ============================================================ */

/* Light mode: override dark page backgrounds */
:root:not([data-theme="dark"]) [style*="background:#0a0a0a"],
:root:not([data-theme="dark"]) [style*="background: #0a0a0a"],
:root:not([data-theme="dark"]) [style*="background:#000"],
:root:not([data-theme="dark"]) [style*="background: #000"],
:root:not([data-theme="dark"]) [style*="background:#111827"],
:root:not([data-theme="dark"]) [style*="background: #111827"] {
  background-color: var(--bg-main) !important;
}

:root:not([data-theme="dark"]) [style*="background:#0e0e0e"],
:root:not([data-theme="dark"]) [style*="background: #0e0e0e"],
:root:not([data-theme="dark"]) [style*="background:#1F2937"],
:root:not([data-theme="dark"]) [style*="background: #1F2937"],
:root:not([data-theme="dark"]) [style*="background:#1f1f1f"],
:root:not([data-theme="dark"]) [style*="background: #1f1f1f"],
:root:not([data-theme="dark"]) [style*="background:#0F172A"],
:root:not([data-theme="dark"]) [style*="background: #0F172A"] {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* Light mode: dark borders → light */
:root:not([data-theme="dark"]) [style*="border:1px solid #2a2a2a"],
:root:not([data-theme="dark"]) [style*="border: 1px solid #2a2a2a"],
:root:not([data-theme="dark"]) [style*="border-color:#2a2a2a"],
:root:not([data-theme="dark"]) [style*="border-color: #2a2a2a"],
:root:not([data-theme="dark"]) [style*="border:1px solid #3a3a3a"],
:root:not([data-theme="dark"]) [style*="border: 1px solid #3a3a3a"] {
  border-color: var(--border-color) !important;
}

/* Light mode: light grey/white text → dark slate */
:root:not([data-theme="dark"]) [style*="color:#fff"]:not([style*="background:#2563EB"]):not([style*="background:#3B82F6"]):not([style*="background:#1E40AF"]):not([style*="background:#10b981"]):not([style*="background:#059669"]):not([style*="background:#34c759"]):not([style*="background:#ef4444"]):not([style*="background:#dc2626"]):not([style*="background:#f59e0b"]):not([style*="background:linear-gradient"]),
:root:not([data-theme="dark"]) [style*="color: #fff"]:not([style*="background:#2563EB"]):not([style*="background:#3B82F6"]):not([style*="background:#1E40AF"]):not([style*="background:#10b981"]):not([style*="background:#059669"]):not([style*="background:#34c759"]):not([style*="background:#ef4444"]):not([style*="background:#dc2626"]):not([style*="background:#f59e0b"]):not([style*="background:linear-gradient"]),
:root:not([data-theme="dark"]) [style*="color:#ffffff"]:not([style*="background:#2563EB"]):not([style*="background:#3B82F6"]):not([style*="background:#1E40AF"]):not([style*="background:#10b981"]):not([style*="background:#059669"]):not([style*="background:#34c759"]):not([style*="background:#ef4444"]):not([style*="background:#dc2626"]):not([style*="background:#f59e0b"]):not([style*="background:linear-gradient"]) {
  color: var(--text-primary) !important;
}

/* Light mode: pink/old accent hex codes → blue */
:root:not([data-theme="dark"]) [style*="background:#ec4899"],
:root:not([data-theme="dark"]) [style*="background: #ec4899"],
:root:not([data-theme="dark"]) [style*="background:#ec3f8a"],
:root:not([data-theme="dark"]) [style*="background: #ec3f8a"],
:root:not([data-theme="dark"]) [style*="background:#ff375f"],
:root:not([data-theme="dark"]) [style*="background: #ff375f"],
:root:not([data-theme="dark"]) [style*="background:#e91e8c"],
:root:not([data-theme="dark"]) [style*="background: #e91e8c"] {
  background-color: var(--action-blue) !important;
}
:root:not([data-theme="dark"]) [style*="color:#ec4899"],
:root:not([data-theme="dark"]) [style*="color: #ec4899"],
:root:not([data-theme="dark"]) [style*="color:#ff375f"],
:root:not([data-theme="dark"]) [style*="color: #ff375f"] {
  color: var(--action-blue) !important;
}

/* Sidebar (light mode) */
:root:not([data-theme="dark"]) .ck-sidebar,
:root:not([data-theme="dark"]) [class*="sidebar"]:not(.tb-brien-panel) {
  background-color: var(--sidebar-brand) !important;
}

/* Inputs in light mode */
:root:not([data-theme="dark"]) input[type="text"],
:root:not([data-theme="dark"]) input[type="email"],
:root:not([data-theme="dark"]) input[type="number"],
:root:not([data-theme="dark"]) input[type="date"],
:root:not([data-theme="dark"]) input[type="search"],
:root:not([data-theme="dark"]) input[type="tel"],
:root:not([data-theme="dark"]) textarea,
:root:not([data-theme="dark"]) select {
  background-color: var(--bg-card) !important;
  color: #000000 !important;
  border-color: var(--border-color) !important;
  font-weight: 500 !important;
}

/* ============================================================
   READABILITY OVERRIDES — black + bolder text everywhere in light mode
   User reported: "I cannot read it" — force pure black + bolder fonts
   ============================================================ */

/* Base body text */
:root:not([data-theme="dark"]) body,
:root:not([data-theme="dark"]) #root,
:root:not([data-theme="dark"]) p,
:root:not([data-theme="dark"]) span,
:root:not([data-theme="dark"]) div,
:root:not([data-theme="dark"]) li,
:root:not([data-theme="dark"]) td,
:root:not([data-theme="dark"]) label,
:root:not([data-theme="dark"]) a {
  color: #000000;
}

/* Override any muted/grey text colors that came from the bundle */
:root:not([data-theme="dark"]) [style*="color:#94A3B8"],
:root:not([data-theme="dark"]) [style*="color: #94A3B8"],
:root:not([data-theme="dark"]) [style*="color:#94a3b8"],
:root:not([data-theme="dark"]) [style*="color: #94a3b8"],
:root:not([data-theme="dark"]) [style*="color:#64748B"],
:root:not([data-theme="dark"]) [style*="color: #64748B"],
:root:not([data-theme="dark"]) [style*="color:#64748b"],
:root:not([data-theme="dark"]) [style*="color: #64748b"],
:root:not([data-theme="dark"]) [style*="color:#475569"],
:root:not([data-theme="dark"]) [style*="color: #475569"],
:root:not([data-theme="dark"]) [style*="color:#6b7280"],
:root:not([data-theme="dark"]) [style*="color: #6b7280"],
:root:not([data-theme="dark"]) [style*="color:#9ca3af"],
:root:not([data-theme="dark"]) [style*="color: #9ca3af"],
:root:not([data-theme="dark"]) [style*="color:#8e8e93"],
:root:not([data-theme="dark"]) [style*="color: #8e8e93"],
:root:not([data-theme="dark"]) [style*="color:#9b9bb0"],
:root:not([data-theme="dark"]) [style*="color: #9b9bb0"],
:root:not([data-theme="dark"]) [style*="color:#6b6b88"],
:root:not([data-theme="dark"]) [style*="color: #6b6b88"],
:root:not([data-theme="dark"]) [style*="color:#0F172A"],
:root:not([data-theme="dark"]) [style*="color: #0F172A"] {
  color: #000000 !important;
}

/* Headings always bold + black */
:root:not([data-theme="dark"]) h1,
:root:not([data-theme="dark"]) h2,
:root:not([data-theme="dark"]) h3,
:root:not([data-theme="dark"]) h4,
:root:not([data-theme="dark"]) h5,
:root:not([data-theme="dark"]) h6 {
  color: #000000 !important;
  font-weight: 700 !important;
}

/* Bump generic weight to medium so everything reads clearly */
:root:not([data-theme="dark"]) [style*="font-weight:400"],
:root:not([data-theme="dark"]) [style*="font-weight: 400"],
:root:not([data-theme="dark"]) [style*="fontWeight:400"],
:root:not([data-theme="dark"]) [style*="fontWeight: 400"] {
  font-weight: 500 !important;
}
:root:not([data-theme="dark"]) [style*="font-weight:500"],
:root:not([data-theme="dark"]) [style*="font-weight: 500"],
:root:not([data-theme="dark"]) [style*="fontWeight:500"],
:root:not([data-theme="dark"]) [style*="fontWeight: 500"] {
  font-weight: 600 !important;
}

/* Table content */
:root:not([data-theme="dark"]) table,
:root:not([data-theme="dark"]) th,
:root:not([data-theme="dark"]) td {
  color: #000000 !important;
}
:root:not([data-theme="dark"]) th {
  font-weight: 700 !important;
}

/* Buttons that have BLUE background — keep their text WHITE */
:root:not([data-theme="dark"]) [style*="background:#2563EB"],
:root:not([data-theme="dark"]) [style*="background: #2563EB"],
:root:not([data-theme="dark"]) [style*="background:#3B82F6"],
:root:not([data-theme="dark"]) [style*="background: #3B82F6"],
:root:not([data-theme="dark"]) [style*="background:#1E40AF"],
:root:not([data-theme="dark"]) [style*="background: #1E40AF"],
:root:not([data-theme="dark"]) [style*="background:#10b981"],
:root:not([data-theme="dark"]) [style*="background:#059669"],
:root:not([data-theme="dark"]) [style*="background:#ef4444"],
:root:not([data-theme="dark"]) [style*="background:#dc2626"],
:root:not([data-theme="dark"]) [style*="background:linear-gradient"] {
  color: #ffffff !important;
}

/* Sidebar — light surface, dark text. Inline styles in sidebar.js handle
   per-element color now, so we only force the SURFACE here, not every child
   (that was making white-on-color text invisible on the rail badges). */
:root:not([data-theme="dark"]) .ck-sidebar,
:root:not([data-theme="dark"]) [class*="sidebar"]:not(.tb-brien-panel) {
  background-color: #FFFFFF !important;
  border-right: 1px solid #E2E8F0 !important;
}

/* ============================================================
   SIDEBAR PANEL — force every container in the sidebar to be light.
   The expandable middle panel was rendering black on some users — this
   forces every wrapper, body container, and nav item to a light surface.
   .ck-body is the scrollable nav list, .ck-ni is each NavItem.
   ============================================================ */
.ck-body {
  background-color: #FFFFFF !important;
  background-image: none !important;
}
.ck-body * { color: inherit; }
.ck-ni {
  background-color: transparent !important;
  color: #0F172A !important;
}
.ck-ni:hover { background-color: #F1F5F9 !important; }
.ck-ni:hover .ck-ni-lbl { color: #0F172A !important; }
.ck-ni-lbl { color: #0F172A !important; }
.ck-srch { background-color: #FFFFFF !important; color: #000000 !important; }
/* Active state — use blue accent instead of white */
.ck-ni[data-active="true"] { background-color: #DBEAFE !important; }
.ck-ni[data-active="true"] .ck-ni-lbl { color: #1E40AF !important; font-weight: 600 !important; }

/* ============================================================
   NUCLEAR OVERRIDES — catch anything still rendering dark
   Matches ANY inline style with a dark hex code and forces it light.
   ============================================================ */
[style*="background:#000"],
[style*="background: #000"],
[style*="background-color:#000"],
[style*="background-color: #000"],
[style*="background:#0a0a0a"],
[style*="background: #0a0a0a"],
[style*="background:#050507"],
[style*="background: #050507"],
[style*="background:#0c0d10"],
[style*="background: #0c0d10"],
[style*="background:#0e0e0e"],
[style*="background: #0e0e0e"],
[style*="background:#0f0f0f"],
[style*="background: #0f0f0f"],
[style*="background:#111"],
[style*="background: #111"],
[style*="background:#141414"],
[style*="background: #141414"],
[style*="background:#171717"],
[style*="background: #171717"],
[style*="background:#181818"],
[style*="background: #181818"],
[style*="background:#1a1a1a"],
[style*="background: #1a1a1a"],
[style*="background:#1c1c1e"],
[style*="background: #1c1c1e"],
[style*="background:#1f1f1f"],
[style*="background: #1f1f1f"],
[style*="background:#1f2024"],
[style*="background: #1f2024"],
[style*="background:#1f2937"],
[style*="background: #1f2937"],
[style*="background:#0f1012"],
[style*="background: #0f1012"],
[style*="background:#16181c"],
[style*="background: #16181c"],
[style*="background:#1e2026"],
[style*="background: #1e2026"],
[style*="background:#252830"],
[style*="background: #252830"] {
  background-color: #FFFFFF !important;
}

/* Page wrappers / shells that take up full bg */
[style*="background:#0a0a0a"][style*="min-height"],
[style*="background: #0a0a0a"][style*="min-height"],
[style*="background:#000"][style*="min-height"],
[style*="background: #000"][style*="min-height"] {
  background-color: #F8FAFC !important;
}

/* All text */
[style*="color:#fff"]:not([style*="background:#2563EB"]):not([style*="background: #2563EB"]):not([style*="background:#3B82F6"]):not([style*="background: #3B82F6"]):not([style*="background:#1E40AF"]):not([style*="background: #1E40AF"]):not([style*="background:#059669"]):not([style*="background: #059669"]):not([style*="background:#10b981"]):not([style*="background: #10b981"]):not([style*="background:#DC2626"]):not([style*="background: #DC2626"]):not([style*="background:#ef4444"]):not([style*="background: #ef4444"]):not([style*="background:#D97706"]):not([style*="background: #D97706"]):not([style*="background:#7C3AED"]):not([style*="background: #7C3AED"]):not([style*="background:linear-gradient"]),
[style*="color: #fff"]:not([style*="background:#2563EB"]):not([style*="background: #2563EB"]):not([style*="background:#3B82F6"]):not([style*="background: #3B82F6"]):not([style*="background:#1E40AF"]):not([style*="background: #1E40AF"]):not([style*="background:#059669"]):not([style*="background: #059669"]):not([style*="background:#10b981"]):not([style*="background: #10b981"]):not([style*="background:#DC2626"]):not([style*="background: #DC2626"]):not([style*="background:#ef4444"]):not([style*="background: #ef4444"]):not([style*="background:#D97706"]):not([style*="background: #D97706"]):not([style*="background:#7C3AED"]):not([style*="background: #7C3AED"]):not([style*="background:linear-gradient"]) {
  color: #000000 !important;
}

/* Borders */
[style*="border:1px solid #2a2a2a"],
[style*="border: 1px solid #2a2a2a"],
[style*="border:1px solid #1f1f1f"],
[style*="border: 1px solid #1f1f1f"],
[style*="border:1px solid #1f2024"],
[style*="border: 1px solid #1f2024"],
[style*="border-color:#2a2a2a"],
[style*="border-color: #2a2a2a"] {
  border-color: #E2E8F0 !important;
}

/* ============================================================
   MOBILE RESPONSIVENESS — stack desktop multi-column layouts
   so the CRM is usable on phones/tablets. Inline-styled grids
   need !important to be overridden. Targets fr-based LAYOUT
   grids only (3fr/2fr/1fr 1fr), NOT repeat(7/8,1fr) calendar
   or emoji grids.
   ============================================================ */
@media (max-width: 900px) {
  [style*="3fr"],
  [style*="2fr"],
  [style*="1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  body { overflow-x: hidden; }
  .panel-card { padding: 14px !important; }
  /* let side-by-side flex rows wrap on phones */
  .top-action-bar { flex-wrap: wrap; }
}
@media (max-width: 620px) {
  .panel-card { padding: 12px !important; border-radius: 12px !important; }
  /* shrink oversized headings on small phones */
  h1 { font-size: 22px !important; }
}
