/* =============================================================================
   CallCenter themes — one colour system for the agent app, company panel,
   admin console and login pages.

   Every theme defines the same --c-* tokens. The existing variable names used
   by each part of the product (--bg, --panel, --t1, --line ...) are mapped to
   these tokens below, so switching data-theme on <html> re-colours everything.
   Hard-coded colours in older stylesheets were converted to
   var(--c-token, #original) so they follow the theme as well.
   ============================================================================= */

/* ---------- Midnight (default) ---------- */
:root, html[data-theme="midnight"] {
  color-scheme: dark;
  --c-bg:#0b0e14; --c-surface:#11151d; --c-surface2:#161b24; --c-surface3:#1b2130; --c-input:#0e1219;
  --c-line:#232a36; --c-line2:#2d3645;
  --c-text:#e6e9ef; --c-text2:#c3cad7; --c-muted:#8b95a7; --c-faint:#5d6778; --c-heading:#ffffff;
  --c-accent:#4f8cff; --c-accent-strong:#3b6fe0; --c-accent2:#7c5cff; --c-on-accent:#ffffff;
  --c-accent-soft:rgba(79,140,255,.13); --c-accent-glow:rgba(79,140,255,.35);
  --c-ok:#2ecc71; --c-warn:#f5a524; --c-bad:#ff5a5f;
  --c-ok-soft:rgba(46,204,113,.13); --c-warn-soft:rgba(245,165,36,.13); --c-bad-soft:rgba(255,90,95,.12);
  --c-topbar:rgba(11,14,20,.85); --c-shadow:0 10px 30px rgba(0,0,0,.35); --c-overlay:rgba(3,5,9,.6);
  --c-ok-solid:#16a34a; --c-bad-solid:#dc2626;
}

/* ---------- Graphite: neutral grey, teal accent ---------- */
html[data-theme="graphite"] {
  color-scheme: dark;
  --c-bg:#0f1012; --c-surface:#16171a; --c-surface2:#1c1e21; --c-surface3:#232528; --c-input:#121315;
  --c-line:#2a2c30; --c-line2:#36393e;
  --c-text:#ececee; --c-text2:#c9cbce; --c-muted:#979a9f; --c-faint:#6b6e74; --c-heading:#ffffff;
  --c-accent:#14b8a6; --c-accent-strong:#0d9488; --c-accent2:#38bdf8; --c-on-accent:#04201d;
  --c-accent-soft:rgba(20,184,166,.14); --c-accent-glow:rgba(20,184,166,.32);
  --c-ok:#22c55e; --c-warn:#f59e0b; --c-bad:#f43f5e;
  --c-ok-soft:rgba(34,197,94,.13); --c-warn-soft:rgba(245,158,11,.13); --c-bad-soft:rgba(244,63,94,.12);
  --c-topbar:rgba(15,16,18,.86); --c-shadow:0 10px 30px rgba(0,0,0,.4); --c-overlay:rgba(0,0,0,.6);
  --c-ok-solid:#16a34a; --c-bad-solid:#e11d48;
}

/* ---------- Ocean: deep navy, cyan accent ---------- */
html[data-theme="ocean"] {
  color-scheme: dark;
  --c-bg:#06101d; --c-surface:#0b182b; --c-surface2:#0f2037; --c-surface3:#142843; --c-input:#081425;
  --c-line:#1a3150; --c-line2:#243e63;
  --c-text:#e3edf9; --c-text2:#bccfe6; --c-muted:#85a0c2; --c-faint:#587296; --c-heading:#ffffff;
  --c-accent:#22b8f0; --c-accent-strong:#0e9ad1; --c-accent2:#6c8cff; --c-on-accent:#03202e;
  --c-accent-soft:rgba(34,184,240,.14); --c-accent-glow:rgba(34,184,240,.32);
  --c-ok:#2dd4a0; --c-warn:#fbbf24; --c-bad:#fb5a6e;
  --c-ok-soft:rgba(45,212,160,.13); --c-warn-soft:rgba(251,191,36,.13); --c-bad-soft:rgba(251,90,110,.12);
  --c-topbar:rgba(6,16,29,.86); --c-shadow:0 10px 30px rgba(0,8,20,.45); --c-overlay:rgba(2,8,18,.62);
  --c-ok-solid:#059669; --c-bad-solid:#e11d48;
}

