/* ============================================================ */
/*  COREUCX Phone System - Design tokens                         */
/* ============================================================ */

:root {
  /* font stack */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* density (overridable via Tweaks) */
  --u: 4px;
  --row-h: 36px;
  --pad-x: 16px;
  --pad-y: 12px;

  /* radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;

  /* shadows */
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);

  /* status - shared between themes */
  --c-success: oklch(0.72 0.16 155);
  --c-success-soft: oklch(0.92 0.04 155);
  --c-warning: oklch(0.78 0.16 80);
  --c-warning-soft: oklch(0.94 0.05 80);
  --c-danger: oklch(0.65 0.21 25);
  --c-danger-soft: oklch(0.92 0.05 25);
  --c-info: oklch(0.70 0.15 230);
  --c-info-soft: oklch(0.93 0.04 230);
  --c-ai: oklch(0.72 0.18 290);
  --c-ai-soft: oklch(0.93 0.05 290);
}

/* ---- light theme ---- */
:root[data-theme="light"] {
  --bg: oklch(0.985 0.003 60);
  --bg-2: oklch(0.97 0.005 60);
  --surface: #ffffff;
  --surface-2: oklch(0.985 0.003 60);
  --elevated: #ffffff;
  --border: oklch(0.91 0.008 60);
  --border-strong: oklch(0.85 0.01 60);
  --text: oklch(0.22 0.012 250);
  --text-muted: oklch(0.50 0.012 250);
  --text-faint: oklch(0.65 0.01 250);
  --accent: oklch(0.62 0.21 45);
  --accent-fg: #ffffff;
  --accent-soft: oklch(0.95 0.05 45);
  --accent-soft-fg: oklch(0.45 0.18 45);
  --focus-ring: oklch(0.62 0.21 45 / 0.35);
  --grid-line: oklch(0.93 0.005 60);
}

/* ---- dark theme ---- */
:root[data-theme="dark"] {
  --bg: oklch(0.16 0.008 250);
  --bg-2: oklch(0.19 0.008 250);
  --surface: oklch(0.20 0.009 250);
  --surface-2: oklch(0.23 0.010 250);
  --elevated: oklch(0.24 0.011 250);
  --border: oklch(0.30 0.012 250);
  --border-strong: oklch(0.38 0.014 250);
  --text: oklch(0.96 0.004 250);
  --text-muted: oklch(0.68 0.012 250);
  --text-faint: oklch(0.50 0.010 250);
  --accent: oklch(0.74 0.18 50);
  --accent-fg: oklch(0.18 0.01 50);
  --accent-soft: oklch(0.30 0.08 50);
  --accent-soft-fg: oklch(0.85 0.15 50);
  --focus-ring: oklch(0.74 0.18 50 / 0.40);
  --grid-line: oklch(0.24 0.01 250);
}

/* density modes */
:root[data-density="compact"] {
  --row-h: 30px;
  --pad-x: 12px;
  --pad-y: 8px;
}
:root[data-density="comfortable"] {
  --row-h: 36px;
  --pad-x: 16px;
  --pad-y: 12px;
}
:root[data-density="roomy"] {
  --row-h: 44px;
  --pad-x: 20px;
  --pad-y: 16px;
}

