/* Unicall · call analysis demo.
   Visual language of the Unicall client portal (client.unicall.ai): zinc-950 sidebar,
   neutral shadcn tokens, tinted KPI cards, chat-style transcript. No build step. */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 18px;

  --page: #fcfcfd;
  --card: #ffffff;
  --topbar: rgba(255, 255, 255, 0.6);
  --fg: #0a0a0a;
  --fg-strong: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --text-4: #9ca3af;
  --muted: #f5f5f5;
  --muted-fg: #737373;
  --subtle: #f9fafb;
  --subtle-hover: #f3f4f6;
  --row-hover: rgba(249, 250, 251, 0.7);
  --border: #e5e5e5;
  --border-soft: #f3f4f6;
  --input: #e5e5e5;
  --primary: #171717;
  --primary-fg: #fafafa;
  --primary-hover: #2b2b2b;
  --ring: rgba(163, 163, 163, 0.5);
  --ring-border: #a3a3a3;
  --link: #2563eb;
  --seg-bg: rgba(243, 244, 246, 0.8);
  --seg-border: rgba(229, 231, 235, 0.5);
  --seg-active: #ffffff;
  --seg-active-fg: #2563eb;
  --seg-active-ring: #e5e7eb;
  --overlay: rgba(0, 0, 0, 0.45);

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* Sidebar: always dark, as in the client portal. */
  --sb-bg: #09090b;
  --sb-border: #18181b;
  --sb-active: #18181b;
  --sb-hover: rgba(24, 24, 27, 0.5);
  --sb-text: #d4d4d8;
  --sb-muted: #71717a;
  --sb-strong: #fafafa;
  --sb-bar: #e4e4e7;
  --sb-tile: #18181b;
  --sb-tile-border: #27272a;

  /* Tints (Tailwind 50 / 200 / 700 and icon 600). */
  --blue-bg: #eff6ff;    --blue-bd: #bfdbfe;    --blue-fg: #1d4ed8;    --blue-ic: #2563eb;
  --emerald-bg: #ecfdf5; --emerald-bd: #a7f3d0; --emerald-fg: #047857; --emerald-ic: #059669;
  --green-bg: #f0fdf4;   --green-bd: #bbf7d0;   --green-fg: #15803d;   --green-ic: #16a34a;
  --violet-bg: #f5f3ff;  --violet-bd: #ddd6fe;  --violet-fg: #6d28d9;  --violet-ic: #7c3aed;
  --amber-bg: #fffbeb;   --amber-bd: #fde68a;   --amber-fg: #b45309;   --amber-ic: #d97706;
  --orange-bg: #fff7ed;  --orange-bd: #fed7aa;  --orange-fg: #c2410c;  --orange-ic: #ea580c;
  --yellow-bg: #fefce8;  --yellow-bd: #fef08a;  --yellow-fg: #a16207;  --yellow-ic: #ca8a04;
  --red-bg: #fef2f2;     --red-bd: #fecaca;     --red-fg: #b91c1c;     --red-ic: #dc2626;
  --slate-bg: #f8fafc;   --slate-bd: #e2e8f0;   --slate-fg: #334155;   --slate-ic: #475569;
  --indigo-bg: #eef2ff;  --indigo-bd: #c7d2fe;  --indigo-fg: #312e81;

  /* Data colours (palette validated for colour vision deficiency). */
  --series-client: #2a78d6;
  --series-agent: #eb6834;
  --grid: #eceef1;
  --axis: #9ca3af;
  --st-good: #0ca30c;
  --st-warning: #fab219;
  --st-serious: #ec835a;
  --st-critical: #d03b3b;
  --st-na: #d4d4d8;

  --brand: #8b25ec;
  --font-sans: "Geist", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0a0a0a;
    --card: #171717;
    --topbar: rgba(10, 10, 10, 0.6);
    --fg: #fafafa;
    --fg-strong: #fafafa;
    --text-2: #d4d4d4;
    --text-3: #a3a3a3;
    --text-4: #737373;
    --muted: #262626;
    --muted-fg: #a3a3a3;
    --subtle: #1f1f1f;
    --subtle-hover: #262626;
    --row-hover: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.1);
    --border-soft: rgba(255, 255, 255, 0.07);
    --input: rgba(255, 255, 255, 0.15);
    --primary: #e5e5e5;
    --primary-fg: #171717;
    --primary-hover: #d4d4d4;
    --ring: rgba(115, 115, 115, 0.5);
    --ring-border: #737373;
    --link: #60a5fa;
    --seg-bg: rgba(255, 255, 255, 0.05);
    --seg-border: rgba(255, 255, 255, 0.08);
    --seg-active: #262626;
    --seg-active-fg: #60a5fa;
    --seg-active-ring: rgba(255, 255, 255, 0.1);
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
    --sb-border: rgba(255, 255, 255, 0.06);
    --blue-bg: rgba(59, 130, 246, 0.1);    --blue-bd: rgba(59, 130, 246, 0.32);    --blue-fg: #93c5fd;    --blue-ic: #60a5fa;
    --emerald-bg: rgba(16, 185, 129, 0.1); --emerald-bd: rgba(16, 185, 129, 0.3);  --emerald-fg: #6ee7b7; --emerald-ic: #34d399;
    --green-bg: rgba(34, 197, 94, 0.1);    --green-bd: rgba(34, 197, 94, 0.3);     --green-fg: #86efac;   --green-ic: #4ade80;
    --violet-bg: rgba(139, 92, 246, 0.12); --violet-bd: rgba(139, 92, 246, 0.34);  --violet-fg: #c4b5fd;  --violet-ic: #a78bfa;
    --amber-bg: rgba(245, 158, 11, 0.1);   --amber-bd: rgba(245, 158, 11, 0.32);   --amber-fg: #fcd34d;   --amber-ic: #fbbf24;
    --orange-bg: rgba(249, 115, 22, 0.1);  --orange-bd: rgba(249, 115, 22, 0.32);  --orange-fg: #fdba74;  --orange-ic: #fb923c;
    --yellow-bg: rgba(234, 179, 8, 0.1);   --yellow-bd: rgba(234, 179, 8, 0.3);    --yellow-fg: #fde047;  --yellow-ic: #facc15;
    --red-bg: rgba(239, 68, 68, 0.1);      --red-bd: rgba(239, 68, 68, 0.32);      --red-fg: #fca5a5;     --red-ic: #f87171;
    --slate-bg: rgba(148, 163, 184, 0.08); --slate-bd: rgba(148, 163, 184, 0.25);  --slate-fg: #cbd5e1;   --slate-ic: #94a3b8;
    --indigo-bg: rgba(99, 102, 241, 0.1);  --indigo-bd: rgba(99, 102, 241, 0.3);   --indigo-fg: #c7d2fe;
    --series-client: #3987e5;
    --series-agent: #d95926;
    --grid: rgba(255, 255, 255, 0.08);
    --axis: #737373;
    --st-na: #3f3f46;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0a0a0a;
  --card: #171717;
  --topbar: rgba(10, 10, 10, 0.6);
  --fg: #fafafa;
  --fg-strong: #fafafa;
  --text-2: #d4d4d4;
  --text-3: #a3a3a3;
  --text-4: #737373;
  --muted: #262626;
  --muted-fg: #a3a3a3;
  --subtle: #1f1f1f;
  --subtle-hover: #262626;
  --row-hover: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.1);
  --border-soft: rgba(255, 255, 255, 0.07);
  --input: rgba(255, 255, 255, 0.15);
  --primary: #e5e5e5;
  --primary-fg: #171717;
  --primary-hover: #d4d4d4;
  --ring: rgba(115, 115, 115, 0.5);
  --ring-border: #737373;
  --link: #60a5fa;
  --seg-bg: rgba(255, 255, 255, 0.05);
  --seg-border: rgba(255, 255, 255, 0.08);
  --seg-active: #262626;
  --seg-active-fg: #60a5fa;
  --seg-active-ring: rgba(255, 255, 255, 0.1);
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
  --sb-border: rgba(255, 255, 255, 0.06);
  --blue-bg: rgba(59, 130, 246, 0.1);    --blue-bd: rgba(59, 130, 246, 0.32);    --blue-fg: #93c5fd;    --blue-ic: #60a5fa;
  --emerald-bg: rgba(16, 185, 129, 0.1); --emerald-bd: rgba(16, 185, 129, 0.3);  --emerald-fg: #6ee7b7; --emerald-ic: #34d399;
  --green-bg: rgba(34, 197, 94, 0.1);    --green-bd: rgba(34, 197, 94, 0.3);     --green-fg: #86efac;   --green-ic: #4ade80;
  --violet-bg: rgba(139, 92, 246, 0.12); --violet-bd: rgba(139, 92, 246, 0.34);  --violet-fg: #c4b5fd;  --violet-ic: #a78bfa;
  --amber-bg: rgba(245, 158, 11, 0.1);   --amber-bd: rgba(245, 158, 11, 0.32);   --amber-fg: #fcd34d;   --amber-ic: #fbbf24;
  --orange-bg: rgba(249, 115, 22, 0.1);  --orange-bd: rgba(249, 115, 22, 0.32);  --orange-fg: #fdba74;  --orange-ic: #fb923c;
  --yellow-bg: rgba(234, 179, 8, 0.1);   --yellow-bd: rgba(234, 179, 8, 0.3);    --yellow-fg: #fde047;  --yellow-ic: #facc15;
  --red-bg: rgba(239, 68, 68, 0.1);      --red-bd: rgba(239, 68, 68, 0.32);      --red-fg: #fca5a5;     --red-ic: #f87171;
  --slate-bg: rgba(148, 163, 184, 0.08); --slate-bd: rgba(148, 163, 184, 0.25);  --slate-fg: #cbd5e1;   --slate-ic: #94a3b8;
  --indigo-bg: rgba(99, 102, 241, 0.1);  --indigo-bd: rgba(99, 102, 241, 0.3);   --indigo-fg: #c7d2fe;
  --series-client: #3987e5;
  --series-agent: #d95926;
  --grid: rgba(255, 255, 255, 0.08);
  --axis: #737373;
  --st-na: #3f3f46;
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
}

.ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
}

.ico-lg { width: 20px; height: 20px; }
.ico-sm { width: 12px; height: 12px; }
.ico-xl { width: 48px; height: 48px; }

:focus-visible {
  outline: 2px solid var(--ring-border);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-fg); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.5; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes flash {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
  20% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.spin { animation: spin 1s linear infinite; }
.pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- layout */

.app {
  display: flex;
  min-height: 100vh;
  background: var(--page);
}

@media (min-width: 768px) {
  /* Keeps the dark column continuous below the sticky sidebar. */
  .app { background: linear-gradient(to right, var(--sb-bg) 256px, var(--page) 256px); }
}

.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  color: var(--sb-text);
  display: none;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

@media (min-width: 768px) {
  .sidebar { display: flex; }
}

.brand {
  padding: 20px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-tile {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xl);
  background: var(--sb-tile);
  border: 1px solid var(--sb-tile-border);
  display: grid;
  place-items: center;
  color: #f4f4f5;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  color: #f4f4f5;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  color: var(--sb-muted);
  font-size: 10px;
  font-weight: 500;
}

.sb-scroll {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #27272a transparent;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--sb-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding: 0 8px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 24px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  margin-bottom: 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sb-muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.2s, color 0.2s;
}

.nav-item:hover {
  color: #d4d4d8;
  background: var(--sb-hover);
}

.nav-item[aria-current="page"] {
  background: var(--sb-active);
  color: var(--sb-strong);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.3);
}

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  width: 4px;
  height: 20px;
  background: var(--sb-bar);
  border-radius: 0 9999px 9999px 0;
}