/* ---------- Emerald: dark green, emerald accent ---------- */
html[data-theme="emerald"] {
  color-scheme: dark;
  --c-bg:#07110c; --c-surface:#0d1913; --c-surface2:#122119; --c-surface3:#172a20; --c-input:#09140e;
  --c-line:#1e3428; --c-line2:#294535;
  --c-text:#e4f2e9; --c-text2:#c0d8c9; --c-muted:#8aa997; --c-faint:#5c7a68; --c-heading:#ffffff;
  --c-accent:#10b981; --c-accent-strong:#059669; --c-accent2:#22d3ee; --c-on-accent:#03241a;
  --c-accent-soft:rgba(16,185,129,.14); --c-accent-glow:rgba(16,185,129,.32);
  --c-ok:#4ade80; --c-warn:#facc15; --c-bad:#f87171;
  --c-ok-soft:rgba(74,222,128,.13); --c-warn-soft:rgba(250,204,21,.13); --c-bad-soft:rgba(248,113,113,.12);
  --c-topbar:rgba(7,17,12,.86); --c-shadow:0 10px 30px rgba(0,0,0,.42); --c-overlay:rgba(0,6,3,.6);
  --c-ok-solid:#16a34a; --c-bad-solid:#dc2626;
}

/* ---------- Aurora: dark violet, violet + pink ---------- */
html[data-theme="aurora"] {
  color-scheme: dark;
  --c-bg:#0c0915; --c-surface:#131020; --c-surface2:#19152a; --c-surface3:#201b35; --c-input:#0f0c1a;
  --c-line:#2a2242; --c-line2:#372d55;
  --c-text:#ece8f8; --c-text2:#cdc5e7; --c-muted:#998fb9; --c-faint:#6b628a; --c-heading:#ffffff;
  --c-accent:#8b5cf6; --c-accent-strong:#7c3aed; --c-accent2:#ec4899; --c-on-accent:#ffffff;
  --c-accent-soft:rgba(139,92,246,.16); --c-accent-glow:rgba(139,92,246,.36);
  --c-ok:#34d399; --c-warn:#fbbf24; --c-bad:#fb7185;
  --c-ok-soft:rgba(52,211,153,.13); --c-warn-soft:rgba(251,191,36,.13); --c-bad-soft:rgba(251,113,133,.12);
  --c-topbar:rgba(12,9,21,.86); --c-shadow:0 10px 30px rgba(6,0,18,.45); --c-overlay:rgba(6,2,14,.62);
  --c-ok-solid:#059669; --c-bad-solid:#e11d48;
}

/* ---------- Sunset: warm dark, orange + rose ---------- */
html[data-theme="sunset"] {
  color-scheme: dark;
  --c-bg:#110c0a; --c-surface:#19120f; --c-surface2:#201814; --c-surface3:#281f19; --c-input:#140e0c;
  --c-line:#33271e; --c-line2:#433428;
  --c-text:#f6ede6; --c-text2:#ddcdc1; --c-muted:#a99588; --c-faint:#7b695d; --c-heading:#ffffff;
  --c-accent:#f97316; --c-accent-strong:#ea580c; --c-accent2:#f43f5e; --c-on-accent:#2a1205;
  --c-accent-soft:rgba(249,115,22,.15); --c-accent-glow:rgba(249,115,22,.34);
  --c-ok:#4ade80; --c-warn:#fbbf24; --c-bad:#f87171;
  --c-ok-soft:rgba(74,222,128,.13); --c-warn-soft:rgba(251,191,36,.13); --c-bad-soft:rgba(248,113,113,.12);
  --c-topbar:rgba(17,12,10,.86); --c-shadow:0 10px 30px rgba(10,4,0,.45); --c-overlay:rgba(10,4,0,.6);
  --c-ok-solid:#16a34a; --c-bad-solid:#dc2626;
}