/* ============================================================ */
/*  Reset / base                                                 */
/* ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-soft); color: var(--accent-soft-fg); }

/* scrollbar - modern standard properties (2026): thin bar, transparent track */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-track-piece { background: transparent; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
*:hover::-webkit-scrollbar-thumb { background: var(--text-faint); }

/* ============================================================ */
/*  App shell                                                    */
/* ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  overflow: hidden;
}
.app-shell[data-nav="collapsed"] { grid-template-columns: 56px 1fr; }

.topbar {
  grid-column: 1 / 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; letter-spacing: -0.01em;
  width: 232px;
  font-size: 14px;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}
.brand-name { color: var(--text); }
.brand-name .dim { color: var(--text-muted); font-weight: 400; margin-left: 4px; }

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  height: 30px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  width: 320px;
  color: var(--text-muted);
  font-size: 12.5px;
}
.topbar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.topbar-search input {
  background: none; border: 0; outline: 0; color: var(--text); flex: 1;
  font-size: 12.5px;
}
.topbar-search kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 1px 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-faint);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--text-muted);
  transition: all 120ms ease;
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); border-color: var(--border); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent-soft-fg); border-color: transparent; }

.topbar-status {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px; height: 30px;
  font-size: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.topbar-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-success); box-shadow: 0 0 0 3px color-mix(in oklab, var(--c-success), transparent 80%); }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip .avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.7 0.15 290), oklch(0.65 0.2 45));
  color: white; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 600;
}
.user-chip .meta { font-size: 12px; line-height: 1.1; }
.user-chip .meta .dim { color: var(--text-muted); font-size: 10.5px; font-family: var(--font-mono); }

/* ---- sidebar ---- */
.sidebar {
  grid-row: 2;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  position: relative;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 12px 8px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-section {
  margin-top: 14px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 6px 12px 4px;
  font-family: var(--font-mono);
  font-weight: 500;
}
.nav-section:first-child { margin-top: 4px; }
.nav-section.collapsible {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; border-radius: var(--r-sm);
  transition: color 100ms ease, background 100ms ease;
}
.nav-section.collapsible:hover { color: var(--accent); background: color-mix(in oklab, var(--accent), transparent 90%); }
.nav-section.active.collapsible:hover { color: var(--accent); }
.nav-section .sec-caret { flex-shrink: 0; opacity: 0.7; }
.nav-section .sec-count {
  margin-left: auto; font-size: 9.5px; letter-spacing: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 6px; color: var(--text-faint);
}
.nav-section.active { color: var(--accent); }
.nav-section.active .sec-caret { opacity: 1; }

.nav-item.nav-sub { padding-left: 30px; font-size: 12px; opacity: 0.82; }
.nav-item.nav-sub.active { opacity: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
  font-weight: 500;
}
.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; display: grid; place-items: center; }
.nav-item .label { flex: 1; }
.nav-item .badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 0 6px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}
.nav-item.active .badge { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.nav-item .badge.badge-off, .nav-item.active .badge.badge-off { background: var(--bg-2); color: var(--text-muted); border-color: var(--border); }
.nav-item .badge.badge-on, .nav-item.active .badge.badge-on { background: var(--accent); color: var(--accent-fg); border-color: transparent; }

.nav-sub { padding-left: 30px; font-size: 12.5px; }

/* ---- main pane ---- */
.main {
  grid-row: 2;
  overflow: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.page {
  padding: 20px 24px 40px;
  max-width: 100%;
  display: flex; flex-direction: column;
  gap: 16px;
}
.page-header {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--text);
}
.page-title .crumb {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0;
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-mono);
}
.page-subtitle { color: var(--text-muted); font-size: 13px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; }

/* ============================================================ */
/*  Primitives                                                   */
/* ============================================================ */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 120ms ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-2); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--focus-ring); border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(0.95); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--bg-2); color: var(--text); }
.btn.danger { color: var(--c-danger); }
.btn.danger:hover { background: var(--c-danger-soft); }
.btn.success { background: var(--c-success); border-color: var(--c-success); color: #fff; }
.btn.lg { height: 36px; padding: 0 16px; font-size: 13px; }
.btn.sm { height: 24px; padding: 0 8px; font-size: 11.5px; }
.btn.icon-only { padding: 0; width: 30px; justify-content: center; }
.btn.icon-only.sm { width: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text);
}
.card-header .label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 500;
}
.card-header .label .dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; }
.card-header .actions { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.card-body { padding: 14px; }
.card-body.flush { padding: 0; }

/* status pill */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 8px;
  line-height: 1;
  height: 21px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.success { background: color-mix(in oklab, var(--c-success), transparent 88%); color: var(--c-success); border-color: color-mix(in oklab, var(--c-success), transparent 75%); }
.pill.warning { background: color-mix(in oklab, var(--c-warning), transparent 88%); color: oklch(0.55 0.16 75); border-color: color-mix(in oklab, var(--c-warning), transparent 75%); }
:root[data-theme="dark"] .pill.warning { color: var(--c-warning); }
.pill.danger { background: color-mix(in oklab, var(--c-danger), transparent 88%); color: var(--c-danger); border-color: color-mix(in oklab, var(--c-danger), transparent 75%); }
.pill.info { background: color-mix(in oklab, var(--c-info), transparent 88%); color: var(--c-info); border-color: color-mix(in oklab, var(--c-info), transparent 75%); }
.pill.ai { background: color-mix(in oklab, var(--c-ai), transparent 88%); color: var(--c-ai); border-color: color-mix(in oklab, var(--c-ai), transparent 75%); }
.pill.accent { background: var(--accent-soft); color: var(--accent-soft-fg); border-color: transparent; }
.pill.solid.success { background: var(--c-success); color: white; border-color: transparent; }
.pill.solid.danger { background: var(--c-danger); color: white; border-color: transparent; }

/* mono */
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }

/* ============================================================ */
/*  Table - unified styles for ALL .tbl                          */
/* ============================================================ */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.4;
}
.tbl thead th {
  position: sticky; top: 0;
  text-align: left;
  font-weight: 500;
  font-size: 10.5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  height: 38px;
  white-space: nowrap;
  z-index: 1;
}
.tbl tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  font-size: 13px;
}
.tbl tbody tr {
  height: 48px; /* minimum row height; cell padding expands as needed */
}
.tbl tbody tr:hover td { background: var(--bg-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.selected td { background: var(--accent-soft); }

/* numeric cells: same font scale, tabular */
.tbl .num,
.tbl .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}
.tbl .muted { color: var(--text-muted); }

/* normalize sub-line beneath a primary value (used in name+subtitle pattern) */
.tbl tbody td > div:not(.pill) > div:last-child:not(:only-child) {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* primary value above sub-line */
.tbl tbody td > div > strong {
  font-weight: 500;
  font-size: 13px;
}

/* normalize pills inside table cells */
.tbl .pill {
  height: 20px;
  font-size: 10.5px;
}

/* normalize action buttons inside tables (row-end menus, play, etc.) */
.tbl .icon-btn { width: 26px; height: 26px; }
.tbl .btn.sm { height: 26px; padding: 0 10px; font-size: 11.5px; }
.tbl .btn.sm.icon-only { width: 26px; padding: 0; }

/* normalize svg icons inside table cells */
.tbl tbody td svg { vertical-align: middle; }

/* small inline progress bars in cells */
.tbl tbody td .bar-mini,
.tbl tbody td span[style*="background: var(--border)"][style*="height: 4px"] { /* targeting inline progress bars in code */
  flex-shrink: 0;
}

/* ============================================================ */
/*  Toolbar - table page header bar                              */
/* ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
  row-gap: 8px;
}
.toolbar .spacer { flex: 1; }
.toolbar .topbar-search { height: 30px; width: 280px; }
.toolbar .select.sm { height: 30px; font-size: 12px; padding-right: 26px; }
.toolbar .tabs { border-bottom: 0; margin-bottom: 0; }
.toolbar .tab { padding: 6px 12px; }
.toolbar .btn { height: 30px; font-size: 12px; }
.toolbar .live-dot { font-size: 10px; }

/* fields */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.cfg-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cfg-field > div:first-child {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10.5px;
  color: var(--text-faint);
}
.cfg-field .input, .cfg-field .select, .cfg-field .textarea { width: 100%; }
.field label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.field label .hint { color: var(--text-faint); font-weight: 400; margin-left: 4px; font-family: var(--font-mono); font-size: 10.5px; }
.input, .select, .textarea {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  outline: 0;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.textarea { padding: 8px 10px; height: auto; min-height: 60px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.input.mono { font-family: var(--font-mono); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 14px) center, calc(100% - 10px) center; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; padding-right: 26px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; user-select: none; }
.checkbox input { width: 14px; height: 14px; accent-color: var(--accent); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 12.5px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 28px; height: 16px; background: var(--border-strong); border-radius: 999px; transition: background 120ms ease; position: relative; }
.switch .track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; background: white; border-radius: 50%; transition: transform 160ms ease; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked ~ .track { background: var(--accent); }
.switch input:checked ~ .track::after { transform: translateX(12px); }

.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}

.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ============================================================ */
/*  Layout helpers                                               */
/* ============================================================ */

.grid { display: grid; gap: 12px; }
.row { display: flex; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ============================================================ */
/*  Widgets - Dashboard / Wallboard                              */
/* ============================================================ */

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 10.5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  display: flex; align-items: center; gap: 6px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  display: flex; align-items: baseline; gap: 6px;
}
.kpi-value .unit, .kpi-value .total { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.kpi-delta { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); }
.kpi-delta.up { color: var(--c-success); }
.kpi-delta.down { color: var(--c-danger); }
.kpi .sparkline { position: absolute; right: 12px; bottom: 12px; opacity: 0.4; }

.kpi.accent { border-color: var(--accent); background: color-mix(in oklab, var(--accent-soft), transparent 50%); }

/* ============================================================ */
/*  Omnichannel workspace additions                              */
/* ============================================================ */

/* channel filter chips */
.chan-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.chan-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 9px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-size: 11.5px; cursor: pointer; transition: all 100ms ease;
  user-select: none;
}
.chan-chip:hover { border-color: var(--border-strong); color: var(--text); }
.chan-chip.active { background: var(--accent-soft); color: var(--accent-soft-fg); border-color: transparent; }
.chan-chip .cc-count { font-family: var(--font-mono); font-size: 10px; opacity: 0.7; }
.chan-chip svg { width: 13px; height: 13px; }

/* unified inbox */
.omni-inbox { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.inbox-scroll { overflow-y: auto; min-height: 0; flex: 1; }
.inbox-group {
  padding: 7px 12px 5px;
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); position: sticky; top: 0; background: var(--surface); z-index: 1;
  display: flex; align-items: center; gap: 6px;
}
.inbox-item {
  display: flex; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 100ms ease; position: relative;
}
.inbox-item:hover { background: var(--bg-2); }
.inbox-item.active { background: var(--accent-soft); }
.inbox-item.active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.inbox-item .ii-av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600;
  position: relative;
}
.inbox-item .ii-ch {
  position: absolute; right: -3px; bottom: -3px;
  width: 16px; height: 16px; border-radius: 5px;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.inbox-item.active .ii-ch { border-color: var(--accent-soft); }
.inbox-item .ii-ch svg { width: 9px; height: 9px; color: #fff; }
.inbox-item .ii-body { flex: 1; min-width: 0; }
.inbox-item .ii-row1 { display: flex; align-items: baseline; gap: 6px; }
.inbox-item .ii-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item .ii-time { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); flex-shrink: 0; }
.inbox-item .ii-msg { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.inbox-item .ii-tags { display: flex; gap: 4px; margin-top: 5px; align-items: center; }
.inbox-item .ii-unread {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  display: grid; place-items: center;
}

/* conversation header (text channels) */
.conv-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap; row-gap: 8px;
}
.conv-head .ch-av {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 14px; position: relative; flex-shrink: 0;
}
.conv-head .ch-meta { flex: 1; min-width: 120px; }
.conv-head .ch-name { font-size: 15px; font-weight: 600; }
.conv-head .ch-sub { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.conv-head .ch-actions { display: flex; gap: 6px; flex-shrink: 0; margin-left: auto; }
@media (max-width: 1480px) {
  .conv-head .ch-actions .btn-label { display: none; }
  .conv-head .ch-actions .btn.sm { width: 30px; padding: 0; justify-content: center; }
}

/* message thread (reuses transcript bubble styles, adds inbound/outbound time rows) */
.thread { display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.thread-day { text-align: center; font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin: 4px 0; }

/* composer */
.composer { border-top: 1px solid var(--border); background: var(--surface); }
.composer-suggest { display: flex; gap: 6px; padding: 10px 12px 0; flex-wrap: wrap; }
.suggest-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--c-ai), transparent 70%);
  background: color-mix(in oklab, var(--c-ai), transparent 93%);
  color: var(--text); font-size: 12px; cursor: pointer; transition: all 100ms ease;
  max-width: 100%; text-align: left;
}
.suggest-chip:hover { background: color-mix(in oklab, var(--c-ai), transparent 86%); border-color: var(--c-ai); }
.suggest-chip svg { width: 12px; height: 12px; color: var(--c-ai); flex-shrink: 0; }
.composer-box { display: flex; gap: 8px; align-items: flex-end; padding: 12px; }
.composer-box textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 120px;
  padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font-size: 13.5px; font-family: var(--font-sans);
  outline: none; line-height: 1.45;
}
.composer-box textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); background: var(--surface); }
.composer-tools { display: flex; align-items: center; gap: 4px; padding: 0 12px 10px; }
.composer-tools .spacer { flex: 1; }
.composer-tools .hint { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }

/* copilot / context tabs in right column */
.copilot-action {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-2);
}
.copilot-action .ic { width: 26px; height: 26px; border-radius: 7px; background: color-mix(in oklab, var(--c-ai), transparent 88%); color: var(--c-ai); display: grid; place-items: center; flex-shrink: 0; }
.copilot-action .ca-t { font-size: 12.5px; font-weight: 500; }
.copilot-action .ca-d { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.kb-snippet { padding: 10px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; }
.kb-snippet .kb-src { font-family: var(--font-mono); font-size: 10px; color: var(--c-ai); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 6px; display: flex; align-items: center; gap: 5px; }

/* channel timeline dot in customer history */
.cust-hist { display: flex; flex-direction: column; gap: 0; }
.cust-hist .ch-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cust-hist .ch-item:last-child { border-bottom: 0; }
.cust-hist .ch-dot { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.cust-hist .ch-dot svg { width: 12px; height: 12px; }

/* softphone collapse */
.softphone-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 14px; background: var(--surface); border: 0; border-top: 1px solid var(--border);
  color: var(--text); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.softphone-toggle:hover { background: var(--bg-2); }

/* row actions dropdown */
.row-menu {
  position: fixed; z-index: 200;
  min-width: 160px; padding: 5px;
  background: var(--elevated); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1px;
  animation: rm-in 120ms ease;
}
@keyframes rm-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.row-menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border: 0; background: transparent;
  border-radius: var(--r-sm); font-size: 13px; color: var(--text);
  text-align: left; width: 100%; transition: background 100ms ease;
}
.row-menu-item:hover { background: var(--bg-2); }
.row-menu-item.danger { color: var(--c-danger); }
.row-menu-item.danger:hover { background: color-mix(in oklab, var(--c-danger), transparent 88%); }
.row-menu-item svg { opacity: 0.75; }

/* live dot */
.live-dot {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--c-danger);
}
.live-dot::before {
  content: ""; width: 6px; height: 6px; background: var(--c-danger); border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--c-danger); }
  50% { opacity: 0.6; box-shadow: 0 0 0 5px transparent; }
}

