/* ══════════════════════════════════════════════════════════════════════════
   SENSINOVA ENTERPRISE DESIGN SYSTEM — THEME TOKENS
   Based on Sensinova Brand Guidelines (Version 1.0, 15 October 2026)
   Formula: 80% White / Base • 15% Charcoal Grey • 5% Brand Red Accent
   ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Sensinova Official Brand Font (Gilroy) ── */
@font-face {
  font-family: 'Gilroy';
  src: url('/fonts/gilroy/Gilroy-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('/fonts/gilroy/Gilroy-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('/fonts/gilroy/Gilroy-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('/fonts/gilroy/Gilroy-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('/fonts/gilroy/Gilroy-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('/fonts/gilroy/Gilroy-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('/fonts/gilroy/Gilroy-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ── Display Brand Font (Epic Pro) ── */
@font-face {
  font-family: 'Epic Pro';
  src: url('/fonts/epic-pro/GCEpicPro-Light.woff2') format('woff2'),
       url('/fonts/epic-pro/GCEpicPro-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Epic Pro';
  src: url('/fonts/epic-pro/GCEpicPro-Regular.woff2') format('woff2'),
       url('/fonts/epic-pro/GCEpicPro-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Epic Pro';
  src: url('/fonts/epic-pro/GCEpicPro-Medium.woff2') format('woff2'),
       url('/fonts/epic-pro/GCEpicPro-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Epic Pro';
  src: url('/fonts/epic-pro/GCEpicPro-Bold.woff2') format('woff2'),
       url('/fonts/epic-pro/GCEpicPro-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Epic Pro';
  src: url('/fonts/epic-pro/GCEpicPro-ExtraBold.woff2') format('woff2'),
       url('/fonts/epic-pro/GCEpicPro-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

.font-display,
.font-epic {
  font-family: 'Epic Pro', 'Gilroy', -apple-system, sans-serif !important;
}

:root {
  /* ── Sensinova Brand Constants ── */
  --sn-red: #ED3237;
  --sn-red-hover: #D7282D;
  --sn-red-active: #B81E22;
  --sn-red-subtle: rgba(237, 50, 55, 0.08);
  --sn-red-border: rgba(237, 50, 55, 0.25);
  --sn-charcoal: #383435;
  --sn-charcoal-dark: #221F20;
  --sn-charcoal-light: #4D4849;

  /* ── Light Mode (Strict 80/15/5 Brand Standard) ── */
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #FFFFFF;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);
  --bg-muted: #F1F5F9;
  --bg-muted-hover: #E2E8F0;

  --text-main: #383435;
  --text-heading: #0F172A;
  --text-muted: #64748B;
  --text-faint: #94A3B8;
  --text-inverse: #FFFFFF;

  --border-subtle: #F1F5F9;
  --border-default: #E2E8F0;
  --border-strong: #CBD5E1;

  --card-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --card-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --card-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  --code-bg: #0F172A;
  --code-text: #F8FAFC;
  --code-border: #1E293B;

  --ring-focus: rgba(237, 50, 55, 0.25);
}

/* ── Dark Mode (Executive Charcoal & Dark Slate) ── */
html.dark {
  --bg-app: #0B0F19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1E293B;
  --bg-surface-glass: rgba(17, 24, 39, 0.88);
  --bg-muted: #1E293B;
  --bg-muted-hover: #2B384E;

  --text-main: #F1F5F9;
  --text-heading: #FFFFFF;
  --text-muted: #94A3B8;
  --text-faint: #64748B;
  --text-inverse: #0B0F19;

  --border-subtle: #1E293B;
  --border-default: #334155;
  --border-strong: #475569;

  --card-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --card-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
  --card-shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.5);

  --code-bg: #080C14;
  --code-text: #F1F5F9;
  --code-border: #1E293B;

  --ring-focus: rgba(237, 50, 55, 0.4);
}

/* ── Base Styling & Typography ── */
html,
body,
input,
button,
select,
textarea {
  font-family: 'Gilroy', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code,
pre,
.font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Universal Theme Switcher Widget ── */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: 9999px;
  padding: 2px;
  gap: 2px;
  box-shadow: var(--card-shadow-sm);
  transition: all 0.2s ease;
}

.theme-switcher-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.theme-switcher-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-muted-hover);
}

.theme-switcher-btn.active {
  background-color: var(--bg-surface);
  color: var(--sn-red);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

html.dark .theme-switcher-btn.active {
  background-color: var(--bg-surface-elevated);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ── Sensinova Brand Components ── */
.btn-brand-primary {
  background-color: var(--sn-charcoal);
  color: #FFFFFF;
  font-weight: 700;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  box-shadow: var(--card-shadow-sm);
}

.btn-brand-primary:hover {
  background-color: var(--sn-charcoal-dark);
  transform: translateY(-1px);
}

.btn-brand-primary:active {
  transform: scale(0.98);
}

.btn-brand-accent {
  background-color: var(--sn-red);
  color: #FFFFFF;
  font-weight: 700;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(237, 50, 55, 0.25);
}

.btn-brand-accent:hover {
  background-color: var(--sn-red-hover);
  box-shadow: 0 4px 12px rgba(237, 50, 55, 0.35);
  transform: translateY(-1px);
}

.btn-brand-accent:active {
  transform: scale(0.98);
}

.badge-brand-accent {
  background-color: var(--sn-red-subtle);
  color: var(--sn-red);
  border: 1px solid var(--sn-red-border);
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ══════════════════════════════════════════════════════════════════════════
   SENSINOVA SHIMMER SKELETON LOADING ENGINE
   Dual-Theme wave animation with Zero CLS (Cumulative Layout Shift)
   ══════════════════════════════════════════════════════════════════════════ */
@keyframes shimmerWave {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(90deg, #f1f5f9 20%, #e2e8f0 50%, #f1f5f9 80%);
  background-size: 200% 100%;
  animation: shimmerWave 1.6s infinite ease-in-out;
  border-radius: 0.5rem;
  display: block;
  pointer-events: none;
}

html.dark .skeleton-shimmer {
  background: linear-gradient(90deg, #1e293b 20%, #334155 50%, #1e293b 80%);
  background-size: 200% 100%;
}

.skeleton-circle {
  border-radius: 9999px !important;
}

.skeleton-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--card-shadow-sm);
}

.fade-in-entry {
  animation: fadeInEntry 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInEntry {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Inline Spinner for Buttons & Actions */
.sn-spinner {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid rgba(237, 50, 55, 0.2);
  border-top-color: var(--sn-red);
  border-radius: 50%;
  animation: snSpin 0.65s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes snSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   SENSINOVA UNIVERSAL DARK MODE HARMONIZATION
   Guarantees crisp brand logo visibility, contrast integrity, and zero glare
   ══════════════════════════════════════════════════════════════════════════ */

/* Sensinova Brand Logo in Dark Mode:
   Invert turns black letters to white, hue-rotate(180deg) restores brand red #ED3237 */
html.dark img[src*="sensinova-logo"],
html.dark img[alt*="Sensinova Logo"],
html.dark img[alt="Logo"],
html.dark .brand-logo img {
  filter: invert(1) hue-rotate(180deg) !important;
  mix-blend-mode: normal !important;
  background-color: transparent !important;
}

/* Universal Dark Surface Enhancements */
html.dark .glass-card {
  background: rgba(17, 24, 39, 0.90) !important;
  border-color: rgba(51, 65, 85, 0.65) !important;
}

html.dark .glass-sidebar {
  background: rgba(17, 24, 39, 0.96) !important;
  border-color: rgba(51, 65, 85, 0.65) !important;
}

/* Form Controls & Color-Scheme Standard in Dark Mode */
html.dark select,
html.dark input[type="text"],
html.dark input[type="search"],
html.dark input[type="password"],
html.dark input[type="email"],
html.dark textarea {
  color-scheme: dark;
}

/* Universal Custom Scrollbars for Dark Mode */
html.dark ::-webkit-scrollbar-track {
  background: #0B0F19;
}

html.dark ::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}

html.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Universal Sidebar Navigation Items in Dark Mode (Eliminates Light Grey Hover Pill Glare) */
html.dark aside nav a:not(.nav-link-active),
html.dark .glass-sidebar nav a:not(.nav-link-active) {
  color: #94A3B8 !important;
}

html.dark aside nav a:not(.nav-link-active):hover,
html.dark .glass-sidebar nav a:not(.nav-link-active):hover {
  background-color: rgba(30, 41, 59, 0.75) !important;
  color: #F8FAFC !important;
}

/* Universal Table Row Transparency & Dark Hover */
html.dark table tbody tr {
  background-color: transparent !important;
}

html.dark tr.log-row,
html.dark tr.row-hover {
  background-color: transparent !important;
  color: #F1F5F9 !important;
}

html.dark .row-hover:hover,
html.dark tr.hover\:bg-slate-50\/90:hover,
html.dark tr.hover\:bg-slate-50\/60:hover {
  background-color: rgba(30, 41, 59, 0.65) !important;
}

/* Universal Conversation Item Active State */
html.dark .convo-active {
  background: #1E293B !important;
  border-color: #334155 !important;
  border-left: 3px solid #ED3237 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}
html.dark .convo-active p,
html.dark .convo-active span {
  color: #F8FAFC !important;
}
html.dark .convo-active .text-slate-400,
html.dark .convo-active .text-slate-500 {
  color: #94A3B8 !important;
}

/* Universal Brand Logo Anchor Transparency in Dark Mode */
html.dark a:has(img[src*="sensinova-logo"]),
html.dark a:has(img[alt*="Sensinova Logo"]),
html.dark a:has(img[alt="Logo"]),
html.dark .logo-box {
  background: transparent !important;
  background-color: transparent !important;
}

/* Universal VIP / Attention Mode Banner in Dark Mode */
html.dark #modeBanner.bg-amber-50,
html.dark #modeBanner:has(.ri-alarm-warning-line),
html.dark #modeBanner:has(.ri-error-warning-line) {
  background-color: rgba(69, 26, 3, 0.65) !important;
  color: #fcd34d !important;
  border-bottom-color: rgba(180, 83, 9, 0.45) !important;
}
html.dark #modeBanner b {
  color: #fef08a !important;
}
html.dark #modeBanner.bg-emerald-50\/70,
html.dark #modeBanner:has(.ri-robot-2-line) {
  background-color: rgba(6, 78, 59, 0.5) !important;
  color: #6ee7b7 !important;
  border-bottom-color: rgba(5, 150, 105, 0.4) !important;
}

/* Universal Text Chips (Canned Replies / Quick Suggestions) in Dark Mode */
html.dark #cannedRow button,
html.dark .text-chip {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
html.dark #cannedRow button:hover,
html.dark .text-chip:hover {
  background-color: #334155 !important;
  border-color: #ed3237 !important;
  color: #f8fafc !important;
}
html.dark footer .bg-gradient-to-l.from-white {
  background-image: linear-gradient(to left, #0b0f19, transparent) !important;
}

/* Universal Empty State Circle & Details Pane (No lead selected) */
html.dark #detailsPane {
  background-color: #111827 !important;
  border-left-color: #334155 !important;
}
html.dark #detailsBody .rounded-full.bg-slate-100,
html.dark .rounded-full.bg-slate-100 {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #64748b !important;
}
html.dark #detailsBody .text-slate-300 {
  color: #64748b !important;
}

/* Universal Divider Lines in Dark Mode (Eliminates Glaring White Lines) */
html.dark .border-slate-100,
html.dark .border-b.border-slate-100,
html.dark .border-t.border-slate-100 {
  border-color: #334155 !important;
}

/* Universal Channel Tab Active State (White Icon on Red Background) */
.channel-tab-btn.active i,
.channel-tab-btn.active [class*="ri-"],
html.dark .channel-tab-btn.active i,
html.dark .channel-tab-btn.active [class*="ri-"] {
  color: #ffffff !important;
}

/* Universal Sidebar Brand Badge (Sales Copilot) in Epic Pro Font */
aside .bg-slate-100\/50 h1,
aside .bg-slate-100\/60 h1,
.glass-sidebar .bg-slate-100\/50 h1,
.glass-sidebar .bg-slate-100\/60 h1,
.brand-pill h1,
.app-brand-title {
  font-family: 'Epic Pro', 'Gilroy', sans-serif !important;
  letter-spacing: 0.12em;
}

html.dark aside .bg-slate-100\/50,
html.dark aside .bg-slate-100\/60,
html.dark .glass-sidebar .bg-slate-100\/50,
html.dark .glass-sidebar .bg-slate-100\/60 {
  background-color: rgba(30, 41, 59, 0.6) !important;
  border-color: rgba(51, 65, 85, 0.6) !important;
}
html.dark aside .bg-slate-100\/50 h1,
html.dark aside .bg-slate-100\/60 h1,
html.dark .glass-sidebar .bg-slate-100\/50 h1,
html.dark .glass-sidebar .bg-slate-100\/60 h1,
html.dark .brand-pill h1,
html.dark .app-brand-title {
  color: #cbd5e1 !important;
}