.nav-item .count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 9999px;
  background: #27272a;
  color: #d4d4d8;
  line-height: 18px;
}

.sb-foot {
  padding: 16px;
  border-top: 1px solid var(--sb-border);
  flex-shrink: 0;
  background: rgba(9, 9, 11, 0.5);
}

.sb-foot .nav-item { margin-bottom: 4px; }

.powered {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 0;
  color: var(--sb-muted);
  font-size: 10px;
  font-weight: 500;
}

.powered img {
  height: 16px;
  width: auto;
  opacity: 0.75;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}

@media (min-width: 768px) {
  .topbar { padding: 0 24px; }
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title {
  font-weight: 600;
  font-size: 18px;
  line-height: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-btn { margin-left: -8px; }

@media (min-width: 768px) {
  .topbar .menu-btn { display: none; }
}

.profile {
  display: none;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 8px;
  border-radius: 9999px;
  border: 1px solid transparent;
}

@media (min-width: 1024px) {
  .profile { display: flex; }
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.profile-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
  color: color-mix(in srgb, var(--fg) 80%, transparent);
}

.profile-role {
  font-size: 10px;
  color: var(--muted-fg);
  padding-top: 4px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  background: var(--amber-bg);
  border-bottom: 1px solid var(--amber-bd);
  color: var(--amber-fg);
}

@media (min-width: 768px) {
  .notice { padding: 10px 24px; }
}

.notice strong { font-weight: 600; }

.content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}

@media (min-width: 768px) {
  .content { padding: 32px; }
}

.stack { display: flex; flex-direction: column; gap: 24px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.stack-xs { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

.grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.grid-tight { gap: 16px; }

@media (min-width: 768px) {
  .md-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg-main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

@media (min-width: 1280px) {
  .xl-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.span-all { grid-column: 1 / -1; }

/* ----------------------------------------------------------- page header */

.page-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .page-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-title {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg-strong);
}

@media (min-width: 640px) {
  .page-title { font-size: 30px; line-height: 36px; }
}

.page-sub {
  color: var(--text-3);
  margin-top: 4px;
  font-size: 15px;
  line-height: 22px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 12px;
}

.back:hover { color: var(--fg); }

/* ------------------------------------------------------ segmented control */

.seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--seg-bg);
  padding: 4px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--seg-border);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar { display: none; }

.seg button {
  padding: 6px 14px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-3);
  background: transparent;
  border: 0;
  white-space: nowrap;
  transition: all 0.2s;
}

.seg button:hover {
  color: var(--text-2);
  background: color-mix(in srgb, var(--card) 50%, transparent);
}

.seg button[aria-pressed="true"] {
  background: var(--seg-active);
  color: var(--seg-active-fg);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--seg-active-ring);
}

.seg-sm button { padding: 4px 10px; font-size: 11px; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 0;
  min-width: 0;
}