/* ============================================================ */
/*  Agent Workspace                                              */
/* ============================================================ */

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  gap: 12px;
  padding: 16px;
  flex: 1;
  min-height: 0;
}
.workspace[data-layout="phone-left"] {
  grid-template-columns: 340px minmax(0, 1fr) 280px;
}
.workspace[data-layout="focused"] {
  grid-template-columns: minmax(0, 1fr) 360px;
}
.workspace[data-layout="focused"] .ws-col-left { display: none; }

@media (max-width: 1280px) {
  .workspace[data-layout="default"] {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .workspace[data-layout="default"] .ws-col-left { display: none; }
  .workspace[data-layout="phone-left"] {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .workspace[data-layout="phone-left"] .ws-col-right { display: none; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .brand { width: 220px; }
}

.ws-col-left, .ws-col-center, .ws-col-right {
  display: flex; flex-direction: column; gap: 12px;
  min-height: 0;
}
.ws-col-center { min-width: 0; }

/* agent card */
.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.agent-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.7 0.15 290), oklch(0.65 0.2 45));
  color: white; display: grid; place-items: center;
  font-size: 15px; font-weight: 600;
  position: relative;
}
.agent-avatar::after {
  content: ""; position: absolute; bottom: 0; right: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c-success);
  border: 2px solid var(--surface);
}
.agent-name { font-weight: 600; font-size: 14px; }
.agent-meta { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }

.agent-status-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.agent-status-bar.available { border-left: 3px solid var(--c-success); }
.agent-status-bar.on-call { border-left: 3px solid var(--c-info); background: color-mix(in oklab, var(--c-info), transparent 92%); }
.agent-status-bar.on-pause { border-left: 3px solid var(--c-warning); background: color-mix(in oklab, var(--c-warning), transparent 92%); }
.agent-status-bar.post-handoff { border-left: 3px solid var(--c-ai); background: color-mix(in oklab, var(--c-ai), transparent 92%); }

/* current call card */
.call-hero {
  display: flex; gap: 16px;
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  align-items: center;
}
.call-hero .caller-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.7 0.12 220), oklch(0.6 0.15 260));
  color: white; display: grid; place-items: center;
  font-size: 20px; font-weight: 600;
  flex-shrink: 0;
}
.call-hero .meta { flex: 1; min-width: 0; }
.call-hero .name { font-size: 16px; font-weight: 600; }
.call-hero .number { font-family: var(--font-mono); color: var(--text-muted); font-size: 13px; }
.call-hero .duration {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}
.call-hero .duration-label { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }

