/* ==========================================================================
   United Express CRM theme — plain CSS on top of Filament (no Node build).
   Filament 4/5 ships its styles in CSS layers; these rules are unlayered,
   so they win without !important. Edit the variables to rebrand.
   ========================================================================== */
:root {
  --crm-p: #0d9488;      /* primary (teal 600) */
  --crm-p2: #14b8a6;     /* primary light */
  --crm-pl: #ccfbf1;     /* primary tint */
  --crm-ink: #0f172a;
  --crm-mut: #64748b;
  --crm-line: #e8edf3;
  --crm-bg: #f4f7fa;
  --crm-card: #ffffff;
  --crm-nav: #0b1324;    /* sidebar */
  --crm-amber: #f59e0b;
  --crm-red: #ef4444;
  --crm-green: #10b981;
  --crm-blue: #3b82f6;
  --crm-radius: 18px;
  --crm-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.10);
}
.dark {
  --crm-ink: #e2e8f0;
  --crm-mut: #94a3b8;
  --crm-line: #1e293b;
  --crm-bg: #0a101d;
  --crm-card: #111a2e;
  --crm-pl: rgba(20,184,166,.15);
  --crm-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ---------- page background ---------- */
body.fi-body, .fi-body { background: var(--crm-bg); }
.fi-main-ctn { background: transparent; }

/* ---------- sidebar (dark navy in both modes) ---------- */
.fi-sidebar { background: var(--crm-nav); border: 0; color: #cbd5e1; }
/* safety net: whatever the inner class names are, text and icons stay light on navy */
:where(.fi-sidebar :is(a, button, span, svg):not(.fi-badge):not(.fi-badge *)) { color: #cbd5e1; }
.fi-sidebar :is(.fi-active, .fi-sidebar-item-active, [aria-current="page"]) :is(a, span, svg):not(.fi-badge):not(.fi-badge *),
.fi-sidebar a[aria-current="page"], .fi-sidebar a[aria-current="page"] :is(span, svg) { color: #5eead4; }
.fi-sidebar-header { background: var(--crm-nav); box-shadow: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.fi-sidebar-nav { scrollbar-color: #1e293b transparent; }
.fi-sidebar-group-label { color: #64748b; font-size: .72rem; letter-spacing: .02em; }
.fi-sidebar-group-btn, .fi-sidebar-group-button { color: #64748b; }
.fi-sidebar-group-collapse-btn, .fi-sidebar-group-collapse-button { color: #64748b; }
.fi-sidebar-item-label { color: #cbd5e1; font-weight: 500; }
.fi-sidebar-item-icon, .fi-sidebar-item-grouped-border-part { color: #64748b; }
.fi-sidebar-item-btn, .fi-sidebar-item-button { border-radius: 11px; }
.fi-sidebar-item-btn:hover, .fi-sidebar-item-button:hover { background: rgba(255,255,255,.05); }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn,
.fi-sidebar-item-active > .fi-sidebar-item-button,
.fi-sidebar-item.fi-active > a,
.fi-sidebar-item-active > a { background: rgba(20,184,166,.14); }
.fi-sidebar-item.fi-active .fi-sidebar-item-label,
.fi-sidebar-item-active .fi-sidebar-item-label,
.fi-sidebar-item.fi-active .fi-sidebar-item-icon,
.fi-sidebar-item-active .fi-sidebar-item-icon { color: #5eead4; }
.fi-sidebar .fi-badge { border-radius: 99px; }
.fi-sidebar .fi-icon-btn { color: #94a3b8; }

/* ---------- brand ---------- */
.crm-brand { display: flex; align-items: center; gap: 10px; }
.crm-brand-logo { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--crm-p2), var(--crm-p)); color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 6px 18px rgba(20,184,166,.35); overflow: hidden; }
.crm-brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.crm-brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; color: var(--crm-ink); white-space: nowrap; }
.crm-brand-sub { font-size: 11px; color: var(--crm-mut); font-weight: 500; }
.fi-sidebar .crm-brand-name { color: #fff; }

/* ---------- top bar ---------- */
.fi-topbar, .fi-topbar-ctn > nav { background: rgba(255,255,255,.85); backdrop-filter: blur(8px); box-shadow: none; border-bottom: 1px solid var(--crm-line); }
.dark .fi-topbar, .dark .fi-topbar-ctn > nav { background: rgba(17,26,46,.85); }
.fi-global-search-field .fi-input-wrp { border-radius: 12px; background: #f1f5f9; box-shadow: none; }
.dark .fi-global-search-field .fi-input-wrp { background: #0f172a; }

/* ---------- surfaces ---------- */
.fi-section, .fi-wi-stats-overview-stat, .fi-ta-ctn, .fi-fo-tabs, .fi-sc-tabs, .fi-in-entry-wrp-ctn {
  border-radius: var(--crm-radius); }
.fi-section, .fi-wi-stats-overview-stat, .fi-ta-ctn {
  box-shadow: var(--crm-shadow); border: 1px solid #eef2f6; }
.dark .fi-section, .dark .fi-wi-stats-overview-stat, .dark .fi-ta-ctn { border-color: var(--crm-line); background: var(--crm-card); }
.fi-wi-stats-overview-stat-value { font-weight: 700; letter-spacing: -.01em; }
.fi-ta-header-cell { font-weight: 600; color: var(--crm-mut); }
.fi-ta-row:hover { background: rgba(20,184,166,.04); }
.fi-header-heading { font-weight: 700; letter-spacing: -.01em; }

/* ---------- controls ---------- */
.fi-btn { border-radius: 12px; font-weight: 600; }
.fi-btn.fi-color-primary, .fi-btn-color-primary { box-shadow: 0 6px 16px -6px rgba(13,148,136,.55); }
.fi-badge { border-radius: 99px; }
.fi-input-wrp { border-radius: 12px; }
.fi-modal-window { border-radius: 22px; }
.fi-dropdown-panel { border-radius: 14px; }

/* phone inputs keep digit groups in order inside the RTL layout */
input[type="tel"] { direction: ltr; text-align: end; unicode-bidi: plaintext; }
.crm-ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.crm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: isolate; font-weight: 600; }

/* ---------- toasts ---------- */
.fi-no-notification { border-radius: 16px; box-shadow: 0 14px 34px -12px rgba(15,23,42,.30); border-inline-start: 4px solid var(--crm-p); }

/* ---------- empty states ---------- */
.fi-ta-empty-state-icon-ctn, .fi-ta-empty-state-icon-bg { background: var(--crm-pl); border-radius: 22px; }
.fi-ta-empty-state-icon { color: var(--crm-p); }
.fi-ta-empty-state-heading { font-weight: 700; }

/* ==========================================================================
   Login page — split layout with a branded panel
   ========================================================================== */
.fi-simple-layout:has(.crm-auth-hero) { flex-direction: row; align-items: stretch; background: #fff; }
.dark .fi-simple-layout:has(.crm-auth-hero) { background: var(--crm-bg); }
.fi-simple-layout:has(.crm-auth-hero) > .fi-simple-main-ctn { flex: 1 1 0; }
.fi-simple-layout:has(.crm-auth-hero) .fi-simple-main { box-shadow: none; background: transparent; border: 0; }
.crm-auth-hero { order: 2; flex: 1.1 1 0; position: relative; overflow: hidden; color: #fff; padding: 56px;
  background: radial-gradient(circle at 30% 20%, #134e4a, #0b1324 60%); display: flex; flex-direction: column; justify-content: space-between; }
.crm-auth-hero .ring { position: absolute; border-radius: 50%; border: 1px solid rgba(94,234,212,.15); }
.crm-auth-hero h2 { font-size: 38px; line-height: 1.35; font-weight: 700; margin: 0; }
.crm-auth-hero h2 span { color: #5eead4; }
.crm-auth-hero p { color: #94a3b8; font-size: 16px; margin-top: 14px; max-width: 470px; }
.crm-auth-hero .chips { display: flex; gap: 12px; flex-wrap: wrap; position: relative; }
.crm-auth-hero .chip { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 14px 18px; }
.crm-auth-hero .chip b { display: block; font-size: 18px; }
.crm-auth-hero .chip small { color: #94a3b8; font-size: 12.5px; }
.crm-auth-hero .live { align-self: flex-start; background: rgba(94,234,212,.15); color: #5eead4; border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; position: relative; }
@media (max-width: 1023px) { .crm-auth-hero { display: none; } .fi-simple-layout:has(.crm-auth-hero) { flex-direction: column; } }

/* ==========================================================================
   Shared building blocks for the custom pages (crm-*)
   ========================================================================== */
.crm-card { background: var(--crm-card); border-radius: var(--crm-radius); padding: 16px 18px; box-shadow: var(--crm-shadow); border: 1px solid #eef2f6; min-width: 0; }
.dark .crm-card { border-color: var(--crm-line); }
.crm-card-title { font-weight: 700; font-size: 15px; color: var(--crm-ink); }
.crm-mut { color: var(--crm-mut); font-size: 12.5px; }
.crm-grid { display: grid; gap: 14px; }
.crm-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.crm-pill-success { background: #ecfdf5; color: #047857; } .crm-pill-danger { background: #fef2f2; color: #dc2626; }
.crm-pill-warning { background: #fffbeb; color: #b45309; } .crm-pill-info { background: #eff6ff; color: #1d4ed8; }
.crm-pill-primary { background: var(--crm-pl); color: #0f766e; } .crm-pill-gray { background: #f1f5f9; color: #475569; }
.dark .crm-pill-success { background: rgba(16,185,129,.15); color: #34d399; } .dark .crm-pill-danger { background: rgba(239,68,68,.15); color: #f87171; }
.dark .crm-pill-warning { background: rgba(245,158,11,.15); color: #fbbf24; } .dark .crm-pill-info { background: rgba(59,130,246,.15); color: #60a5fa; }
.dark .crm-pill-primary { color: #5eead4; } .dark .crm-pill-gray { background: #1e293b; color: #cbd5e1; }
.crm-avatar { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
  background: linear-gradient(135deg, #a7f3d0, #5eead4); color: #065f46; }
.crm-avatar.round { border-radius: 50%; }
.crm-kpi-label { color: var(--crm-mut); font-size: 12.5px; }
.crm-kpi-value { font-size: 28px; font-weight: 700; color: var(--crm-ink); letter-spacing: -.01em; line-height: 1.25; }
.crm-kpi-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 16px; }
.crm-trend-good { color: #059669; font-size: 12px; font-weight: 600; } .crm-trend-bad { color: #dc2626; font-size: 12px; font-weight: 600; }
.crm-bar { height: 8px; background: #eef2f6; border-radius: 99px; overflow: hidden; } .dark .crm-bar { background: #1e293b; }
.crm-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--crm-p2), var(--crm-p)); }
.crm-chip-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--crm-line); border-radius: 14px; padding: 11px 12px;
  font-weight: 600; font-size: 13px; background: var(--crm-card); color: var(--crm-ink); cursor: pointer; text-align: start; width: 100%; }
.crm-chip-btn:hover { border-color: var(--crm-p2); background: var(--crm-pl); }
.crm-chart text { fill: #94a3b8; font-size: 11px; font-family: inherit; }

/* skeleton shimmer */
.crm-sk { background: linear-gradient(90deg, #eef2f6 0%, #f8fafc 50%, #eef2f6 100%); background-size: 200% 100%; animation: crm-sh 1.2s infinite linear; border-radius: 8px; }
.dark .crm-sk { background: linear-gradient(90deg, #1e293b 0%, #263449 50%, #1e293b 100%); background-size: 200% 100%; }
@keyframes crm-sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* empty state */
.crm-empty { text-align: center; padding: 28px 12px; }
.crm-empty svg { margin: 0 auto; display: block; }
.crm-empty b { display: block; font-size: 16px; margin-top: 10px; color: var(--crm-ink); }

/* ==========================================================================
   Inbox (WhatsApp style)
   ========================================================================== */
.crm-inbox { display: grid; grid-template-columns: 330px minmax(0,1fr) 300px; height: calc(100vh - 10.5rem); min-height: 34rem;
  background: var(--crm-card); border-radius: var(--crm-radius); box-shadow: var(--crm-shadow); border: 1px solid #eef2f6; overflow: hidden; }
.dark .crm-inbox { border-color: var(--crm-line); }
.crm-inbox-list { border-inline-end: 1px solid var(--crm-line); display: flex; flex-direction: column; min-height: 0; }
.crm-inbox-item { display: flex; gap: 12px; padding: 11px 14px; width: 100%; text-align: start; border-inline-start: 3px solid transparent; }
.crm-inbox-item:hover { background: rgba(20,184,166,.05); }
.crm-inbox-item.on { background: var(--crm-pl); border-inline-start-color: var(--crm-p); }
.crm-ch-badge { width: 18px; height: 18px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 10px;
  position: absolute; bottom: -2px; inset-inline-end: -2px; border: 2px solid var(--crm-card); }
.crm-ch-whatsapp { background: #22c55e; } .crm-ch-messenger { background: linear-gradient(135deg,#3b82f6,#a855f7); } .crm-ch-instagram { background: linear-gradient(135deg,#f59e0b,#ec4899,#8b5cf6); }
.crm-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; background-color: #efeae2;
  background-image: radial-gradient(#e2dbd0 1px, transparent 1px); background-size: 18px 18px; }
.dark .crm-thread { background-color: #0b141a; background-image: radial-gradient(#16232b 1px, transparent 1px); }
.crm-thread-head { background: var(--crm-card); padding: 10px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--crm-line); flex-wrap: wrap; }
.crm-msgs { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 8px; }
.crm-bubble { max-width: 64%; padding: 8px 12px 6px; border-radius: 16px; box-shadow: 0 1px 1px rgba(0,0,0,.07); white-space: pre-wrap; font-size: 14px; line-height: 1.55; color: #111b21; word-wrap: break-word; }
.crm-bubble.in { align-self: flex-start; background: #fff; border-start-start-radius: 4px; }
.crm-bubble.out { align-self: flex-end; background: #d9fdd3; border-start-end-radius: 4px; }
.crm-bubble.bot { align-self: flex-end; background: #e0f2f1; border-start-end-radius: 4px; }
.dark .crm-bubble { color: #e9edef; } .dark .crm-bubble.in { background: #202c33; } .dark .crm-bubble.out { background: #005c4b; } .dark .crm-bubble.bot { background: #134e4a; }
.crm-bubble .who { font-size: 11.5px; font-weight: 700; color: #0f766e; margin-bottom: 2px; } .dark .crm-bubble .who { color: #5eead4; }
.crm-bubble .meta { font-size: 11px; color: #667781; margin-top: 2px; text-align: end; white-space: nowrap; } .dark .crm-bubble .meta { color: #8696a0; }
.crm-tick-read { color: #53bdeb; } .crm-tick-failed { color: #ef4444; }
.crm-sys { align-self: center; background: #fef3c7; color: #92400e; border-radius: 10px; padding: 4px 12px; font-size: 12px; }
.dark .crm-sys { background: rgba(245,158,11,.15); color: #fbbf24; }
.crm-media { width: 220px; max-width: 100%; height: 120px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 28px; background: linear-gradient(135deg,#cbd5e1,#94a3b8); margin-bottom: 4px; }
.crm-composer { background: var(--crm-card); padding: 10px 14px; border-top: 1px solid var(--crm-line); }
.crm-composer textarea { flex: 1; background: #f1f5f9; border: 0; border-radius: 22px; padding: 11px 18px; resize: none; color: var(--crm-ink); font-size: 14px; outline: none; }
.dark .crm-composer textarea { background: #0f172a; }
.crm-send { width: 44px; height: 44px; border-radius: 50%; background: var(--crm-p); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.crm-quick { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; }
.crm-inbox-side { border-inline-start: 1px solid var(--crm-line); padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
@media (max-width: 1279px) { .crm-inbox { grid-template-columns: 280px minmax(0,1fr); } .crm-inbox-side { display: none; } }

/* ==========================================================================
   Wallboard (dark, TV friendly)
   ========================================================================== */
.crm-wb { background: #060b16; color: #e2e8f0; border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.crm-wb.tv { position: fixed; inset: 0; z-index: 60; border-radius: 0; padding: 30px; overflow: auto; }
.crm-wb-tile { background: #0d1526; border: 1px solid #1a2540; border-radius: 22px; padding: 20px; min-width: 0; }
.crm-wb-label { color: #64748b; font-size: 15px; }
.crm-wb-big { font-size: 54px; font-weight: 700; line-height: 1.2; margin-top: 4px; color: #fff; }
.crm-wb-agent { background: #111c33; border-radius: 16px; padding: 14px; border-top: 4px solid #334155; }
.crm-wb.tv .crm-wb-big { font-size: 64px; }

/* ==========================================================================
   Command palette (Ctrl + K)
   ========================================================================== */
.crm-cmdk-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(15,23,42,.55); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.crm-cmdk { width: 560px; max-width: calc(100vw - 2rem); background: var(--crm-card); border-radius: 18px; box-shadow: 0 30px 60px -12px rgba(0,0,0,.45); overflow: hidden; color: var(--crm-ink); }
.crm-cmdk input { width: 100%; border: 0; border-bottom: 1px solid var(--crm-line); padding: 16px 18px; font-size: 16px; background: transparent; outline: none; color: var(--crm-ink); }
.crm-cmdk-group { color: var(--crm-mut); font-size: 12px; padding: 8px 18px 4px; }
.crm-cmdk-item { display: flex; gap: 10px; align-items: center; padding: 9px 14px; margin: 0 6px; border-radius: 12px; color: var(--crm-ink); }
.crm-cmdk-item:hover, .crm-cmdk-item.on { background: var(--crm-pl); }
.crm-kbd { font-size: 11px; background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 6px; padding: 1px 6px; color: var(--crm-mut); margin-inline-start: auto; }
.crm-wb .crm-brand-name { color: #fff; } .crm-wb .crm-brand-sub { color: #64748b; }
[x-cloak] { display: none !important; }
.crm-cmdk-hint { display: inline-flex; align-items: center; gap: 8px; background: #f1f5f9; color: var(--crm-mut); border-radius: 12px; padding: 7px 10px 7px 12px; font-size: 13px; margin-inline-end: 8px; white-space: nowrap; }
.dark .crm-cmdk-hint { background: #0f172a; }
.crm-cmdk-hint .crm-kbd { margin: 0; }
@media (max-width: 767px) { .crm-cmdk-hint { display: none; } }