.card-head {
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .ico { width: 18px; height: 18px; }

.card-desc {
  color: var(--muted-fg);
  font-size: 13px;
  margin-top: 6px;
}

.card-body {
  padding: 0 24px;
  min-width: 0;
}

.card-foot {
  padding: 16px 24px 0;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush .card-head { padding: 20px 24px 16px; }

.card-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-link:hover { color: var(--fg); }
.card-link .ico { width: 14px; height: 14px; }

.card.ai {
  background: linear-gradient(135deg, var(--blue-bg), var(--indigo-bg));
  border-color: var(--blue-bd);
}

.card.ai .card-title { color: var(--indigo-fg); }

/* ------------------------------------------------------------------ KPIs */

.kpi-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.kpi {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--kpi-bd);
  background: var(--kpi-bg);
  color: var(--kpi-fg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  min-width: 0;
  transition: box-shadow 0.2s, transform 0.2s;
}

a.kpi:hover,
button.kpi:hover {
  box-shadow: var(--shadow-lg);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.kpi-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-icons .ico { width: 20px; height: 20px; }
.kpi-icons .kpi-alert { width: 16px; height: 16px; color: var(--orange-ic); }

.kpi-value {
  margin-top: 16px;
  font-size: 30px;
  line-height: 36px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value small {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.7;
  margin-left: 2px;
}

.kpi-value.text {
  font-size: 18px;
  line-height: 36px;
}

.kpi-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.kpi-sub {
  font-size: 12px;
  opacity: 0.8;
  min-width: 0;
}

.kpi-bottom .ico { opacity: 0.5; }

/* Three cards: one row from 900px; below, the card marked "wide" takes a full row. */
@media (min-width: 900px) {
  .kpi-grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 899px) {
  .kpi-grid.k3 > .kpi.wide { grid-column: 1 / -1; }
  .kpi-grid.k3 > .kpi.first { order: -1; }
}

.kpi-grid + .toolbar { margin-top: 24px; }

button.kpi { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.kpi[aria-pressed="true"] { outline: 2px solid var(--kpi-fg); outline-offset: 2px; }
.kpi:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.kpi-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
}

.kpi-hint .ico { width: 14px; height: 14px; opacity: 0.7; }

.t-blue { --kpi-bg: var(--blue-bg); --kpi-bd: var(--blue-bd); --kpi-fg: var(--blue-fg); }
.t-emerald { --kpi-bg: var(--emerald-bg); --kpi-bd: var(--emerald-bd); --kpi-fg: var(--emerald-fg); }
.t-green { --kpi-bg: var(--green-bg); --kpi-bd: var(--green-bd); --kpi-fg: var(--green-fg); }
.t-violet { --kpi-bg: var(--violet-bg); --kpi-bd: var(--violet-bd); --kpi-fg: var(--violet-fg); }
.t-amber { --kpi-bg: var(--amber-bg); --kpi-bd: var(--amber-bd); --kpi-fg: var(--amber-fg); }
.t-orange { --kpi-bg: var(--orange-bg); --kpi-bd: var(--orange-bd); --kpi-fg: var(--orange-fg); }
.t-yellow { --kpi-bg: var(--yellow-bg); --kpi-bd: var(--yellow-bd); --kpi-fg: var(--yellow-fg); }
.t-red { --kpi-bg: var(--red-bg); --kpi-bd: var(--red-bd); --kpi-fg: var(--red-fg); }
.t-slate { --kpi-bg: var(--slate-bg); --kpi-bd: var(--slate-bd); --kpi-fg: var(--slate-fg); }

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  border-radius: 9999px;
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--fg);
  background: transparent;
}

.badge .ico { width: 12px; height: 12px; }

.badge.sm {
  font-size: 10px;
  line-height: 14px;
  font-weight: 600;
  padding: 1px 7px;
}

.badge.sm .ico { width: 11px; height: 11px; }

.badge[class*="t-"] {
  background: var(--kpi-bg);
  color: var(--kpi-fg);
  border-color: var(--kpi-bd);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}

.chip .ico { color: var(--chip-ic, currentColor); }
.chip .chip-label { color: var(--text-3); font-weight: 500; }

.ic-green { color: var(--green-ic); }
.ic-red { color: var(--red-ic); }
.ic-gray { color: var(--text-3); }
.ic-amber { color: var(--amber-ic); }
.ic-orange { color: var(--orange-ic); }
.ic-blue { color: var(--blue-ic); }
.ic-violet { color: var(--violet-ic); }
.ic-emerald { color: var(--emerald-ic); }
.ic-slate { color: var(--slate-ic); }

.score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score.good { color: var(--green-fg); }
.score.warn { color: var(--amber-fg); }
.score.bad { color: var(--red-fg); }
.score small { font-weight: 500; color: var(--text-4); font-size: 11px; margin-left: 1px; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.btn:has(> .ico:first-child) { padding-left: 12px; }
.btn:focus-visible { outline: none; border-color: var(--ring-border); box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
  border-color: var(--border);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.btn-outline:hover { background: var(--muted); }
.btn-ghost:hover { background: var(--muted); }

.btn-sm { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }
.btn-sm:has(> .ico:first-child) { padding-left: 10px; }
.btn-icon { width: 36px; padding: 0 !important; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }

.btn-danger { color: var(--red-fg); }
.btn-danger:hover { background: var(--red-bg); }
.btn-danger.confirm { background: var(--red-ic); color: #fff; }

.btn-dashed { border-style: dashed; }

.link {
  color: var(--link);
  font-weight: 500;
}

.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-weight: 500; cursor: pointer; }

/* ----------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
}

.hint {
  font-size: 12px;
  color: var(--muted-fg);
}

.input,
.select {
  height: 36px;
  width: 100%;
  min-width: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--input);
  background: transparent;
  padding: 4px 12px;
  font-size: 16px;
  box-shadow: var(--shadow-xs);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

@media (min-width: 768px) {
  .input, .select { font-size: 14px; }
}

.input::placeholder { color: var(--muted-fg); }

.input:focus-visible,
.select:focus-visible {
  border-color: var(--ring-border);
  box-shadow: 0 0 0 3px var(--ring);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.select option { background: var(--card); color: var(--fg); }

.input-wrap { position: relative; min-width: 0; }
.input-wrap > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-fg); pointer-events: none; }
.input-wrap .input { padding-left: 36px; }
.input-wrap .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 24px; width: 24px; border: 0; background: transparent; color: var(--muted-fg); display: grid; place-items: center; border-radius: 6px; }
.input-wrap .clear:hover { color: var(--fg); background: var(--muted); }

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 16px;
  text-align: center;
  background: var(--subtle);
  transition: border-color 0.15s, background-color 0.15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.drop:hover,
.drop.over {
  border-color: var(--blue-ic);
  background: var(--blue-bg);
}

.drop-icon {
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-3);
  margin-bottom: 4px;
}

.drop-title { font-weight: 600; font-size: 15px; }
.drop-sub { font-size: 12px; color: var(--muted-fg); }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  min-width: 0;
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--blue-bg);
  color: var(--blue-ic);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.progress {
  height: 6px;
  border-radius: 9999px;
  background: var(--muted);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue-ic);
  border-radius: 9999px;
  transition: width 0.2s;
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--kpi-bd, var(--border));
  background: var(--kpi-bg, var(--subtle));
  color: var(--kpi-fg, var(--text-2));
  font-size: 13px;
  line-height: 1.5;
}

.alert .ico { margin-top: 2px; }
.alert strong { font-weight: 600; }

/* ----------------------------------------------------------------- table */

.table-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tbl-scroll { overflow-x: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tbl thead { background: color-mix(in srgb, var(--subtle) 60%, transparent); }

.tbl th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-4);
  padding: 12px 8px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
}

.tbl td {
  padding: 14px 8px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.tbl tr > :first-child { padding-left: 24px; }
.tbl tr > :last-child { padding-right: 24px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .c { text-align: center; }
.tbl .r { text-align: right; }

.tbl tbody tr[data-action] {
  cursor: pointer;
  transition: background-color 0.15s;
}

.tbl tbody tr[data-action]:hover { background: var(--row-hover); }
.tbl tbody tr[data-action]:hover .row-title { color: var(--blue-fg); }
.tbl tr.busy { opacity: 0.65; }
.tbl tr.todo > :first-child { box-shadow: inset 3px 0 0 var(--red-ic); }
.title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-line .row-title { min-width: 0; }
.title-line .badge { flex-shrink: 0; }

.tbl.compact td { padding-top: 9px; padding-bottom: 9px; }
.tbl.compact tr > :first-child { padding-left: 0; }
.tbl.compact tr > :last-child { padding-right: 0; }
.tbl.compact thead { background: transparent; }

.row-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--fg-strong);
  transition: color 0.15s;
}

.row-sub {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 2px;
}

.ref {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-3);
}

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.who-dot {
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: var(--blue-bg);
  color: var(--blue-fg);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Calls as cards on small screens, as a table from 900px. */
.call-cards { display: grid; gap: 12px; }
.call-table { display: none; }

@media (min-width: 900px) {
  .call-cards { display: none; }
  .call-table { display: block; }
}

.call-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--edge, #10b981);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  transition: box-shadow 0.2s;
}

.call-card:hover { box-shadow: var(--shadow-md); }
.call-card.busy { opacity: 0.7; }

.call-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.call-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
  flex-wrap: wrap;
}

.call-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.call-card-meta .ico { width: 12px; height: 12px; }

/* ------------------------------------------------------ lists and blocks */

.pitem {
  display: block;
  padding: 12px;
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: background-color 0.15s;
}

.pitem:hover { background: var(--subtle-hover); }

.pitem-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pitem-title { font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.pitem-text { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pitem-foot { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.pitem-foot .ico { width: 12px; height: 12px; }

.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.empty .ico { width: 44px; height: 44px; margin-bottom: 8px; }
.empty .ico.ok { color: var(--green-ic); }
.empty .ico.dim { opacity: 0.45; }
.empty-title { font-weight: 600; color: var(--text-2); }
.empty-text { font-size: 13px; }

.dl {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dl dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.dl dd { font-size: 14px; line-height: 1.55; color: var(--text-2); }
.dl dd > p + p,
.dl dd > ul + p { margin-top: 6px; }
.dl > .wide { grid-column: 1 / -1; }
.bullets { list-style: disc; padding-left: 18px; }
.bullets li + li { margin-top: 2px; }
.bullets li::marker { color: var(--text-4); }

.checklist { display: flex; flex-direction: column; gap: 6px; }

.checklist li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-2);
}

.checklist .ico { margin-top: 3px; color: var(--green-ic); }

.lead {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-2);
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--kpi-bd);
  background: var(--kpi-bg);
  color: var(--kpi-fg);
  font-size: 14px;
  line-height: 1.5;
}

.action-item .ico { margin-top: 2px; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
}

.divider { height: 1px; background: var(--border-soft); }

/* ------------------------------------------------------- evidence chips */

.ev-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ev-row .section-label { margin-right: 4px; }

.ev {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s;
}

.ev .ico { width: 10px; height: 10px; opacity: 0.7; }
.ev:hover { background: var(--blue-bg); color: var(--blue-fg); border-color: var(--blue-bd); }

/* ---------------------------------------------------------- call detail */

.call-head {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--blue-bg), var(--card) 70%);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .call-head { padding: 24px; }
}