/* ---------- Daylight: clean light, blue accent ---------- */
html[data-theme="daylight"] {
  color-scheme: light;
  --c-bg:#f3f5f9; --c-surface:#ffffff; --c-surface2:#f6f8fb; --c-surface3:#edf1f6; --c-input:#ffffff;
  --c-line:#e2e7ee; --c-line2:#cfd7e2;
  --c-text:#111827; --c-text2:#374151; --c-muted:#5a6475; --c-faint:#848d9c; --c-heading:#0b1220;
  --c-accent:#2563eb; --c-accent-strong:#1d4ed8; --c-accent2:#7c3aed; --c-on-accent:#ffffff;
  --c-accent-soft:rgba(37,99,235,.10); --c-accent-glow:rgba(37,99,235,.25);
  --c-ok:#15803d; --c-warn:#b45309; --c-bad:#dc2626;
  --c-ok-soft:rgba(22,163,74,.11); --c-warn-soft:rgba(217,119,6,.12); --c-bad-soft:rgba(220,38,38,.09);
  --c-topbar:rgba(255,255,255,.88); --c-shadow:0 8px 24px rgba(15,23,42,.08); --c-overlay:rgba(15,23,42,.45);
  --c-ok-solid:#16a34a; --c-bad-solid:#dc2626;
}

/* ---------- Paper: warm light, indigo accent ---------- */
html[data-theme="paper"] {
  color-scheme: light;
  --c-bg:#f5f2ec; --c-surface:#fffdf9; --c-surface2:#faf7f1; --c-surface3:#f1ece3; --c-input:#fffdf9;
  --c-line:#e6dfd2; --c-line2:#d6ccbb;
  --c-text:#1f1a14; --c-text2:#3e372e; --c-muted:#675e52; --c-faint:#93897b; --c-heading:#14100b;
  --c-accent:#4f46e5; --c-accent-strong:#4338ca; --c-accent2:#0d9488; --c-on-accent:#ffffff;
  --c-accent-soft:rgba(79,70,229,.10); --c-accent-glow:rgba(79,70,229,.25);
  --c-ok:#15803d; --c-warn:#b45309; --c-bad:#c2410c;
  --c-ok-soft:rgba(21,128,61,.11); --c-warn-soft:rgba(180,83,9,.12); --c-bad-soft:rgba(194,65,12,.10);
  --c-topbar:rgba(255,253,249,.9); --c-shadow:0 8px 24px rgba(60,45,20,.08); --c-overlay:rgba(40,30,15,.42);
  --c-ok-solid:#15803d; --c-bad-solid:#c2410c;
}

/* ---------- Map each area's own variable names to the theme tokens ----------
   Also applied on <body>, because the company dashboard declares its colours
   on body.cdash. The agent app is excluded there: its "Customize Theme"
   colours are set on <html> and must keep working. */
html:root, html:root body:not(.agent-app) {
  /* agent app (styles.css / features.css) */
  --bg:var(--c-bg); --bg1:var(--c-surface); --bg2:var(--c-surface2); --bg3:var(--c-surface3);
  --border:var(--c-line); --border2:var(--c-line2);
  --accent:var(--c-accent); --green:var(--c-ok); --red:var(--c-bad); --amber:var(--c-warn); --purple:var(--c-accent2);
  --t1:var(--c-text); --t2:var(--c-muted); --t3:var(--c-faint);
  /* admin console + company panel */
  --panel:var(--c-surface); --panel2:var(--c-surface2); --panel3:var(--c-surface3);
  --line:var(--c-line); --line2:var(--c-line2);
  --text:var(--c-text); --text2:var(--c-text2); --muted:var(--c-muted); --faint:var(--c-faint);
  --ok:var(--c-ok); --warn:var(--c-warn); --bad:var(--c-bad);
  --accent2:var(--c-accent2);
}
/* The agent app uses --accent2 as the darker shade of its main colour. */
body.agent-app { --accent2:var(--c-accent-strong); }

