/* ═══════════════════════════════════════════════════════════════════════════
   Trolly · Consola de operaciones — sistema de diseño v2
   Dark "slate + indigo" refinado. Limpio, mucho aire, acento contenido,
   gráficos reales. Sin dependencias externas (CSP-safe).
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Acento (contenido: solo para lo importante) */
  --brand:      #6366f1;   /* indigo */
  --brand-2:    #818cf8;
  --brand-3:    #8b5cf6;   /* violeta */
  --brand-ink:  #a5b4fc;
  --brand-glow: rgba(99, 102, 241, 0.35);
  --brand-soft: rgba(99, 102, 241, 0.12);

  /* Superficies (slate casi-negro con tinte frío) */
  --bg:      #0a0b10;
  --bg-2:    #0d0e14;
  --surface: #111219;
  --surface-2: #151721;
  --elev:    #191c27;
  --hover:   rgba(255, 255, 255, 0.035);
  --hover-2: rgba(129, 140, 248, 0.10);

  /* Bordes */
  --line:   rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.11);
  --line-3: rgba(255, 255, 255, 0.16);

  /* Texto */
  --txt:   #eceef4;
  --txt-2: #a2a7b5;
  --txt-3: #6a7080;
  --txt-4: #474d5c;

  /* Estados */
  --ok:   #10b981;  --ok-2:  #34d399;  --ok-bg:  rgba(16, 185, 129, 0.13);
  --warn: #f59e0b;  --warn-2:#fbbf24;  --warn-bg:rgba(245, 158, 11, 0.13);
  --err:  #ef4444;  --err-2: #f87171;  --err-bg: rgba(239, 68, 68, 0.13);
  --info: #3b82f6;  --info-2:#60a5fa;  --info-bg:rgba(59, 130, 246, 0.13);

  /* Tipografía */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;

  --r-xs: 8px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:    0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.5);

  --sidebar-w: 244px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--txt);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.011em;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--brand-ink); text-decoration: none; }