.call-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.call-action {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11.5px;
  color: var(--text-muted);
  flex: 1;
  min-width: 70px;
  transition: all 120ms ease;
}
.call-action:hover { background: var(--bg-2); color: var(--text); border-color: var(--border-strong); }
.call-action.active { background: var(--accent-soft); color: var(--accent-soft-fg); border-color: transparent; }
.call-action.danger { color: var(--c-danger); border-color: color-mix(in oklab, var(--c-danger), transparent 70%); }
.call-action.danger:hover { background: var(--c-danger); color: white; }
.call-action svg { width: 18px; height: 18px; }

/* transcript */
.transcript {
  display: flex; flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.tx-msg {
  display: flex; gap: 10px;
  max-width: 88%;
}
.tx-msg.caller { align-self: flex-start; }
.tx-msg.agent { align-self: flex-end; flex-direction: row-reverse; }
.tx-msg.ai { align-self: flex-start; }
.tx-msg .who-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 600; color: white;
  flex-shrink: 0;
}
.tx-msg.caller .who-avatar { background: oklch(0.6 0.15 220); }
.tx-msg.agent .who-avatar { background: var(--accent); color: var(--accent-fg); }
.tx-msg.ai .who-avatar { background: var(--c-ai); }
.tx-bubble {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.tx-meta {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  display: flex; gap: 8px;
}
.tx-text {
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.tx-msg.agent .tx-text { background: var(--accent-soft); border-color: transparent; color: var(--accent-soft-fg); }
.tx-msg.ai .tx-text { background: color-mix(in oklab, var(--c-ai), transparent 92%); border-color: color-mix(in oklab, var(--c-ai), transparent 80%); }
.tx-text.partial::after {
  content: "▍";
  color: var(--text-muted);
  animation: blink 1s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* phone widget */
.phone {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.phone-ext {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.phone-ext .num { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.phone-ext .reg { margin-left: auto; }

.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dialpad button {
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  transition: all 80ms ease;
}
.dialpad button:hover { background: var(--bg-2); border-color: var(--border-strong); }
.dialpad button:active { transform: scale(0.97); background: var(--accent-soft); }
.dialpad button .sub { font-size: 9px; color: var(--text-faint); letter-spacing: 0.1em; font-weight: 400; }

/* queue table */
.queue-row { cursor: pointer; }
.queue-row.queue-level td { font-weight: 500; }
.queue-row.queue-level .answer-btn { background: var(--c-success); color: white; border-color: transparent; }
.level-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 4px;
}
.level-tag.did { background: color-mix(in oklab, var(--c-info), transparent 88%); color: var(--c-info); }
.level-tag.condition { background: color-mix(in oklab, var(--c-warning), transparent 88%); color: oklch(0.55 0.16 75); }
:root[data-theme="dark"] .level-tag.condition { color: var(--c-warning); }
.level-tag.ivr { background: color-mix(in oklab, var(--c-ai), transparent 88%); color: var(--c-ai); }
.level-tag.queue { background: color-mix(in oklab, var(--c-success), transparent 88%); color: var(--c-success); }

/* sentiment bar */
.sentiment {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.sentiment .label { font-size: 10.5px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); display: flex; justify-content: space-between; }
.sentiment .bar { height: 6px; border-radius: 3px; background: var(--border); position: relative; overflow: hidden; }
.sentiment .bar .fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--c-danger), var(--c-warning), var(--c-success)); }
.sentiment .bar .marker {
  position: absolute; top: -2px; width: 2px; height: 10px;
  background: var(--text); border-radius: 1px;
}

/* AI summary card */
.ai-summary {
  padding: 12px;
  background: color-mix(in oklab, var(--c-ai), transparent 94%);
  border: 1px solid color-mix(in oklab, var(--c-ai), transparent 75%);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 8px;
}
.ai-summary .header {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-ai);
}
.ai-summary p { margin: 0; font-size: 12.5px; color: var(--text); line-height: 1.55; }
.ai-summary ul { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--text); line-height: 1.6; }

/* chat */
.chat {
  display: flex; flex-direction: column;
  min-height: 0;
  flex: 1;
}
.chat-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; overflow-y: auto; flex: 1; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; }
.chat-msg .who { font-weight: 500; color: var(--text); }
.chat-msg .at { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-left: auto; }
.chat-msg .text { color: var(--text-muted); flex: 1; }
.chat-input {
  display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.chat-input input { flex: 1; height: 26px; padding: 0 8px; font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); outline: none; }

/* ============================================================ */
/*  IVR builder canvas                                           */
/* ============================================================ */