.call-head-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 900px) {
  .call-head-top { flex-direction: row; align-items: flex-start; justify-content: space-between; }
}

.call-title {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
}

.call-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-3);
}

.call-meta span { display: inline-flex; align-items: center; gap: 5px; }
.call-meta .ico { width: 14px; height: 14px; }

.call-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.detail-grid {
  display: grid;
  gap: 16px 24px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 1200px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .detail-grid > .tabs { grid-column: 1; grid-row: 1; }
  .detail-grid > .analysis-col { grid-column: 1; grid-row: 2; }
  .detail-grid > .conv-col { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 88px; }
}

@media (max-width: 1199px) {
  .detail-grid[data-tab="transcription"] > .analysis-col { display: none; }
  .detail-grid:not([data-tab="transcription"]) > .conv-col { display: none; }
}

.conv-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

@media (min-width: 1200px) {
  .conv-card { max-height: calc(100vh - 112px); }
}

.conv-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.player {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
}

.play {
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  border: 0;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  transition: transform 0.15s, background-color 0.15s;
}

.play:hover { transform: scale(1.05); background: var(--primary-hover); }
.play:disabled { opacity: 0.35; transform: none; cursor: not-allowed; }
.play .ico { width: 20px; height: 20px; fill: currentColor; }
.play .ico.play-ico { margin-left: 3px; }