a:hover { color: var(--brand-2); }

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.muted { color: var(--txt-3); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.tnum { font-variant-numeric: tabular-nums; }

/* ── LOGIN ────────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(139, 92, 246, 0.10), transparent 55%),
    var(--bg);
}
.login-wrap::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 70%);
}
.login-card {
  position: relative; width: 100%; max-width: 400px;
  background: linear-gradient(180deg, rgba(25, 28, 39, 0.9), rgba(17, 18, 25, 0.94));
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 40px 36px 34px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.5s var(--ease);
}
.login-logo {
  width: 58px; height: 58px; margin: 0 auto 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  display: grid; place-items: center; font-size: 28px;
  box-shadow: 0 12px 30px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.login-card h1 { font-size: 22px; text-align: center; font-weight: 700; letter-spacing: -0.02em; }
.login-card .sub { font-size: 13px; color: var(--txt-3); text-align: center; margin: 7px 0 28px; }

/* ── APP SHELL ────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 20;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 18px;
}
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  display: grid; place-items: center; font-size: 18px;
  box-shadow: 0 6px 16px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-tag { font-size: 11px; color: var(--txt-3); letter-spacing: 0; }

.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--txt-4); padding: 16px 10px 7px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--txt-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
  user-select: none; position: relative;
}
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; transition: opacity 0.14s; }
.nav-item:hover { background: var(--hover); color: var(--txt); }
.nav-item:hover .ico { opacity: 0.95; }
.nav-item.active {
  background: var(--brand-soft); color: #fff;
}
.nav-item.active .ico { opacity: 1; color: var(--brand-2); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700;
  background: var(--err); color: #fff; border-radius: 20px;
  min-width: 19px; height: 18px; padding: 0 6px; display: grid; place-items: center;
}
.nav-badge.live { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.reg-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--txt-4); transition: background 0.2s, box-shadow 0.2s; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: var(--r-sm);
  transition: background 0.14s;
}
.user-chip:hover { background: var(--hover); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; color: #fff;
}
.user-meta { overflow: hidden; }
.user-email { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10.5px; color: var(--txt-3); }
.logout-btn {
  margin-left: auto; background: none; border: none; color: var(--txt-3);
  cursor: pointer; font-size: 16px; padding: 6px; border-radius: 8px; line-height: 1;
  display: grid; place-items: center;
}
.logout-btn:hover { color: var(--err); background: var(--err-bg); }

/* ── MAIN ─────────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 11, 16, 0.7);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 15;
  min-height: 64px;
}
.topbar h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.topbar .page-sub { font-size: 12px; color: var(--txt-3); margin-top: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line-2);
  color: var(--txt-2); white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--txt-3); }
.pill.ok    { color: var(--ok-2); border-color: rgba(16, 185, 129, 0.25); background: var(--ok-bg); }
.pill.ok .dot    { background: var(--ok); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.pill.warn  { color: var(--warn-2); border-color: rgba(245, 158, 11, 0.25); background: var(--warn-bg); }
.pill.warn .dot  { background: var(--warn); }
.pill.err   { color: var(--err-2); border-color: rgba(239, 68, 68, 0.25); background: var(--err-bg); }
.pill.err .dot   { background: var(--err); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

.content { padding: 24px 26px 48px; flex: 1; max-width: 1440px; width: 100%; }
.view { animation: fade 0.3s var(--ease); }

/* ── BOTONES / CONTROLES ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: transform 0.08s var(--ease), background 0.16s, border-color 0.16s, box-shadow 0.16s;
  font-family: var(--font); white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-3)); color: #fff; box-shadow: 0 6px 18px var(--brand-glow); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 24px var(--brand-glow); filter: brightness(1.06); }
.btn-call   { background: var(--ok); color: #04241a; box-shadow: 0 6px 18px rgba(16, 185, 129, 0.28); }
.btn-call:hover:not(:disabled) { filter: brightness(1.06); }
.btn-hangup { background: var(--err); color: #fff; box-shadow: 0 6px 18px rgba(239, 68, 68, 0.28); }
.btn-ghost  { background: var(--surface); color: var(--txt); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-3); }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--txt-2);
  display: grid; place-items: center; cursor: pointer; transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.btn-icon:hover { background: var(--surface-2); border-color: var(--line-3); color: var(--txt); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn.spin svg, .btn-icon.spin svg { animation: spin 0.7s linear infinite; }

label.field-label { display: block; font-size: 11.5px; color: var(--txt-2); margin: 15px 0 7px; font-weight: 600; letter-spacing: -0.005em; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--txt); font-size: 14px; outline: none; font-family: var(--font);
  transition: border-color 0.14s, box-shadow 0.14s, background 0.14s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: var(--surface-2); box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder { color: var(--txt-4); }
select { cursor: pointer; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%236a7080' stroke-width='1.6' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }

.search { position: relative; }
.search input { padding-left: 38px; }
.search .search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--txt-3); pointer-events: none; display: grid; }

/* ── KPI CARDS ────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; position: relative; overflow: hidden;
  transition: border-color 0.16s, transform 0.16s, background 0.16s;
}
.kpi:hover { border-color: var(--line-2); background: var(--surface-2); }
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.kpi-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--kpi-bg, var(--brand-soft)); color: var(--kpi-c, var(--brand-2)); flex-shrink: 0; }
.kpi-delta { margin-left: auto; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 20px; }
.kpi-delta.up { color: var(--ok-2); background: var(--ok-bg); }
.kpi-delta.down { color: var(--err-2); background: var(--err-bg); }
.kpi-delta.flat { color: var(--txt-3); background: var(--hover); }
.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12.5px; color: var(--txt-2); margin-top: 5px; }
.kpi-foot { font-size: 11px; color: var(--txt-3); margin-top: 4px; }
.kpi-spark { margin-top: 12px; height: 34px; }
.kpi-spark svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* ── PANELS / CARDS ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14.5px; font-weight: 650; font-weight: 600; letter-spacing: -0.01em; }
.card-head .sub { font-size: 11.5px; color: var(--txt-3); margin-top: 1px; }
.card-head .card-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar input, .toolbar select { padding-top: 9px; padding-bottom: 9px; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  border: none; background: none; color: var(--txt-2); cursor: pointer;
  padding: 6px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; font-family: var(--font);
  transition: background 0.14s, color 0.14s;
}
.seg button:hover { color: var(--txt); }
.seg button.active { background: var(--brand); color: #fff; }

/* ── CHART elementos (SVG propios) ────────────────────────────────────────── */
.chart-wrap { padding: 6px 4px 0; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 4px 2px 0; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--txt-2); }
.chart-legend .lg .sw { width: 9px; height: 9px; border-radius: 3px; }
.axis-label { font-size: 10px; fill: var(--txt-4); font-family: var(--font); }
.chart-grid-line { stroke: var(--line); stroke-width: 1; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 22px; padding: 6px 2px; }
.donut-center { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.donut-center small { display: block; font-size: 11px; color: var(--txt-3); font-weight: 500; letter-spacing: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.donut-legend .dl { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.donut-legend .dl .sw { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .dl .dl-k { color: var(--txt-2); }
.donut-legend .dl .dl-v { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── TABLES ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--txt-3); font-weight: 600; padding: 11px 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { padding: 56px 20px; text-align: center; color: var(--txt-3); }
.empty .empty-ico { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-size: 24px; }
.empty h4 { font-size: 15px; color: var(--txt-2); font-weight: 600; margin-bottom: 5px; }
.empty div { font-size: 13px; }

/* ── BADGES / CHIPS ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap; line-height: 1.5;
}
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok    { color: var(--ok-2); background: var(--ok-bg); }
.badge.warn  { color: var(--warn-2); background: var(--warn-bg); }
.badge.err   { color: var(--err-2); background: var(--err-bg); }
.badge.info  { color: var(--info-2); background: var(--info-bg); }
.badge.neutral { color: var(--txt-2); background: var(--hover); }
.badge.brand { color: var(--brand-ink); background: var(--brand-soft); }

.src-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.03em; padding: 3px 7px; border-radius: 6px; text-transform: uppercase; }
.src-tag.app { color: var(--brand-ink); background: var(--brand-soft); }
.src-tag.web { color: var(--info-2); background: var(--info-bg); }

.avatar-sm { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand-2), var(--brand-3)); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex-shrink: 0; color: #fff; }
.cell-user { display: flex; align-items: center; gap: 11px; }
.cell-title { font-weight: 600; letter-spacing: -0.005em; }
.cell-sub { font-size: 11.5px; color: var(--txt-3); margin-top: 1px; }

/* ── AUDIO PLAYER ─────────────────────────────────────────────────────────── */
.play-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--brand-2); cursor: pointer;
  display: grid; place-items: center; transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.play-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.play-btn:disabled { opacity: 0.28; cursor: not-allowed; }
.play-btn.playing { background: var(--brand); color: #fff; border-color: var(--brand); }

.audio-dock {
  position: fixed; left: calc(var(--sidebar-w) + 26px); right: 26px; bottom: 20px;
  background: var(--elev);
  border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 12px 16px;
  display: flex; align-items: center; gap: 15px; z-index: 40;
  animation: rise 0.28s var(--ease);
}
.audio-dock .adock-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); flex-shrink: 0; }
.audio-dock .adock-meta { min-width: 0; }
.audio-dock .adock-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-dock .adock-sub { font-size: 11.5px; color: var(--txt-3); }
.audio-dock audio { flex: 1; height: 38px; }
.audio-dock .adock-close { background: none; border: none; color: var(--txt-3); font-size: 20px; cursor: pointer; line-height: 1; padding: 6px; border-radius: 8px; }
.audio-dock .adock-close:hover { color: var(--err); background: var(--err-bg); }

/* ── LIVE VIEW ────────────────────────────────────────────────────────────── */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.live-card {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 18px; position: relative; overflow: hidden;
}
.live-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent, var(--ok), transparent); animation: sweep 2.2s linear infinite; }
.live-card .lc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.live-wave { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.live-wave span { width: 3px; background: var(--ok); border-radius: 3px; animation: wave 1s ease-in-out infinite; }
.live-wave span:nth-child(2) { animation-delay: 0.15s; }
.live-wave span:nth-child(3) { animation-delay: 0.3s; }
.live-wave span:nth-child(4) { animation-delay: 0.45s; }
.live-wave span:nth-child(5) { animation-delay: 0.6s; }
.lc-num { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.lc-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 7px 0; border-top: 1px solid var(--line); }
.lc-row .k { color: var(--txt-3); }
.lc-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ok-2); }