.flow-canvas {
  position: relative;
  background: var(--bg-2);
  background-image:
    radial-gradient(circle, var(--grid-line) 1px, transparent 1px);
  background-size: 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  height: 520px;
  overflow: hidden;
}
.flow-node {
  position: absolute;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 12px;
}
.flow-node .head {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.flow-node .head.start { background: color-mix(in oklab, var(--c-info), transparent 90%); color: var(--c-info); }
.flow-node .head.ivr-node { background: color-mix(in oklab, var(--c-ai), transparent 90%); color: var(--c-ai); }
.flow-node .head.queue { background: color-mix(in oklab, var(--c-success), transparent 90%); color: var(--c-success); }
.flow-node .head.vm { background: color-mix(in oklab, var(--c-warning), transparent 90%); color: oklch(0.55 0.16 75); }
:root[data-theme="dark"] .flow-node .head.vm { color: var(--c-warning); }
.flow-node .body { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.flow-node .body .key { font-family: var(--font-mono); color: var(--text-muted); font-size: 11px; }
.flow-node .body .val { color: var(--text); }
.flow-node.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.flow-node .port { position: absolute; right: -5px; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); transform: translateY(-50%); }
.flow-node .port.in { left: -5px; right: auto; background: var(--text-muted); }

.flow-edge { stroke: var(--border-strong); stroke-width: 1.5; fill: none; }
.flow-edge.active { stroke: var(--accent); }
.flow-edge-label { fill: var(--text-muted); font-family: var(--font-mono); font-size: 10px; }

/* ============================================================ */
/*  Misc                                                         */
/* ============================================================ */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 8px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  user-select: none;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.tab .count { margin-left: 4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); padding: 1px 5px; background: var(--bg-2); border-radius: 999px; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty .icon { opacity: 0.3; margin-bottom: 12px; }

/* dotgrid bg used for some panels */
.dotgrid {
  background-image: radial-gradient(circle, var(--grid-line) 1px, transparent 1px);
  background-size: 12px 12px;
}

/* live activity wave */
.wave {
  display: inline-flex; align-items: end; gap: 2px; height: 16px;
}
.wave span {
  width: 2px; background: currentColor; border-radius: 1px;
  animation: wave 1s ease-in-out infinite;
}
.wave span:nth-child(1) { animation-delay: 0.0s; height: 60%; }
.wave span:nth-child(2) { animation-delay: 0.1s; height: 90%; }
.wave span:nth-child(3) { animation-delay: 0.2s; height: 50%; }
.wave span:nth-child(4) { animation-delay: 0.3s; height: 80%; }
.wave span:nth-child(5) { animation-delay: 0.4s; height: 40%; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* incoming call toast */
.incoming-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex; gap: 12px; align-items: center;
  animation: slideup 240ms ease;
}
.incoming-toast.urgent { border-color: var(--c-success); box-shadow: 0 0 0 1px var(--c-success), var(--shadow-lg); }
@keyframes slideup { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.incoming-toast .ringing { color: var(--c-success); animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-15deg); } 75% { transform: rotate(15deg); } }

/* timeline used in call history drill-down */
.timeline { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.tl-item { display: flex; gap: 10px; align-items: flex-start; position: relative; }
.tl-item::before {
  content: ""; position: absolute; left: 6px; top: 16px; bottom: -8px; width: 1px; background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-item .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); z-index: 1; margin-top: 4px; flex-shrink: 0; }
.tl-item.success .dot { border-color: var(--c-success); }
.tl-item.ai .dot { border-color: var(--c-ai); }
.tl-item.warning .dot { border-color: var(--c-warning); }
.tl-item .ts { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-right: 6px; }
.tl-item .label { font-size: 12.5px; }
.tl-item .body { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }

/* latency waterfall */
.waterfall { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; }
.wf-row { display: grid; grid-template-columns: 160px 1fr 64px; align-items: center; gap: 8px; font-size: 12px; }
.wf-row .name { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.wf-row .track { height: 12px; background: var(--bg-2); border-radius: 3px; position: relative; overflow: hidden; }
.wf-row .fill { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.wf-row .fill.ai { background: var(--c-ai); }
.wf-row .fill.network { background: var(--c-info); }
.wf-row .fill.audio { background: var(--c-success); }
.wf-row .fill.warn { background: var(--c-warning); }
.wf-row .val { font-family: var(--font-mono); font-size: 11px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }

/* placeholder content */
.placeholder-shimmer {
  background: linear-gradient(90deg, var(--bg-2), var(--surface-2), var(--bg-2));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