/* ---------- Shared polish ---------- */
html, body { background-color:var(--c-bg); }
* { scrollbar-width:thin; scrollbar-color:var(--c-line2) transparent; }
*::-webkit-scrollbar { width:8px; height:8px; }
*::-webkit-scrollbar-track { background:transparent; }
*::-webkit-scrollbar-thumb { background:var(--c-line2); border-radius:8px; border:2px solid transparent; background-clip:padding-box; }
*::-webkit-scrollbar-thumb:hover { background:var(--c-faint); background-clip:padding-box; border:2px solid transparent; }
::selection { background:var(--c-accent-soft); }
input::placeholder, textarea::placeholder { color:var(--c-faint); opacity:1; }

/* =============================================================================
   Theme picker (used in the admin console, company panel and agent app)
   ============================================================================= */
.cc-theme-btn { display:inline-grid; place-items:center; width:34px; height:34px; border-radius:9px; border:1px solid var(--c-line2);
  background:var(--c-surface); color:var(--c-muted); cursor:pointer; padding:0; transition:color .15s, border-color .15s, background .15s; flex-shrink:0; }
.cc-theme-btn:hover, .cc-theme-btn[aria-expanded="true"] { color:var(--c-text); border-color:var(--c-accent); background:var(--c-surface2); }
.cc-theme-btn svg { width:17px; height:17px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.cc-theme-pop { position:fixed; z-index:1000; width:300px; max-width:calc(100vw - 24px); background:var(--c-surface); color:var(--c-text);
  border:1px solid var(--c-line2); border-radius:14px; box-shadow:0 18px 48px rgba(0,0,0,.35); padding:14px; font:13px/1.4 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
.cc-theme-pop[hidden] { display:none; }
.cc-theme-pop h4 { margin:0 0 2px; font-size:13px; font-weight:600; color:var(--c-text); }
.cc-theme-pop p { margin:0 0 12px; font-size:12px; color:var(--c-muted); }
.cc-theme-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.cc-theme-opt { display:flex; flex-direction:column; gap:7px; padding:8px; border-radius:10px; border:1px solid var(--c-line); background:var(--c-surface2);
  cursor:pointer; text-align:left; color:var(--c-text); font:inherit; transition:border-color .15s, transform .15s; }
.cc-theme-opt:hover { border-color:var(--c-line2); transform:translateY(-1px); }
.cc-theme-opt[aria-checked="true"] { border-color:var(--c-accent); box-shadow:0 0 0 2px var(--c-accent-soft); }
.cc-theme-prev { height:40px; border-radius:7px; position:relative; overflow:hidden; border:1px solid rgba(127,127,127,.18); }
.cc-theme-prev i { position:absolute; display:block; border-radius:3px; }
.cc-theme-prev .sb { left:0; top:0; bottom:0; width:28%; }
.cc-theme-prev .card { left:36%; right:8%; top:22%; height:26%; }
.cc-theme-prev .acc { left:36%; width:30%; bottom:18%; height:16%; border-radius:4px; }
.cc-theme-name { display:flex; align-items:center; justify-content:space-between; font-size:12px; font-weight:600; }
.cc-theme-name small { font-weight:500; color:var(--c-faint); font-size:10.5px; }
.cc-theme-check { width:15px; height:15px; border-radius:50%; background:var(--c-accent); display:none; place-items:center; }
.cc-theme-opt[aria-checked="true"] .cc-theme-check { display:grid; }
.cc-theme-check svg { width:9px; height:9px; stroke:#fff; fill:none; stroke-width:3; }
@media (max-width:520px) {
  .cc-theme-pop { left:12px !important; right:12px !important; width:auto; top:auto !important; bottom:12px; }
}

/* =============================================================================
   Sidebar — one professional design for the admin console (.ash-*), the admin
   dashboard (.sb-*) and the company panel (.cdash .sidebar*).
   ============================================================================= */
html .ash-sb, html .sb, html .cdash .sidebar {
  background:var(--c-surface); border-right:1px solid var(--c-line);
  box-shadow:1px 0 0 rgba(0,0,0,.02);
}
/* brand */
html .ash-brand, html .sb-brand, html .cdash .cd-brand { padding:18px 18px 16px; gap:11px; border-bottom:1px solid var(--c-line); }
html .ash-logo, html .sb-logo, html .cdash .cd-logo {
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  background:linear-gradient(135deg,var(--c-accent),var(--c-accent2)); color:#fff;
  box-shadow:0 6px 16px var(--c-accent-glow);
}
html .ash-title, html .sb-title, html .cdash .cd-brand-txt { color:var(--c-heading); font-size:15px; font-weight:700; letter-spacing:.1px; }
html .ash-title small, html .sb-title small, html .cdash .cd-brand-txt small { color:var(--c-faint); font-size:10.5px; font-weight:600; letter-spacing:.8px; margin-top:2px; }
/* nav */
html .ash-nav, html .sb-nav, html .cdash .sidebar-nav { padding:8px 10px 12px; scrollbar-gutter:stable; }
html .ash-nav::-webkit-scrollbar, html .sb-nav::-webkit-scrollbar, html .cdash .sidebar-nav::-webkit-scrollbar { width:6px; }
html .ash-nav::-webkit-scrollbar-thumb, html .sb-nav::-webkit-scrollbar-thumb, html .cdash .sidebar-nav::-webkit-scrollbar-thumb { background:transparent; }
html .ash-nav:hover::-webkit-scrollbar-thumb, html .sb-nav:hover::-webkit-scrollbar-thumb, html .cdash .sidebar-nav:hover::-webkit-scrollbar-thumb { background:var(--c-line2); background-clip:padding-box; }
html .ash-group, html .sb-group, html .cdash .sidebar-group, html .cdash .cd-group {
  font-size:10.5px; font-weight:600; letter-spacing:.9px; text-transform:uppercase; color:var(--c-faint); padding:14px 10px 6px;
}
html .ash-link, html .sb-link, html .cdash .sidebar-item {
  position:relative; display:flex; align-items:center; gap:11px; min-height:36px; padding:7px 10px; margin:1px 0;
  border-radius:9px; color:var(--c-muted); font-size:13.5px; font-weight:500; text-decoration:none; box-shadow:none;
  transition:background .15s, color .15s;
}
html .ash-link:hover, html .sb-link:hover, html .cdash .sidebar-item:hover { background:var(--c-surface2); color:var(--c-text); text-decoration:none; }
html .ash-link.active, html .sb-link.active, html .cdash .sidebar-item.active {
  background:var(--c-accent-soft); color:var(--c-heading); font-weight:600; box-shadow:none;
}
html .ash-link.active::before, html .sb-link.active::before, html .cdash .sidebar-item.active::before {
  content:""; position:absolute; left:-10px; top:8px; bottom:8px; width:3px; border-radius:0 3px 3px 0; background:var(--c-accent);
}
html .ash-link.active svg, html .sb-link.active svg, html .cdash .sidebar-item.active svg { color:var(--c-accent); }
/* footer user card */
html .ash-foot, html .sb-foot, html .cdash .cd-user { border-top:1px solid var(--c-line); padding:12px 14px; gap:10px; }
html .ash-avatar, html .sb-avatar, html .cdash .cd-avatar {
  width:34px; height:34px; border-radius:10px; border:0; color:#fff; font-weight:700;
  background:linear-gradient(135deg,var(--c-accent),var(--c-accent2));
}
/* top bars */
html .ash-top, html .topbar2, html .cdash .cd-top { background:var(--c-topbar); border-bottom:1px solid var(--c-line); }
html .ash-right, html .cdash .cd-top-right { gap:10px; }

/* Short screens: tighten so the whole menu fits without scrolling */
@media (max-height:760px) {
  html .ash-brand, html .sb-brand, html .cdash .cd-brand { padding-top:14px; padding-bottom:12px; }
  html .ash-group, html .sb-group, html .cdash .sidebar-group, html .cdash .cd-group { padding-top:10px; padding-bottom:4px; }
  html .ash-link, html .sb-link, html .cdash .sidebar-item { min-height:33px; padding-top:6px; padding-bottom:6px; }
}

/* =============================================================================
   Login pages: the brand panel stays a deep accent colour in every theme
   ============================================================================= */
html .lg-side, html #login-screen .al-side {
  background:
    radial-gradient(700px 420px at 15% 0%, var(--c-accent-glow), transparent 65%),
    radial-gradient(600px 380px at 100% 100%, rgba(124,92,255,.25), transparent 60%),
    linear-gradient(160deg, #0d1424, #070a12) !important;
  color:#e6e9ef;
}
html .lg-side, html #login-screen .al-side {
  --c-text:#e6e9ef; --c-text2:#c3cad7; --c-muted:#a3adbf; --c-faint:#7b8597; --c-heading:#ffffff; --c-line:rgba(255,255,255,.09); --c-line2:rgba(255,255,255,.14);
  --c-surface:rgba(255,255,255,.05); --c-surface2:rgba(255,255,255,.07);
  --text:#e6e9ef; --text2:#c3cad7; --muted:#a3adbf; --faint:#7b8597; --line:rgba(255,255,255,.09); --line2:rgba(255,255,255,.14);
  --panel:rgba(255,255,255,.05); --panel2:rgba(255,255,255,.07);
  --t1:#e6e9ef; --t2:#a3adbf; --t3:#7b8597; --border:rgba(255,255,255,.09); --bg2:rgba(255,255,255,.05);
}
/* the brand panel's accent must stay light enough to read on its deep background */
html .lg-side, html #login-screen .al-side { --c-accent:#7fa8ff; --accent:#7fa8ff; }
/* dark themes: text inside an accent-tinted button stays light */
html[data-theme="midnight"] .a-btn.primary, html[data-theme="graphite"] .a-btn.primary, html[data-theme="ocean"] .a-btn.primary,
html[data-theme="emerald"] .a-btn.primary, html[data-theme="aurora"] .a-btn.primary, html[data-theme="sunset"] .a-btn.primary { color:var(--c-heading); }
/* light themes: call disposition badge (CDR page) needs a darker label */
html[data-theme="daylight"] .badge-disp, html[data-theme="paper"] .badge-disp { color:#4338ca; background:rgba(99,102,241,.14); }

/* ===== v262: long text without spaces (e.g. "kakhdskdshgjajds…") always wraps
   inside its box instead of running out of cards, bars and pop-ups. Applies to
   the agent page, company panel and admin panel (this file is loaded by all).
   Data tables keep their normal sideways scrolling. ===== */
body { overflow-wrap: break-word; }
table { overflow-wrap: break-word; }
/* theme.js marks the element that holds a very long word (24+ letters, no
   space) — only that element may break it, so short labels never split. */
.cc-longword { overflow-wrap: anywhere !important; }
td.cc-longword { min-width: 160px; }

/* Callback due bar: long notes show 2 lines (full text on hover), buttons always visible */
.callback-bar { min-width: 0; }
.callback-bar-info { min-width: 0; }
.callback-bar-actions { flex-shrink: 0; }
#cb-due-notes { flex-basis: 100%; min-width: 0; margin-left: 0 !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#cb-due-notes:empty { display: none; }
/* long free-text table cells wrap (marked by theme.js) */
td.cc-longcell { white-space: normal !important; overflow-wrap: anywhere; min-width: 200px; }
td.cc-shortcell { white-space: nowrap; }
/* cards and toolbars shrink on small screens even with a long company / agent name */
#co-grid > .co { min-width: 0; }
.report-toolbar > div { min-width: 0; }
.report-toolbar select, .toolbar select, .filter-bar select { max-width: 100%; }
.an-donut-grid > * { min-width: 0; }
.an-donut-panel svg, .an-donut-panel canvas { max-width: 100%; height: auto; }