/* ── LOGS VIEW ────────────────────────────────────────────────────────────── */
.log-view {
  background: #07080c; border: 1px solid var(--line); border-radius: var(--r);
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
  padding: 14px 16px; height: 64vh; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.log-line { padding: 1px 6px; color: var(--txt-2); border-radius: 4px; }
.log-line:hover { background: rgba(255, 255, 255, 0.03); }
.log-line.err { color: var(--err-2); }
.log-line.warn { color: var(--warn-2); }
.log-line.ok { color: var(--ok-2); }
.log-line .ts { color: var(--txt-4); }

/* ── SOFTPHONE VIEW ───────────────────────────────────────────────────────── */
.dial-layout { display: grid; grid-template-columns: minmax(0, 400px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 940px) { .dial-layout { grid-template-columns: 1fr; } }

.phone-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.fx-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.fx-btn {
  padding: 11px 6px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--txt); font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: transform 0.1s, background 0.16s, border-color 0.16s;
  display: flex; flex-direction: column; align-items: center; gap: 5px; line-height: 1.1;
}
.fx-btn .fx-emoji { font-size: 19px; }
.fx-btn:hover { border-color: var(--line-3); }
.fx-btn:active { transform: scale(0.95); }
.fx-btn.active { background: var(--brand-soft); border-color: var(--brand); color: #fff; }
.fx-slider-wrap { margin-top: 14px; }
.fx-slider-wrap .fx-slider-val { float: right; opacity: 0.85; font-weight: 700; }

/* Voz IA (Fase B): switch + selector de voces. Estética coherente con el panel. */
.vc-switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--txt-2); cursor: pointer; user-select: none; }
.vc-switch input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.vc-select {
  padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--txt); font-size: 13px; font-weight: 600; cursor: pointer;
}
.vc-select:focus { outline: none; border-color: var(--brand); }
input[type="range"] { width: 100%; accent-color: var(--brand); margin-top: 6px; cursor: pointer; padding: 0; height: auto; background: none; border: none; box-shadow: none; }