.player-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.player-times {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-fg);
}

.timeline {
  position: relative;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--muted);
  cursor: pointer;
  overflow: hidden;
  touch-action: none;
}

.tl-seg {
  position: absolute;
  height: 11px;
  border-radius: 3px;
  min-width: 3px;
}

.tl-seg.agent { top: 5px; background: var(--series-agent); }
.tl-seg.client { bottom: 5px; background: var(--series-client); }

.tl-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dotted var(--text-3);
  opacity: 0.8;
  pointer-events: none;
}

.tl-head {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--fg);
  pointer-events: none;
  display: none;
}

.tl-head.on { display: block; }

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--text-3);
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend .ico { width: 13px; height: 13px; }

.transcript {
  background: color-mix(in srgb, var(--subtle) 50%, transparent);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  min-height: 0;
}

@media (max-width: 1199px) {
  .transcript { max-height: 75vh; }
}

.msg { display: flex; width: 100%; }
.msg.agent { justify-content: flex-end; }

.msg-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 88%;
  min-width: 0;
}

.msg.agent .msg-inner { align-items: flex-end; }

.msg-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: var(--muted-fg);
  margin-bottom: 4px;
  padding: 0 4px;
}

.msg-meta .who-label { font-weight: 600; color: var(--text-3); }
.msg-meta .t { font-family: var(--font-mono); }
.msg-meta .n { font-family: var(--font-mono); opacity: 0.8; }

.bubble {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  text-align: start;
  padding: 11px 15px;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
  overflow-wrap: anywhere;
}

.msg.agent .bubble {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  border-bottom-right-radius: 0;
}

.msg.client .bubble {
  background: var(--card);
  color: var(--fg);
  border-color: var(--border);
  border-bottom-left-radius: 0;
}

.bubble:hover { box-shadow: var(--shadow-md); }

.bubble.active {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent), var(--shadow-md);
  transform: scale(1.01);
}

.bubble.flash { animation: flash 1.6s ease-out 1; }

.bubble .orig.ar {
  font-family: var(--font-ar);
  font-size: 15px;
  line-height: 1.75;
}

.bubble .tr {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  font-size: 13px;
  line-height: 1.55;
  color: color-mix(in srgb, currentColor 72%, transparent);
}

.bubble .tr-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0 4px;
  margin-right: 6px;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  vertical-align: 1px;
}

.pii {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  unicode-bidi: isolate;
  direction: ltr;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 17px;
  font-weight: 500;
  padding: 0 5px;
  margin: 0 1px;
  border-radius: 4px;
  background: var(--amber-bg);
  color: var(--amber-fg);
  border: 1px dashed var(--amber-bd);
  white-space: nowrap;
  vertical-align: 1px;
}

.pii .ico { width: 11px; height: 11px; }

.msg.agent .pii {
  background: color-mix(in srgb, currentColor 12%, transparent);
  color: inherit;
  border-color: color-mix(in srgb, currentColor 40%, transparent);
}

.tone {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  line-height: 14px;
  font-weight: 500;
  padding: 0 6px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  color: var(--text-3);
  background: var(--card);
}

