:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --border: #e3e5e8;
  --text: #16181d;
  --text-2: #52565e;
  --muted: #8a8f98;
  --brand: #1f6fe5;
  --brand-dark: #1857b6;
  --side: #121a2b;
  --side-2: #1b2540;
  --side-text: #c7cede;

  --s-good: #1a8a4a;
  --s-good-bg: #e5f5ec;
  --s-warn: #b86e00;
  --s-warn-bg: #fff3dc;
  --s-bad: #c62f2f;
  --s-bad-bg: #fde8e8;
  --s-info: #2a78d6;
  --s-info-bg: #e6f0fc;
  --s-idle: #6b7280;
  --s-idle-bg: #eef0f2;

  --series-1: #2a78d6; /* contestadas */
  --series-2: #eb6834; /* abandonadas */

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 15px; }
.brand svg { width: 26px; height: 26px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--side-text); margin-bottom: 2px; font-weight: 500; }
.nav a:hover { background: var(--side-2); text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-footer { margin-top: auto; padding: 10px; border-top: 1px solid var(--side-2); font-size: 12px; }
.side-footer .who { color: #fff; font-weight: 600; font-size: 13px; }
.side-footer button { margin-top: 8px; width: 100%; }
.pbx { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--s-idle); flex: none; }
.dot.ok { background: #34c46a; }
.dot.bad { background: #ef4444; }

.main { padding: 22px 26px 40px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.agent { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid.cols-3, .grid.agent { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { display: flex; flex-wrap: wrap; }
  .side-footer { margin: 0; border: 0; }
  .grid.cols-2 { grid-template-columns: 1fr; }
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card > .card-head .spacer { flex: 1; }
.card > .card-body { padding: 16px; }
.card > .card-body.flush { padding: 0; }

/* ---------- Controles ---------- */
button, .btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover { background: var(--surface-2); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.good { background: var(--s-good); border-color: var(--s-good); color: #fff; }
button.warn { background: var(--s-warn); border-color: var(--s-warn); color: #fff; }
button.danger { background: var(--s-bad); border-color: var(--s-bad); color: #fff; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.sm { padding: 4px 9px; font-size: 12px; }
.sidebar button { background: var(--side-2); border-color: var(--side-2); color: var(--side-text); }

input, select, textarea { font: inherit; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--text); min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
textarea { resize: vertical; min-height: 70px; width: 100%; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 550; }
label.field input, label.field select, label.field textarea { font-size: 14px; color: var(--text); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.filters { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface-2); }
td.r, th.r { text-align: right; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---------- Etiquetas de estado ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--s-idle-bg); color: var(--s-idle); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-good { background: var(--s-good-bg); color: var(--s-good); }
.b-warn { background: var(--s-warn-bg); color: var(--s-warn); }
.b-bad { background: var(--s-bad-bg); color: var(--s-bad); }
.b-info { background: var(--s-info-bg); color: var(--s-info); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #121a2b, #1d3a6b); padding: 20px; }
.login { width: 100%; max-width: 380px; padding: 30px; }
.login h1 { margin-bottom: 4px; }
.login form { margin-top: 20px; }
.error-text { color: var(--s-bad); font-size: 13px; min-height: 18px; }

/* ---------- Consola del agente ---------- */
.statusbar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; }
.big-status { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; }
.big-status .dot { width: 12px; height: 12px; }
.timer { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 500; font-size: 14px; }
.callcard { border-left: 4px solid var(--brand); }
.callcard.ringing { border-left-color: var(--s-warn); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(184, 110, 0, 0.18); } }
.caller { font-size: 22px; font-weight: 700; letter-spacing: 0.3px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialpad { display: flex; gap: 8px; }
.dialpad input { flex: 1; font-size: 17px; letter-spacing: 1px; }

/* ---------- Tiles / KPIs ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 14px 16px; }
.tile .label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Supervisión ---------- */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.agent-card { padding: 12px 14px; border-left: 4px solid var(--s-idle); }
.agent-card.st-disponible { border-left-color: var(--s-good); }
.agent-card.st-en_llamada { border-left-color: var(--s-info); }
.agent-card.st-timbrando { border-left-color: var(--s-warn); }
.agent-card.st-pausa { border-left-color: var(--s-warn); }
.agent-card.st-telefono_desconectado { border-left-color: var(--s-bad); }
.agent-card .name { font-weight: 650; }
.agent-card .meta { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.agent-card .acts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.queue-card .waiting-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.queue-card .waiting-row:last-child { border: 0; }
.wait-long { color: var(--s-bad); font-weight: 700; }

/* ---------- Gráficas ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .bar-a { fill: var(--series-1); }
.chart .bar-b { fill: var(--series-2); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(16, 24, 40, 0.05); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip { position: fixed; pointer-events: none; background: #16181d; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 12px; z-index: 50; line-height: 1.5; }
.hbar { display: grid; grid-template-columns: 160px 1fr 50px; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; }
.hbar .track { background: var(--surface-2); border-radius: 4px; height: 12px; overflow: hidden; }
.hbar .fill { background: var(--series-1); height: 100%; border-radius: 0 4px 4px 0; }

/* ---------- Modal y avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 22, 0.45); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; }
.modal.wide { max-width: 860px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #16181d; color: #fff; padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); max-width: 360px; font-size: 13px; }
.toast.err { background: var(--s-bad); }
.toast.ok { background: var(--s-good); }

.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--surface-2); border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.comment .h { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.comment.sys { background: transparent; border: 1px dashed var(--border); color: var(--text-2); }
.pre { white-space: pre-wrap; }
audio { width: 100%; height: 36px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--text-2); }
.tabs button.active { border-bottom-color: var(--brand); color: var(--brand); }

/* ===================== v2: funciones nuevas ===================== */
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }
code.copy { display: block; padding: 8px 10px; cursor: copy; word-break: break-all; margin-top: 4px; }
code.copy.big { font-size: 14px; }
mark { background: #fff1b8; color: inherit; padding: 0 2px; border-radius: 3px; }
.brand-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; }
.nav-badge { margin-left: auto; background: var(--s-bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center; }
.grid.sup { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid.sup { grid-template-columns: 1fr; } }
.notice { background: var(--s-info-bg); color: #174e8f; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }
.notice-card { padding: 10px 14px; margin-bottom: 12px; border-left: 4px solid var(--s-warn); }
.script { background: var(--surface-2); border-left: 3px solid var(--brand); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; line-height: 1.5; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; font-weight: 500; color: var(--text); cursor: pointer; background: var(--surface); }
.chip:has(input:checked) { border-color: var(--brand); background: var(--s-info-bg); }
.toggle { font-weight: 400; color: var(--text); margin: 4px 0; }
.mini-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.sm-select { padding: 4px 8px; font-size: 12px; }
.stars { color: #d99a00; letter-spacing: 1px; }

.ai-box { background: linear-gradient(180deg, #f5f8ff, #fff); border: 1px solid #d9e5fb; border-radius: 10px; padding: 14px; margin-top: 12px; }
.flags { background: var(--s-bad-bg); color: #8f1f1f; border-radius: 8px; padding: 8px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.tl-step { text-align: center; }
.tl-arrow { color: var(--muted); }
.qa-list { list-style: none; margin: 0; padding: 0; font-size: 13px; columns: 2; }
.qa-list li.ok { color: var(--s-good); }
.qa-list li.no { color: var(--muted); }
.transcript { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.transcript summary { cursor: pointer; font-weight: 600; }
.transcript .seg { padding: 4px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.transcript .spk { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; margin-right: 2px; }
.transcript .spk-a { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--text); }
.transcript .spk-c { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

.stackbar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.stackbar.sm { height: 10px; }
.sb-positivo { background: var(--s-good); }
.sb-neutral { background: #b4b8bf; }
.sb-negativo { background: var(--s-bad); }
.legend i.sb-positivo, .legend i.sb-neutral, .legend i.sb-negativo { display: inline-block; }
.topic-row { display: grid; grid-template-columns: 190px 1fr 40px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.search-card { display: flex; gap: 8px; padding: 10px; margin-bottom: 16px; }
.search-card input { flex: 1; font-size: 15px; }

.heat { display: grid; gap: 2px; font-size: 11px; }
.heat-h { text-align: center; color: var(--muted); }
.heat-d { color: var(--text-2); font-weight: 600; display: flex; align-items: center; }
.heat-c { height: 28px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.erl-result { text-align: center; padding: 8px 0; }
.erl-result .value { font-size: 40px; font-weight: 800; color: var(--brand); }

.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.progress > div { height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.camp-row:hover { border-color: var(--brand); }
.logo-prev { width: 64px; height: 64px; border: 1px dashed var(--border); border-radius: 10px; display: grid; place-items: center; overflow: hidden; }
.logo-prev img { max-width: 100%; max-height: 100%; }
.api-list { padding-left: 18px; line-height: 1.9; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.picker-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; max-height: 220px; overflow: auto; }
.picker-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.picker-item:hover { background: var(--surface-2); }

/* Bandeja de conversaciones */
.inbox { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 120px); min-height: 480px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--border); overflow: auto; }
.inbox-filters { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.inbox-filters select { flex: 1; font-size: 12px; padding: 5px 8px; }
.conv { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--s-info-bg); }
.ch { font-size: 10px; font-weight: 800; border-radius: 4px; padding: 1px 5px; color: #fff; }
.ch-whatsapp { background: #1a8a4a; }
.ch-webchat { background: var(--brand); }
.inbox-chat { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; gap: 6px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-msgs { flex: 1; overflow: auto; padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; flex-direction: column; max-width: 72%; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg .bubble { padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.msg.in .bubble { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.out .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg.sys { align-self: center; font-size: 11px; color: var(--muted); max-width: none; }
.chat-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-compose textarea { min-height: 44px; }
.chat-warn { padding: 10px 14px; background: var(--s-warn-bg); color: #7a4a00; font-size: 13px; }
@media (max-width: 820px) { .inbox { grid-template-columns: 1fr; height: auto; } .inbox-chat { min-height: 60vh; } }
.card.card-body { padding: 16px; }
.card.card-body h3 { margin-bottom: 2px; }
.powered { margin-top: 10px; font-size: 11px; color: #6f7a94; letter-spacing: .04em; text-align: center; }
.brand-logo { width: 28px; height: 28px; }
/* Telefonía */
.sched-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.days { display: flex; gap: 3px; }
.day { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text-2); background: var(--surface); }
.day input { display: none; }
.day.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pat-row, .tk-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; flex-wrap: wrap; }
.pat-row input[data-k="match"] { width: 180px; }
pre.conf { margin: 0; padding: 12px 16px; font-size: 12px; max-height: 420px; overflow: auto; background: #0f1524; color: #d6def0; border-radius: 0 0 10px 10px; }
details.card > summary { list-style: none; }
.creds dd code { display: inline-block; margin: 0; }
.btn.sm { padding: 4px 9px; font-size: 12px; cursor: pointer; }

/* ---------- Reproductor de grabaciones ---------- */
.player-box { margin: 4px 0 14px; }
.rp { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); outline: none; }
.rp:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.rp button, .rp .btn { flex: none; }
.rp-play { width: 38px; height: 38px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: var(--brand); border-color: var(--brand); color: #fff; }
.rp-play:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.rp-skip { padding: 4px 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.rp-speed { min-width: 46px; padding: 4px 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.rp-track { position: relative; flex: 1; min-width: 120px; height: 44px; cursor: pointer; }
.rp-wave { width: 100%; height: 44px; display: block; }
.rp-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface-2); }
.rp-loading.err { color: var(--s-bad); }
.rp-marks { position: absolute; inset: 0; pointer-events: none; }
.rp-mark { position: absolute; top: -9px; transform: translateX(-50%); pointer-events: auto; padding: 0 3px; font-size: 11px; line-height: 16px; border-radius: 4px; background: var(--s-bad-bg); color: var(--s-bad); border: 1px solid color-mix(in srgb, var(--s-bad) 35%, transparent); }
.rp-time { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.rp-vol { width: 70px; accent-color: var(--brand); }
.rp-dl { display: inline-grid; place-items: center; padding: 6px 8px; }
.rp-error .rp-play, .rp-error .rp-skip, .rp-error .rp-speed { opacity: .45; pointer-events: none; }
.rp-compact { padding: 6px 8px; background: transparent; border: 0; }
.rp-compact .rp-play { width: 34px; height: 34px; }
.rp-compact .rp-track, .rp-compact .rp-wave { height: 36px; }
.transcript .seg.seekable { cursor: pointer; border-radius: 6px; padding: 3px 6px; margin: 0 -6px; }
.transcript .seg.seekable:hover { background: var(--surface-2); }
.transcript .seg.active { background: var(--s-info-bg); box-shadow: inset 3px 0 0 var(--brand); }
details.transcript { max-height: 260px; overflow: auto; }
.play-btn { color: var(--brand); font-size: 12px; }

/* Mini reproductor flotante */
.mini-player { position: fixed; left: 236px; right: 16px; bottom: 16px; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08); }
.mini-player .mp-info { flex: 0 0 230px; min-width: 0; }
.mini-player .mp-info > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-player .mp-player { flex: 1; min-width: 0; }
body.has-mini-player main, body.has-mini-player .main { padding-bottom: 96px; }
@media (max-width: 900px) {
  .mini-player { left: 8px; right: 8px; bottom: 8px; flex-wrap: wrap; }
  .mini-player .mp-info { flex-basis: 100%; }
  .rp-vol { display: none; }
}

/* ---------- Bot y respuestas rápidas ---------- */
.bot-tag { color: var(--s-info); }
.msg.out.bot .bubble { background: var(--s-info-bg); color: var(--text); border: 1px dashed color-mix(in srgb, var(--s-info) 35%, transparent); }
.chat-bot-note { margin: 0 12px; padding: 8px 10px; font-size: 12px; color: var(--text-2); background: var(--s-info-bg); border-radius: 8px; }
.chat-compose { position: relative; }
.qr-btn { flex: none; font-size: 16px; padding: 6px 9px; }
.qr-pop { position: absolute; left: 10px; right: 10px; bottom: calc(100% - 4px); max-height: 300px; overflow: auto; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 40, .16); padding: 4px; }
.qr-sec { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px 4px; }
.qr-item { padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.qr-item.sel, .qr-item:hover { background: var(--s-info-bg); }
.qr-empty { padding: 12px; }
.kb-score { font-variant-numeric: tabular-nums; }
.kb-answer { white-space: pre-wrap; }
.bot-test { display: flex; gap: 8px; }
.bot-test input { flex: 1; }
.bot-result { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.sub-tabs { margin: 4px 0 14px; }
.bot-grid { align-items: start; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.range-row { gap: 6px; flex-wrap: wrap; }
.range-row input[type=time] { width: 110px; }
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.day-chip span { display: inline-grid; place-items: center; min-width: 30px; height: 28px; padding: 0 6px; border-radius: 7px; border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface); }
.day-chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-chip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.howto { margin: 0; padding-left: 18px; line-height: 1.55; color: var(--text-2); }
tr.dim td { opacity: .55; }
@media (max-width: 1100px) { .bot-grid { grid-template-columns: 1fr; } }

/* ---------- Panel de respuestas del agente ---------- */
.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.qr-side { width: 300px; flex: none; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.qr-side[hidden] { display: none; }
.qrs-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 6px; }
#qrs-q { margin: 0 12px 6px; width: calc(100% - 24px); font-size: 13px; padding: 6px 9px; }
.qrs-list { flex: 1; overflow: auto; padding: 0 8px 12px; }
.qrs-sec { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 4px 4px; }
.qrs-empty { padding: 2px 4px 6px; line-height: 1.45; }
.qrs-item { border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; margin-bottom: 6px; background: var(--surface); }
.qrs-item:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.qrs-body { font-size: 12.5px; color: var(--text-2); margin: 3px 0 6px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.qrs-actions { gap: 6px; }
.qrs-actions .sm { padding: 3px 9px; font-size: 12px; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
button.link:hover { text-decoration: underline; }
.msg .meta .save-reply { font-size: 11px; opacity: 0; transition: opacity .15s; }
.msg:hover .meta .save-reply, .msg .meta .save-reply:focus-visible { opacity: 1; }
#cv-qrs.active { background: var(--s-info-bg); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
@media (max-width: 1200px) { .qr-side { width: 250px; } }
@media (max-width: 980px) { .chat-body { flex-direction: column; } .qr-side { width: auto; border-left: 0; border-top: 1px solid var(--border); max-height: 280px; } }
.inbox-chat { min-height: 0; overflow: hidden; }
.chat-col { min-height: 0; }
.chat-msgs { min-height: 0; }

/* ---------- Notificaciones ---------- */
.side-actions { gap: 6px; }
.side-actions #notify-btn { flex: none; padding: 6px 10px; }
.notify-set .ns-row { display: flex; align-items: center; gap: 12px; }
.notify-set hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.side-footer .side-actions { display: flex; gap: 6px; margin-top: 10px; }
.side-footer .side-actions button { width: auto; margin: 0; }
.side-footer .side-actions #logout-btn { flex: 1; }
.side-footer .side-actions #notify-btn { flex: none; padding: 6px 11px; }
.secret-key { margin: 6px 0; padding: 8px 10px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; font-size: 15px; letter-spacing: .06em; word-break: break-all; user-select: all; }
.side-footer .side-actions #account-btn { flex: none; padding: 6px 11px; }
.tfa-setup { display: flex; gap: 16px; align-items: center; margin-top: 10px; }
.tfa-qr { flex: none; width: 196px; height: 196px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 12px; image-rendering: pixelated; }
.tfa-setup .howto { margin: 0; }
.tfa-confirm { margin-top: 10px; }
.tfa-confirm input { max-width: 160px; font-size: 18px; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.tfa-manual { margin-top: 10px; }
@media (max-width: 640px) { .tfa-setup { flex-direction: column; align-items: flex-start; } }

/* ===================== Consola del agente ===================== */
kbd { display: inline-block; min-width: 18px; padding: 0 5px; font: 600 10.5px/17px ui-monospace, SFMono-Regular, Menlo, monospace; color: inherit; opacity: .7; border: 1px solid currentColor; border-bottom-width: 2px; border-radius: 5px; margin-left: 4px; vertical-align: 1px; }
button.lg { padding: 10px 16px; font-size: 14.5px; font-weight: 650; }
.ag-head h1 { margin: 0; }
.ag-head #ag-date { text-transform: capitalize; }
.ag-hero { display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin-bottom: 16px; flex-wrap: wrap; position: relative; overflow: hidden; }
.ag-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 6%, transparent), transparent 55%); pointer-events: none; }
.orb { position: relative; width: 56px; height: 56px; flex: none; }
.orb svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.orb-track { fill: none; stroke: var(--border); stroke-width: 5; }
.orb-fill { fill: none; stroke: var(--c); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 1s linear, stroke .3s; }
.orb.over .orb-fill { stroke: var(--s-bad); }
.orb-dot { position: absolute; inset: 17px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 45%, transparent); }
.orb[data-state="disponible"] .orb-dot { animation: breathe 2.4s ease-in-out infinite; }
.orb[data-state="timbrando"] .orb-dot { animation: ringpulse .9s ease-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 40%, transparent); } 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--c) 0%, transparent); } }
@keyframes ringpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.ag-state-label { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.ag-state-timer { text-align: right; }
.timer.big { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ag-queues { display: flex; gap: 8px; flex-wrap: wrap; }
.q-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.q-chip b { color: var(--text); font-size: 15px; }
.q-chip .q-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s-good); }
.q-chip.busy { background: var(--s-warn-bg); border-color: color-mix(in srgb, var(--s-warn) 35%, transparent); }
.q-chip.busy .q-dot { background: var(--s-warn); animation: ringpulse 1.2s ease-out infinite; --c: var(--s-warn); }
.ag-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pause-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { padding: 6px 11px; border-radius: 999px; font-size: 13px; background: var(--surface); }
.chip-btn:hover { background: var(--s-warn-bg); border-color: color-mix(in srgb, var(--s-warn) 40%, transparent); }
.ag-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1150px) { .ag-grid { grid-template-columns: 1fr; } }

/* Escenario */
.stage { padding: 22px; transition: box-shadow .25s, border-color .25s; }
.stage-off, .stage-idle, .stage-pause { text-align: center; padding: 34px 22px; }
.stage h2 { margin: 10px 0 6px; font-size: 18px; }
.stage p { margin: 0 auto 14px; max-width: 440px; }
.stage-icon { font-size: 34px; color: var(--brand); }
.radar { position: relative; width: 84px; height: 84px; margin: 0 auto; display: grid; place-items: center; color: var(--brand); }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); animation: radar 2.7s ease-out infinite; opacity: 0; }
.radar span:nth-child(2) { animation-delay: .9s; }
.radar span:nth-child(3) { animation-delay: 1.8s; }
@keyframes radar { 0% { transform: scale(.35); opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }
.stage-call { border-left: 4px solid var(--brand); }
.stage-call.ringing { border-left-color: var(--s-warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-warn) 25%, transparent), 0 8px 30px rgba(184, 110, 0, .12); animation: stageRing 1.3s ease-in-out infinite; }
@keyframes stageRing { 0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--s-warn) 18%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--s-warn) 8%, transparent); } }
.stage-call.live { border-left-color: var(--s-info); }
.call-top { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: 19px; color: #fff; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #7c3aed)); }
.avatar.pulse { animation: ringpulse 1s ease-out infinite; --c: var(--s-warn); }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.sm.q { background: var(--s-idle); font-size: 11px; }
.call-name { font-size: 21px; font-weight: 750; letter-spacing: -.01em; line-height: 1.2; }
.call-num { color: var(--text-2); font-size: 14px; }
.ring-hint { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--s-warn-bg); color: var(--s-warn); font-weight: 650; }
.ring-hint svg { animation: shake .5s ease-in-out infinite; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.call-timer .timer { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--s-info); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 12px; }
.fact { font-size: 12.5px; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.fact.new { background: var(--s-info-bg); color: var(--s-info); border-color: transparent; }
.fact.warn { background: var(--s-warn-bg); color: var(--s-warn); border-color: transparent; }
.aht-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 4px 0 8px; border: 1px solid var(--border); }
.aht-bar { height: 100%; width: 0; border-radius: 999px; background: var(--s-good); transition: width 1s linear, background .3s; }
.aht-track.warn .aht-bar { background: var(--s-warn); }
.aht-track.over .aht-bar { background: var(--s-bad); }
.call-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.call-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 760px) { .call-body { grid-template-columns: 1fr; } }
.tabs.mini { margin: 0 0 10px; }
.tabs.mini button { font-size: 13px; padding: 6px 10px; }
.call-notes textarea { background: color-mix(in srgb, #fff7d6 60%, var(--surface)); border-color: color-mix(in srgb, var(--s-warn) 25%, var(--border)); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 0 0 12px 0; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--s-idle); flex: none; margin-top: 3px; box-shadow: 0 0 0 3px var(--surface); }
.sent-positivo, .tl-dot.sent-positivo { background: var(--s-good); }
.sent-neutral, .tl-dot.sent-neutral { background: var(--s-idle); }
.sent-negativo, .tl-dot.sent-negativo { background: var(--s-bad); }
.sent-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Tipificación con botones */
.accent-card { border-left: 4px solid var(--accent); animation: slideIn .35s ease-out; }
@keyframes slideIn { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.choice span { display: inline-block; padding: 8px 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; cursor: pointer; transition: all .12s; }
.choice:hover span { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.choice.suggested span { border-style: dashed; border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
.choice input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 35%, transparent); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.ai-thinking { animation: fade 1.6s ease-in-out infinite; }
@keyframes fade { 50% { opacity: .45; } }

/* Mi día */
.goals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-bottom: 14px; }
.goal { position: relative; }
.goal svg { width: 64px; height: 64px; transform: rotate(-90deg); display: block; margin: 0 auto; }
.g-track { fill: none; stroke: var(--surface-2); stroke-width: 4.5; }
.g-fill { fill: none; stroke-width: 4.5; stroke-linecap: round; transition: stroke-dasharray .8s ease-out; }
.g-val { position: absolute; top: 0; left: 0; right: 0; height: 64px; display: grid; place-items: center; font-weight: 750; font-size: 14px; }
.g-label { font-size: 12px; font-weight: 600; margin-top: 4px; }
.g-sub { font-size: 11px; }
.hourly { position: relative; }
.hourly-svg { width: 100%; height: auto; display: block; overflow: visible; }
.hourly-svg .bar { fill: color-mix(in srgb, var(--brand) 70%, var(--surface)); transition: fill .15s; }
.hourly-svg .bar.now { fill: var(--brand); }
.hourly-svg .bar-g.hover .bar { fill: var(--brand-dark); }
.hourly-svg .bar-zero { fill: var(--border); }
.hourly-svg .hit { fill: transparent; }
.hourly-svg .grid { stroke: var(--border); stroke-dasharray: 2 3; stroke-width: .7; }
.hourly-svg .axis { stroke: var(--border); stroke-width: 1; }
.hourly-svg text { font-size: 9px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-tip { position: absolute; top: -6px; width: 140px; text-align: center; padding: 4px 8px; border-radius: 7px; background: var(--text); color: var(--surface); font-size: 12px; pointer-events: none; }
.timebar-wrap { margin-top: 12px; }
.timebar { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.timebar .seg { min-width: 3px; transition: flex .6s; }
.timebar .talk, .legend i.talk { background: var(--brand); }
.timebar .avail, .legend i.avail { background: var(--s-good); }
.timebar .pause, .legend i.pause { background: var(--s-warn); }
.timebar .empty { background: var(--surface-2); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.mini-progress { height: 5px; border-radius: 999px; background: var(--surface-2); margin: 5px 0 3px; overflow: hidden; max-width: 220px; }
.mini-progress span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* Marcador */
.dialer .dial-display { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.dialer .dial-display input { flex: 1; font-size: 20px; letter-spacing: 1.5px; text-align: center; font-variant-numeric: tabular-nums; padding: 9px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.keypad button { padding: 10px 0; font-size: 17px; font-weight: 600; border-radius: 10px; background: var(--surface-2); transition: transform .06s, background .12s; }
.keypad button:hover { background: var(--s-info-bg); }
.keypad button:active { transform: scale(.94); }
.dial-call { width: 100%; justify-content: center; }

/* Mis llamadas de hoy */
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); transition: background .12s; }
.recent li:last-child { border-bottom: 0; }
.recent li:hover { background: var(--surface-2); }
.recent .dir { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; background: var(--s-good-bg); color: var(--s-good); }
.recent .dir.out { background: var(--s-info-bg); color: var(--s-info); }
.recent .dir.missed { background: var(--s-bad-bg); color: var(--s-bad); }
.recent .row-actions { display: flex; gap: 2px; opacity: .35; transition: opacity .12s; }
.recent li:hover .row-actions, .recent .row-actions:focus-within { opacity: 1; }

/* Transferencia */
.tr-list { max-height: 340px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.tr-item { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 9px; background: var(--surface); }
.tr-item:hover { background: var(--s-info-bg); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.keys-table td { padding: 6px 10px 6px 0; }

/* Celebración */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti i { position: absolute; top: -12px; left: var(--x); width: 8px; height: 12px; background: var(--c); border-radius: 2px; animation: fall var(--d) cubic-bezier(.2, .6, .4, 1) forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(var(--r)); opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  .orb-dot, .radar span, .stage-call.ringing, .avatar.pulse, .ring-hint svg, .q-chip .q-dot, .ai-thinking, .accent-card { animation: none !important; }
  .orb-fill, .aht-bar, .g-fill { transition: none; }
}
.keypad button { display: grid; place-items: center; text-align: center; }
.orb-fill[stroke-dasharray^="0 "] { opacity: 0; }

/* ================= Tickets ================= */
.modal.xwide { max-width: 1180px; width: calc(100vw - 32px); }
.tk-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-right: 8px; }
.tk-seg button { border: 0; border-radius: 0; background: var(--surface); padding: 7px 12px; }
.tk-seg button.active { background: var(--brand); color: #fff; }
.tk-kpis { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tk-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 14px; min-width: 112px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; transition: transform .12s, border-color .12s; }
.tk-kpi { cursor: default; font: inherit; color: inherit; }
.tk-kpi.click { cursor: pointer; }
.tk-kpi.click:hover { transform: translateY(-1px); border-color: var(--brand); }
.tk-kpi b { font-size: 20px; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.tk-kpi span { font-size: 12px; color: var(--text-2); }
.tk-kpi.k-bad b { color: var(--s-bad); } .tk-kpi.k-warn b { color: var(--s-warn); } .tk-kpi.k-good b { color: var(--s-good); }
.tk-kpi.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.tk-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.tk-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; min-height: 320px; max-height: calc(100vh - 290px); transition: background .15s, border-color .15s; }
.tk-col header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); }
.tk-count { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--text-2); }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; }
.tk-dot.s-abierto { background: var(--s-info); } .tk-dot.s-en_proceso { background: var(--s-warn); } .tk-dot.s-resuelto { background: var(--s-good); } .tk-dot.s-cerrado { background: var(--s-idle); }
.tk-drop { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tk-board.dragging .tk-col { border-style: dashed; }
.tk-col.over { background: color-mix(in srgb, var(--brand) 8%, var(--surface-2)); border-color: var(--brand); }
.tk-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; border: 1px dashed var(--border); border-radius: 10px; }
.tk-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--s-idle); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; display: flex; flex-direction: column; gap: 6px; }
.tk-card:hover, .tk-card:focus { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16,24,40,.12); outline: none; }
.tk-card.dragging { opacity: .45; }
.tk-card.pri-urgente { border-left-color: var(--s-bad); } .tk-card.pri-alta { border-left-color: var(--s-warn); } .tk-card.pri-media { border-left-color: var(--s-info); }
.tk-card.late { background: linear-gradient(0deg, var(--s-bad-bg), var(--surface) 60%); }
.tk-card-top, .tk-card-foot, .tk-meta { display: flex; align-items: center; gap: 6px; }
.tk-card-top .spacer, .tk-card-foot .spacer { flex: 1; }
.tk-id { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.tk-cat { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--s-idle-bg); color: var(--text-2); }
.tk-subj { font-weight: 600; font-size: 14px; line-height: 1.3; }
.tk-meta { flex-wrap: wrap; font-size: 12px; color: var(--text-2); gap: 10px; }
.tk-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--brand); color: #fff; }
.tk-av.empty { background: var(--s-idle-bg); color: var(--muted); }
.sla-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--s-good-bg); color: var(--s-good); }
.sla-chip.pronto { background: var(--s-warn-bg); color: var(--s-warn); }
.sla-chip.vencido { background: var(--s-bad-bg); color: var(--s-bad); animation: tk-blink 2s ease-in-out infinite; }
@keyframes tk-blink { 50% { opacity: .65; } }
/* Alta inteligente */
.tk-new > form, .tk-detail > .card-body { padding: 16px 18px; }
.tk-new { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); }
.tk-side { border-left: 1px solid var(--border); background: var(--surface-2); padding: 16px; overflow-y: auto; max-height: 72vh; display: flex; flex-direction: column; gap: 10px; transition: opacity .2s; }
.tk-side.loading { opacity: .6; }
.tk-side-empty { color: var(--text-2); text-align: center; padding: 30px 10px; line-height: 1.5; }
.tk-side-h { font-weight: 700; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.tk-side-h.warn { color: var(--s-warn); text-transform: none; letter-spacing: 0; font-size: 14px; }
.tk-why { font-size: 12.5px; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); color: var(--text); border-radius: 8px; padding: 8px 10px; }
.tk-sim { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.tk-sim.dup { border-color: var(--s-warn); background: var(--s-warn-bg); }
.tk-sim .row .spacer { flex: 1; }
.tk-sim.compact .tk-subj { font-size: 13px; }
.tk-score { font-size: 12px; font-weight: 700; color: var(--brand); }
.tk-resol { font-size: 12.5px; color: var(--text); background: var(--s-good-bg); border-radius: 6px; padding: 6px 8px; }
.tk-ai { font-size: 11px; font-weight: 600; color: var(--brand); margin-left: 4px; }
.tk-ai.pulse { animation: tk-pulse .9s ease-out; }
@keyframes tk-pulse { 0% { opacity: 0; transform: translateY(3px); } 100% { opacity: 1; transform: none; } }
.tk-template { font-size: 13px; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-radius: 8px; padding: 6px 10px; }
.tk-peek { position: fixed; right: 20px; bottom: 20px; width: 420px; max-height: 60vh; overflow: auto; z-index: 1200; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
/* Detalle */
.tk-detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); }
.tk-tl-col { border-left: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; max-height: 78vh; }
.tk-tl-col h3 { margin: 0 0 10px; }
.tk-tl-col .tk-timeline { flex: 1; overflow-y: auto; }
.tk-head-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tk-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 10px; }
.tk-step { border-radius: 0; border: 1px solid var(--border); margin-left: -1px; background: var(--surface); font-size: 13px; padding: 8px 4px; }
.tk-step:first-child { border-radius: 8px 0 0 8px; margin-left: 0; } .tk-step:last-child { border-radius: 0 8px 8px 0; }
.tk-step.done { background: var(--s-good-bg); color: var(--s-good); }
.tk-step.cur { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.tk-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tk-callsum { font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.tk-similar-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tk-timeline { display: flex; flex-direction: column; gap: 10px; }
.tk-ev { display: grid; grid-template-columns: 26px 1fr; gap: 8px; font-size: 13px; }
.tk-ev-i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); font-size: 13px; }
.tk-ev .h { font-size: 12px; color: var(--muted); }
.tk-ev.sys .pre { color: var(--text-2); }
.tk-ev.warn .pre { color: var(--s-bad); font-weight: 600; }
.tk-ev.sol .pre { background: var(--s-good-bg); border-radius: 6px; padding: 4px 8px; }
.tk-comment-box { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.tk-rule { display: grid; grid-template-columns: 1fr 1fr 32px; gap: 10px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.tk-rule [data-pool] { grid-column: 1 / 3; }
.row.wrap { flex-wrap: wrap; }
@media (max-width: 900px) {
  .tk-new, .tk-detail { grid-template-columns: 1fr; }
  .tk-side, .tk-tl-col { border-left: 0; border-top: 1px solid var(--border); max-height: none; }
  .tk-board { grid-template-columns: repeat(4, 260px); }
}
/* Página pública de resolución */
.rv-body { background: var(--bg); }
.rv-wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 14px; }
.rv-head { display: flex; align-items: center; gap: 12px; }
.rv-head img { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #fff; }
.rv-brand { font-weight: 800; font-size: 18px; }
.rv-subj { font-size: 22px; margin: 0; }
.rv-note { background: var(--s-warn-bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.rv-desc { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.rv-cust { font-size: 14px; }
.rv-done { text-align: center; padding: 48px 20px !important; }
.rv-big { font-size: 46px; }
.rv-ok { background: var(--s-good-bg); color: var(--s-good); border-radius: 8px; padding: 8px 12px; }
.tk-hand { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: color-mix(in srgb, var(--brand) 5%, var(--surface)); font-size: 13px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.tk-hand .row .spacer { flex: 1; }
.tk-hand-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); font-weight: 600; }
.tk-hand-badge.replied { background: var(--s-good-bg); color: var(--s-good); }
.ho-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ho-pick label { border: 1px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.ho-pick label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.ho-link { display: flex; gap: 8px; } .ho-link input { flex: 1; font-family: ui-monospace, monospace; font-size: 12px; }
.tk-res-row { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr 32px; gap: 10px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }

/* Ventanas: aviso cuando se intenta cerrar con algo capturado */
.modal.nudge { animation: modal-nudge .35s ease; }
@keyframes modal-nudge { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
/* Borradores de tickets */
#tk-drafts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 55; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tk-draft { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--brand); border-radius: 999px; box-shadow: 0 6px 22px rgba(16,24,40,.18); overflow: hidden; animation: tk-pulse .4s ease-out; }
.tk-draft-open { border: 0; background: transparent; padding: 7px 10px 7px 14px; display: flex; gap: 8px; align-items: center; font-size: 13px; max-width: 460px; cursor: pointer; color: var(--text); }
.tk-draft-open b { color: var(--brand); white-space: nowrap; }
.tk-draft-open span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-draft-open:hover { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.tk-draft-x { border: 0; border-left: 1px solid var(--border); background: transparent; padding: 0 12px; color: var(--muted); cursor: pointer; border-radius: 0; }
.tk-draft-x:hover { color: var(--s-bad); }
.tk-draft-more { font-size: 12px; color: var(--text-2); background: var(--surface); border-radius: 999px; padding: 2px 10px; border: 1px solid var(--border); }
.tk-draft-banner { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); padding: 8px 18px; font-size: 13px; border-bottom: 1px solid var(--border); }
.tk-saved { margin-right: 8px; }

.tts-player audio { width: 100%; }

/* ================= Teléfono en el navegador ================= */
#sfx-phone { position: fixed; left: 236px; bottom: 16px; z-index: 60; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 8px; }
.ph-pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 7px 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(16,24,40,.16); font-size: 13px; }
#sfx-phone.ringing .ph-pill { background: var(--s-good); color: #fff; border-color: var(--s-good); animation: ph-ring 1s ease-in-out infinite; }
@keyframes ph-ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } 60% { transform: rotate(-2deg); } }
.ph-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--s-idle); display: inline-block; flex: none; }
.ph-dot.ok { background: var(--s-good); } .ph-dot.warn { background: var(--s-warn); } .ph-dot.bad { background: var(--s-bad); } .ph-dot.call { background: var(--s-info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-info) 25%, transparent); }
.ph-panel { width: 290px; box-shadow: 0 16px 44px rgba(16,24,40,.25); overflow: hidden; }
.ph-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ph-head .spacer { flex: 1; }
.ph-input { display: flex; gap: 6px; margin-bottom: 8px; } .ph-input input { flex: 1; font-size: 18px; text-align: center; letter-spacing: .04em; }
.ph-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph-keys button { font-size: 18px; padding: 10px 0; border-radius: 10px; }
.ph-call { width: 100%; margin-top: 10px; padding: 11px; font-size: 15px; border-radius: 10px; }
.ph-call-card { padding: 18px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ph-call-card.in { background: linear-gradient(180deg, var(--s-good-bg), var(--surface)); }
.ph-avatar { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; font-size: 20px; }
.ph-who { display: flex; flex-direction: column; } .ph-who b { font-size: 17px; }
.ph-state { color: var(--text-2); font-variant-numeric: tabular-nums; }
.ph-actions { display: flex; gap: 14px; margin-top: 6px; }
.ph-round { width: 52px; height: 52px; border-radius: 50%; font-size: 20px; padding: 0; display: grid; place-items: center; }
.ph-round.on { background: var(--s-warn-bg); }
.ph-dtmf { width: 100%; margin-top: 8px; }
@media (max-width: 900px) { #sfx-phone { left: 12px; bottom: 12px; } .ph-panel { width: calc(100vw - 24px); max-width: 340px; } }
/* Directorio y buzón */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.dir-card { display: flex; align-items: center; gap: 12px; padding: 12px; }
.dir-av { position: relative; width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.dir-av .ph-dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--surface); width: 12px; height: 12px; }
.dir-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dir-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vm-item.new { border-left: 4px solid var(--s-warn); }
.vm-item audio { width: 100%; margin: 8px 0; }
.vm-tr { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
/* Conmutador (administración) */
.sw-sub { flex-wrap: wrap; }
.sw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.sw-opts { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sw-opts kbd, .sw-opt select[data-f=digit] { font-weight: 700; }
kbd { display: inline-block; min-width: 22px; text-align: center; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px; background: var(--surface-2); font-family: inherit; }
.sw-opt { display: grid; grid-template-columns: 70px 1fr 1.4fr 32px; gap: 8px; align-items: center; }

/* ---------- Equipo: chat interno y enjambre ---------- */
.eq-layout { display: grid; grid-template-columns: 300px 1fr; gap: 14px; height: calc(100vh - 150px); min-height: 420px; }
.eq-side { overflow: auto; padding-bottom: 10px; }
.eq-sec { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); padding: 12px 12px 4px; }
.eq-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; border-radius: 0; background: none; padding: 8px 12px; font-weight: 400; }
.eq-item:hover, .eq-item.active { background: var(--surface-2); }
.eq-item > .ellipsis { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.eq-help { margin: 4px 8px; padding: 8px 10px; border: 1px solid var(--s-warn, #d97706); border-radius: 8px; background: color-mix(in srgb, var(--s-warn, #d97706) 8%, transparent); }
.eq-chat { display: flex; flex-direction: column; min-height: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-list { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.tm-msg { max-width: 78%; align-self: flex-start; }
.tm-msg.me { align-self: flex-end; }
.tm-msg .tm-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 7px 11px; font-size: 13.5px; white-space: normal; word-break: break-word; }
.tm-msg.me .tm-body { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.tm-meta { font-size: 11px; color: var(--text-2); margin: 0 4px 2px; }
.tm-msg.me .tm-meta { text-align: right; }
.tm-sys { align-self: center; max-width: 92%; font-size: 12.5px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px; }
.tm-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.tm-compose textarea { flex: 1; resize: none; min-height: 38px; max-height: 140px; }
.tm-case { gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tm-case .ellipsis { max-width: 320px; }
.tm-ctx { max-height: 260px; overflow: auto; font-size: 13px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.team-dock { position: fixed; right: 18px; bottom: 18px; width: 360px; height: 460px; z-index: 900; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.team-dock .card-head { gap: 6px; }
.team-dock .tm-list { padding: 10px; }
.team-help-pop { position: fixed; right: 18px; top: 18px; width: 340px; z-index: 950; border: 2px solid var(--s-warn, #d97706); box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.hp-people { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.hp-person { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.hp-person:hover { background: var(--surface-2); }
.hp-person .small { margin-left: auto; text-align: right; }
.ph-dot.warn { background: var(--s-warn, #d97706); }
@media (max-width: 860px) { .eq-layout { grid-template-columns: 1fr; height: auto; } .eq-chat { min-height: 480px; } .team-dock { left: 8px; right: 8px; width: auto; } }
.ch-messenger { background: #0866ff; }
.sala-file { display: flex; flex-direction: column; gap: 2px; width: 120px; text-decoration: none; color: inherit; font-size: 26px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.sala-file img { width: 106px; height: 80px; object-fit: cover; border-radius: 6px; }
.sala-file .ellipsis { max-width: 106px; }

/* Videollamada flotante (panel y sala del cliente) */
.sfx-video { position: fixed; right: 16px; bottom: 16px; width: min(480px, calc(100vw - 32px)); background: #0f1420; color: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); z-index: 9999; overflow: hidden; display: flex; flex-direction: column; }
.sfx-video .sv-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; }
.sfx-video .sv-state { opacity: .7; font-size: 12px; }
.sfx-video .sv-min { background: transparent; color: #fff; border: 0; padding: 2px 8px; }
.sfx-video .sv-stage { position: relative; background: #000; aspect-ratio: 16 / 10; }
.sfx-video .sv-remote { width: 100%; height: 100%; object-fit: contain; background: #000; }
.sfx-video .sv-local { position: absolute; right: 8px; bottom: 8px; width: 28%; border-radius: 8px; border: 2px solid rgba(255,255,255,.6); background: #222; }
.sfx-video .sv-note { position: absolute; left: 8px; top: 8px; right: 8px; font-size: 12px; background: rgba(0,0,0,.55); padding: 4px 8px; border-radius: 6px; }
.sfx-video .sv-note[hidden], .sfx-video .sv-note:empty { display: none; }
.sfx-video .sv-bar { display: flex; gap: 6px; padding: 8px; justify-content: center; flex-wrap: wrap; }
.sfx-video .sv-bar button { background: #1f2a3d; color: #fff; border-color: #2c3a55; }
.sfx-video .sv-bar button.off { background: #6b2a2a; }
.sfx-video .sv-bar button.on { background: #1a6b3f; }
.sfx-video .sv-bar button.danger { background: #c0392b; border-color: #c0392b; }
.sfx-video.min .sv-stage, .sfx-video.min .sv-bar { display: none; }
.sv-invite { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 9998; max-width: calc(100vw - 32px); }

/* ---------- Centro de seguridad ---------- */
.sec-top { margin-bottom: 12px; }
.sec-score { display: flex; align-items: center; gap: 14px; }
.sec-ring { --c: var(--s-good); width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line, #e6e8eb) 0); }
.sec-ring span { width: 60px; height: 60px; border-radius: 50%; background: var(--card, #fff); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.sec-warn .sec-ring { --c: var(--s-warn); }
.sec-bad .sec-ring { --c: var(--s-bad); }
.sec-word { font-size: 18px; font-weight: 700; }
.sec-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; align-items: start; }
@media (max-width: 1000px) { .sec-cols { grid-template-columns: 1fr; } }
.sec-group h3 { margin: 4px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); }
.sec-group + .sec-group { margin-top: 14px; }
.sec-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line, #e6e8eb); }
.sec-ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--s-idle-bg); color: var(--s-idle); }
.sec-ok .sec-ic { background: var(--s-good-bg); color: var(--s-good); }
.sec-warn .sec-ic { background: var(--s-warn-bg); color: var(--s-warn); }
.sec-bad .sec-ic { background: var(--s-bad-bg); color: var(--s-bad); }
.sec-fix { margin-top: 2px; color: var(--text, #1f2937); }
.sec-item .badge { flex: none; }
.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; }
.stack > hr, .card-body > hr { align-self: stretch; border: 0; border-top: 1px solid var(--border); margin: 6px 0; width: 100%; }

.ch-email { background: #6b4fbb; }
.ch-instagram { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.att-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.att { font-size: 12px; text-decoration: none; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,.05); color: inherit; }
.msg.in .bubble { white-space: pre-wrap; }
.chat-head { flex-wrap: wrap; }
.chat-who { flex: 1 1 240px; min-width: 200px; }

/* ---------- Agenda ---------- */
.ag-cols { display: grid; gap: 12px; align-items: start; }
@media (max-width: 900px) { .ag-cols { grid-template-columns: 1fr !important; } }
.ag-appt { border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 8px; padding: 8px 10px; cursor: pointer; background: var(--card, #fff); }
.ag-appt:hover { box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.ag-confirmada { border-left-color: var(--s-good); }
.ag-cancelada, .ag-no_asistio { opacity: .6; border-left-color: var(--s-bad); }
.ag-asistio { border-left-color: var(--s-good); opacity: .8; }
.ag-free { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- Copiloto ---------- */
.copilot { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: linear-gradient(180deg, rgba(42,120,214,.06), transparent); }
.cp-head { font-weight: 700; margin-bottom: 6px; }
.cp-tips { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.cp-tip { border-left: 3px solid var(--brand); background: var(--card, #fff); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.cp-alerta { border-left-color: var(--s-bad); }
.cp-objecion { border-left-color: var(--s-warn); }
.cp-ia { border-left-color: #8b5cf6; }
.cp-lines { max-height: 140px; overflow: auto; margin-top: 4px; color: var(--muted, #6b7280); }

/* ---------- Primeros pasos ---------- */
.fs-card { margin-bottom: 12px; border-left: 4px solid var(--brand); }
.fs-bar { height: 6px; background: var(--border); border-radius: 3px; margin: 8px 0 10px; overflow: hidden; }
.fs-bar div { height: 100%; background: var(--brand); }
.fs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 14px; }
.fs-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.fs-item > span:nth-child(2) { flex: 1; }
.fs-item.done { color: var(--muted, #6b7280); }
.fs-ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--s-idle-bg); flex: none; }
.fs-item.done .fs-ic { background: var(--s-good-bg); color: var(--s-good); }

/* ---------- Turnos ---------- */
.tn-grid td.tn-cell { cursor: pointer; text-align: center; white-space: nowrap; }
.tn-grid td.tn-cell:hover { background: var(--s-info-bg); }
.tn-turno { background: rgba(42,120,214,.07); }
.tn-descanso, .tn-vacaciones, .tn-incapacidad { color: var(--muted, #6b7280); font-size: 12px; }
.tn-cov td { background: var(--surface-2, #f7f8fa); text-align: center; }

.ch-mercadolibre { background: #ffe600; color: #2d3277; }
.ext-info { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.ext-card { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--card, #fff); font-size: 13px; }

/* ---------- Diseñador de flujos de voz ---------- */
body.fl-open { overflow: hidden; }
.fl-root { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.fl-top { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
.fl-top button { padding: 6px 10px; }
.fl-top .tk-seg { margin-right: 0; flex: none; }
.fl-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fl-name > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
#fl-saved { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.fl-main { flex: 1; display: grid; grid-template-columns: 190px 1fr 360px; min-height: 0; }
.fl-root.mode-test .fl-main, .fl-root.mode-stats .fl-main { grid-template-columns: 1fr 380px; }
.fl-palette { border-right: 1px solid var(--border); background: var(--surface); padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.fl-palette.hidden { display: none; }
.fl-pal { text-align: left; background: var(--surface-2); border: 1px solid var(--border); padding: 6px 8px; font-size: 13px; }
.fl-pal:hover { border-color: var(--brand); }
.fl-note { background: var(--s-warn-bg); color: var(--s-warn); padding: 6px 8px; border-radius: 6px; }
.fl-canvas { position: relative; overflow: hidden; cursor: grab; background-color: #eef1f5; background-image: radial-gradient(#cfd5de 1px, transparent 1px); background-size: 20px 20px; outline: none; }
.fl-canvas.panning { cursor: grabbing; }
.fl-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fl-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.fl-edge { fill: none; stroke: #8a94a6; marker-end: url(#fl-arrow); }
.fl-edge.sel { stroke: var(--brand); }
.fl-edge.walked { stroke: var(--s-good); stroke-width: 3.5; }
.fl-edge.temp { stroke: var(--brand); stroke-dasharray: 6 4; stroke-width: 2; }
.fl-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.fl-elabel { font-size: 12px; font-weight: 700; fill: var(--text-2); paint-order: stroke; stroke: #eef1f5; stroke-width: 4px; }
.fl-node { position: absolute; width: 230px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); cursor: pointer; user-select: none; font-size: 12.5px; }
.fl-node:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.fl-node.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 111, 229, 0.18), var(--shadow); }
.fl-node.err { border-color: var(--s-bad); }
.fl-node.warn { border-color: #e8b04b; }
.fl-node.visited { border-color: var(--s-good); }
.fl-node.live { border-color: var(--s-good); box-shadow: 0 0 0 4px rgba(26, 138, 74, 0.25), var(--shadow); }
.fl-nh { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; font-weight: 650; cursor: move; }
.fl-nt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-nb { padding: 0 10px 8px; color: var(--text-2); line-height: 1.35; word-break: break-word; }
.fl-tag { display: inline-block; margin-top: 4px; margin-right: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 11px; }
.fl-outs { border-top: 1px solid var(--border); }
.fl-out { position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 18px 4px 10px; font-size: 12px; color: var(--text-2); }
.fl-out + .fl-out { border-top: 1px dashed var(--border); }
.fl-out.soft { color: var(--muted); }
.fl-out em { margin-left: auto; font-style: normal; font-weight: 700; color: var(--text); }
.fl-port { position: absolute; right: -8px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid #8a94a6; cursor: crosshair; }
.fl-out.on .fl-port { background: var(--brand); border-color: var(--brand); }
.fl-port:hover { transform: scale(1.25); border-color: var(--brand); }
.fl-in { position: absolute; left: -6px; top: 14px; width: 10px; height: 12px; border-radius: 3px; background: #8a94a6; }
.fl-end { border-top: 1px solid var(--border); padding: 4px 10px; font-size: 11px; color: var(--muted); }
.fl-startb { position: absolute; top: -11px; left: 10px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.t-mensaje .fl-nh, .t-colgar .fl-nh { color: #2b4a7a; }
.t-menu, .t-voz { border-top: 4px solid #1f6fe5; }
.t-condicion, .t-cliente { border-top: 4px solid #7a5af5; }
.t-consulta, .t-whatsapp, .t-variable, .t-capturar { border-top: 4px solid #0f9b8e; }
.t-transferir, .t-rellamada, .t-colgar { border-top: 4px solid #d9822b; }
.t-mensaje { border-top: 4px solid #8a94a6; }
.fl-stat { position: absolute; top: -26px; right: 0; background: var(--text); color: #fff; font-size: 11px; font-weight: 650; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.fl-stat.hot { background: var(--s-bad); }
.fl-stat.none { background: #c3c8d1; }
.fl-tools { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 4px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px; box-shadow: var(--shadow); }
.fl-tools button { padding: 4px 9px; font-size: 13px; }
.fl-tools span { min-width: 44px; text-align: center; font-size: 12px; }
.fl-issues { position: absolute; right: 12px; bottom: 12px; max-width: 440px; }
.fl-issues summary { cursor: pointer; }
.fl-issues > div, .fl-issues details { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; box-shadow: var(--shadow); font-size: 13px; }
.fl-issues ul { margin: 6px 0 0; padding-left: 18px; max-height: 220px; overflow: auto; }
.fl-ok { color: var(--s-good); font-weight: 650; }
.fl-red { color: var(--s-bad); }
.fl-side { border-left: 1px solid var(--border); background: var(--surface); padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.fl-side hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.fl-ph { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.fl-ph input { flex: 1; font-weight: 650; font-size: 15px; }
.fl-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fl-chips .chip { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--s-info-bg); color: var(--s-info); border: 0; }
.fl-rows { gap: 6px; }
.fl-row { display: flex; gap: 6px; align-items: center; }
.fl-row input { flex: 1; min-width: 0; }
.fl-row select { width: 58px; }
.fl-conn { display: grid; grid-template-columns: 1fr 1.3fr; gap: 6px; align-items: center; font-size: 13px; }
.fl-conn.focus span { color: var(--brand); font-weight: 650; }
.fl-help ul { padding-left: 18px; line-height: 1.5; }
.fl-quick { position: absolute; z-index: 5; width: 220px; display: flex; flex-direction: column; padding: 4px; max-height: 380px; overflow: auto; }
.fl-quick button { text-align: left; font-size: 13px; }
.fl-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 6px; }
.fl-tpl { display: flex; flex-direction: column; gap: 3px; border: 1.5px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer; }
.fl-tpl:has(input:checked) { border-color: var(--brand); background: var(--s-info-bg); }
.fl-tpl input { position: absolute; opacity: 0; }
.fl-tpl:focus-within { outline: 2px solid var(--brand); }
.fl-sim { display: flex; flex-direction: column; gap: 10px; }
.fl-chat { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow-y: auto; padding: 4px; background: var(--surface-2); border-radius: 8px; min-height: 120px; }
.fl-say { background: var(--surface); border: 1px solid var(--border); border-radius: 10px 10px 10px 2px; padding: 6px 10px; align-self: flex-start; max-width: 92%; }
.fl-you { background: var(--brand); color: #fff; border-radius: 10px 10px 2px 10px; padding: 6px 10px; align-self: flex-end; max-width: 85%; }
.fl-info { font-size: 12px; color: var(--s-info); background: var(--s-info-bg); border-radius: 6px; padding: 4px 8px; }
.fl-endcard { border-radius: 8px; padding: 8px 10px; background: var(--s-good-bg); color: var(--s-good); }
.fl-endcard.colgo, .fl-endcard.error { background: var(--s-bad-bg); color: var(--s-bad); }
.fl-endcard.respaldo { background: var(--s-warn-bg); color: var(--s-warn); }
.fl-keys { display: flex; flex-direction: column; gap: 8px; }
.fl-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 240px; align-self: center; width: 100%; }
.fl-pad button { font-size: 18px; padding: 10px 0; border-radius: 10px; }
.fl-vars { width: 100%; font-size: 12px; }
.fl-vars td { padding: 2px 4px; border-bottom: 1px solid var(--border); word-break: break-all; }
.fl-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fl-kpis div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.fl-kpis b { font-size: 20px; }
.fl-kpis span { font-size: 12px; color: var(--text-2); }
.fl-bar { display: grid; grid-template-columns: 1fr 90px 44px; gap: 6px; align-items: center; margin-top: 4px; }
.fl-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-bar i { display: block; height: 8px; background: var(--brand); border-radius: 4px; }
.fl-bar b { text-align: right; }
.fl-calls { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.fl-callrow { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 6px; align-items: center; text-align: left; font-size: 12px; background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 5px 2px; }
.fl-callrow:hover { background: var(--surface-2); }
.ivr-pop { margin: 0 0 10px; background: var(--surface-2); }
.ivr-pop ol { margin: 4px 0 0; padding-left: 18px; }
@media (max-width: 1000px) {
  .fl-main, .fl-root.mode-test .fl-main, .fl-root.mode-stats .fl-main { grid-template-columns: 1fr; grid-template-rows: 1fr 45vh; }
  .fl-palette { display: none; }
}
.fl-side .toggle { flex-wrap: nowrap; align-items: flex-start; }
.fl-side .toggle input { margin-top: 2px; flex: none; }
.fl-palette hr { border: 0; border-top: 1px solid var(--border); width: 100%; margin: 8px 0; }