.call-status {
  margin-top: 18px; padding: 12px; border-radius: var(--r-sm); text-align: center; font-size: 13.5px;
  background: var(--surface-2); min-height: 46px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--txt-2);
}
.call-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.call-status .dot.on  { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.call-status .dot.off { background: var(--err); }
.call-status .dot.ring{ background: var(--warn); animation: pulse 1s infinite; }
.call-timer { font-size: 32px; font-weight: 700; text-align: center; margin-top: 14px; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.hint { font-size: 12px; margin-top: 7px; min-height: 16px; color: var(--txt-3); }
.status-msg { margin-top: 14px; padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; text-align: center; min-height: 20px; color: var(--txt-2); }

.recent-list { display: flex; flex-direction: column; gap: 7px; }
.recent-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; transition: border-color 0.14s, background 0.14s;
}
.recent-item:hover { border-color: var(--line-3); background: var(--surface-2); }
.recent-item .ri-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.recent-item .ri-num { font-weight: 600; font-size: 13.5px; }
.recent-item .ri-sub { font-size: 11px; color: var(--txt-3); }

/* ── SKELETON / LOADING ───────────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 37%, rgba(255,255,255,0.03) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
.spinner { width: 30px; height: 30px; border: 2.5px solid var(--line-2); border-top-color: var(--brand-2); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 34px auto; }

/* ── TOAST ────────────────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--elev); border: 1px solid var(--line-2); border-left: 3px solid var(--brand);
  border-radius: var(--r-sm); padding: 12px 16px; font-size: 13px; box-shadow: var(--shadow-lg);
  min-width: 240px; max-width: 360px; animation: slideIn 0.25s var(--ease);
}
.toast.ok  { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast .t-title { font-weight: 600; margin-bottom: 2px; }
.toast .t-msg { color: var(--txt-2); font-size: 12px; }

/* ── ANIMACIONES ──────────────────────────────────────────────────────────── */
@keyframes pulse   { 50% { opacity: 0.35; } }
@keyframes fade    { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rise    { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -135% 0; } }
@keyframes sweep   { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes wave    { 0%, 100% { height: 5px; opacity: 0.6; } 50% { height: 20px; opacity: 1; } }
@keyframes draw    { from { stroke-dashoffset: var(--len, 1000); } to { stroke-dashoffset: 0; } }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.25s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: grid; }
  .audio-dock { left: 14px; right: 14px; }
  .content { padding: 18px 14px 40px; }
  .topbar { padding: 12px 16px; }
  .dial-layout { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar .pill { display: none; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
}