.tone.neg { background: var(--red-bg); color: var(--red-fg); border-color: var(--red-bd); }
.tone.warn { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-bd); }
.tone.pos { background: var(--green-bg); color: var(--green-fg); border-color: var(--green-bd); }

.hold {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--muted);
  border-radius: 9999px;
  padding: 3px 10px;
}

.hold .ico { width: 12px; height: 12px; }

/* Moments */
.moments { display: flex; flex-direction: column; }

.moment {
  display: grid;
  grid-template-columns: 44px 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-lg);
  text-align: left;
  background: transparent;
  border: 0;
  width: calc(100% + 16px);
  transition: background-color 0.15s;
}

.moment:hover { background: var(--subtle); }
.moment-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); padding-top: 4px; }

.moment-icon {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--kpi-bg);
  color: var(--kpi-fg);
  border: 1px solid var(--kpi-bd);
}

.moment-icon .ico { width: 14px; height: 14px; }
.moment-title { font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.moment-text { font-size: 13px; color: var(--text-3); margin-top: 1px; }

/* QM list */
.qm-head {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.qm-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.qm-score b { font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; }
.qm-score span { font-size: 14px; color: var(--text-3); font-weight: 500; }

.qm-list { display: flex; flex-direction: column; gap: 8px; }

.qm-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--card);
}

.qm-item.bad { background: var(--red-bg); border-color: var(--red-bd); }
.qm-item.warn { background: color-mix(in srgb, var(--amber-bg) 60%, var(--card)); border-color: var(--amber-bd); }

.qm-item > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: inherit;
  cursor: pointer;
  list-style: none;
}

.qm-item > summary::-webkit-details-marker { display: none; }
.qm-item > summary:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.qm-item > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.qm-item .qm-ic { flex-shrink: 0; }
.qm-item .qm-chev { width: 16px; height: 16px; color: var(--text-4); transition: transform 0.15s; }
.qm-item[open] .qm-chev { transform: rotate(180deg); }
.qm-body { padding: 0 12px 12px 42px; }
.qm-item-title { font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.qm-item-text { font-size: 13px; line-height: 1.55; color: var(--text-2); }
.qm-item .ev-row { margin-top: 8px; }

/* ----------------------------------------------------------------- notes */

.chart-note { font-size: 12px; color: var(--text-3); margin-top: 8px; }

.sbar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--card);
  min-width: 120px;
}
.sbar > span { display: block; height: 100%; }
.sbar .good { background: var(--st-good); }
.sbar .warning { background: var(--st-warning); }
.sbar .critical { background: var(--st-critical); }
.sbar .na { background: var(--st-na); }

/* --------------------------------------------------------------- stepper */

.steps { display: flex; flex-direction: column; gap: 4px; }

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  color: var(--text-4);
  font-size: 14px;
}

.step-dot {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}

.step-dot .ico { width: 15px; height: 15px; }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-name { font-weight: 600; }
.step-desc { font-size: 12px; opacity: 0.85; }
.step.done { color: var(--text-2); }
.step.done .step-dot { background: var(--green-bg); color: var(--green-ic); border-color: var(--green-bd); }
.step.current { background: var(--blue-bg); color: var(--blue-fg); }
.step.current .step-dot { color: var(--blue-ic); border-color: var(--blue-bd); }
.step.failed { background: var(--red-bg); color: var(--red-fg); }
.step.failed .step-dot { color: var(--red-ic); border-color: var(--red-bd); }

.how { display: flex; flex-direction: column; gap: 16px; }
.how-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
.how-icon { width: 36px; height: 36px; border-radius: var(--radius-lg); display: grid; place-items: center; background: var(--kpi-bg); color: var(--kpi-fg); border: 1px solid var(--kpi-bd); }
.how-title { font-size: 14px; font-weight: 600; }
.how-text { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* --------------------------------------------------------- modal, drawer */

.backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 60;
  animation: fade-in 0.15s ease-out;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 272px;
  max-width: 86vw;
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  color: var(--sb-text);
  box-shadow: var(--shadow-2xl);
  transform: translateX(-100%);
  transition: transform 0.25s ease-out;
}

.drawer.open { transform: none; }
.drawer .drawer-close { position: absolute; top: 18px; right: 12px; color: var(--sb-muted); }
.drawer .drawer-close:hover { color: var(--sb-strong); background: var(--sb-active); }

.modal {
  position: fixed;
  z-index: 70;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  animation: fade-in 0.15s ease-out;
}

.modal-close { position: absolute; top: 14px; right: 14px; }
.modal h2 { font-size: 18px; font-weight: 600; line-height: 1.3; padding-right: 32px; }
.modal .modal-sub { font-size: 14px; color: var(--muted-fg); margin-top: 6px; }
.modal-body { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; font-size: 14px; color: var(--text-2); }
.modal-body h3 { font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 4px; }
.modal-body ul { display: flex; flex-direction: column; gap: 4px; }
.modal-body li { display: flex; gap: 8px; }
.modal-body li::before { content: ""; width: 4px; height: 4px; border-radius: 9999px; background: var(--text-4); margin-top: 9px; flex-shrink: 0; }

.toast {
  position: fixed;
  z-index: 90;
  right: 16px;
  bottom: 16px;
  left: 16px;
  max-width: 380px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  animation: fade-in 0.2s ease-out;
}

/* ----------------------------------------------------------------- login */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--page);
}

.login-card {
  width: 360px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  border: 2px solid color-mix(in srgb, var(--primary) 10%, transparent);
}

.login-head { text-align: center; padding: 0 24px; }

.login-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  display: grid;
  place-items: center;
}

.login-logo img { width: 26px; height: 26px; object-fit: contain; }
.login-title { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; }
.login-desc { color: var(--muted-fg); font-size: 14px; margin-top: 4px; }
.login-code { text-align: center; letter-spacing: 0.3em; font-size: 18px !important; height: 44px; }
.login-foot { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 11px; color: var(--text-4); }
.login-foot img { height: 14px; width: auto; }
.form-error { padding: 8px 10px; font-size: 13px; color: var(--red-fg); background: var(--red-bg); border-radius: var(--radius-sm); text-align: center; }

/* ------------------------------------------------------------ skeletons */

.skel {
  border-radius: var(--radius-md);
  background: var(--muted);
  animation: pulse 1.6s ease-in-out infinite;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.fade { animation: fade-in 0.2s ease-out; }

/* ----------------------------------------------------------------- print */

@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .notice, .no-print, .player, .drawer, .backdrop, .toast, .tip { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card, .conv-card, .call-head, .kpi, .table-card { box-shadow: none; break-inside: avoid; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .conv-col { position: static !important; }
  .conv-card { max-height: none !important; }
  .transcript { max-height: none !important; overflow: visible !important; }
  .msg.agent .bubble { background: #f4f4f5; color: #000; border-color: #d4d4d8; }
  .print-only { display: block !important; }
}

.print-only { display: none; }

/* ------------------------------------------------------------- utilities */

#view:focus { outline: none; }
.min0 { min-width: 0; }
.small-muted { font-size: 12px; color: var(--text-3); }
.row-text { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.hide-sm { display: none; }
.ico.inline { display: inline-block; vertical-align: -3px; margin-right: 6px; width: 14px; height: 14px; }
.narrow { max-width: 640px; }

@media (min-width: 480px) {
  .hide-sm { display: inline; }
}

.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline-block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: inline-block; }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.toolbar .search { width: 100%; }

@media (min-width: 640px) {
  .toolbar .search { width: 260px; }
}

.results-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 12px;
}

.tbl .cell-main { min-width: 220px; max-width: 360px; }
.tbl .cell-wide { min-width: 260px; }
.tbl .cell-wide .row-text { max-width: 440px; }
.tbl .cell-bar { min-width: 180px; }
.tbl .strong-row td { font-weight: 600; }


.moment-title,
.moment-text { display: block; }




.conv-card { scroll-margin-top: 80px; }

.drawer .brand { padding-right: 56px; }

.chip .ico { width: 16px; height: 16px; }

.card-head > .min0 { flex: 1 1 220px; }
.grid.top { align-items: start; }
#upload-progress:empty,
#imports:empty { display: none; }

/* Phones: two KPI columns to keep the dashboard short. */
@media (max-width: 559px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-title { font-size: 13px; }
  .kpi-icons .ico { width: 18px; height: 18px; }
  .kpi-value { font-size: 24px; line-height: 30px; margin-top: 10px; }
  .kpi-value small { font-size: 12px; }
  .kpi-value.text { font-size: 15px; line-height: 20px; white-space: normal; }
  .kpi-bottom .ico { display: none; }
}

.only-stacked { display: inline-flex; }

@media (min-width: 1200px) {
  .only-stacked { display: none; }
}

/* ------------------------------------------------------------ call tabs */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  width: 100%;
  border-radius: var(--radius-lg);
  background: var(--muted);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-margin-top: 80px;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 0 auto;
  padding: 7px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted-fg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.tab .ico { width: 15px; height: 15px; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { background: var(--card); color: var(--fg); box-shadow: var(--shadow-sm); }

@media (min-width: 1200px) {
  .tab.only-stacked { display: none; }
}

@media (max-width: 479px) {
  .tab:not([aria-selected="true"]) span { display: none; }
}

.analysis-col { min-width: 0; }
.tab-panel { display: none; }
.tab-panel.on { display: flex; }

/* ------------------------------------------------------------- coaching */

.coach-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.coach-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}

.coach-item:last-child { border-bottom: 0; }
.coach-item > .ico { margin-top: 3px; color: var(--text-3); }
.coach-item.good > .ico { color: var(--green-ic); }
.coach-item.warn > .ico { color: var(--amber-ic); }
.coach-item strong { font-weight: 600; color: var(--fg-strong); }
.coach-item .ev-row { margin-top: 6px; }

@media print {
  .qm-chev { display: none !important; }
  .tabs { display: none !important; }
  .tab-panel { display: flex !important; }
  .detail-grid > .analysis-col,
  .detail-grid > .conv-col { display: block !important; }
}
