/* Sistema de diseño de los paneles del Contact Center: acceso, agente y supervisor.
   Todo sale de las variables de :root; el tema oscuro solo cambia las variables. */

:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --brand-primary: #087f8c;
  --brand-dark: #112b3c;
  --brand-accent: #74d5de;
  --brand-primary-text: #ffffff;
  --brand-dark-text: #ffffff;

  --bg: #f2f5f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #edf2f4;
  --border: #dfe7ec;
  --border-strong: #c7d3dc;
  --text: #112b3c;
  --text-2: #364f5e;
  --muted: #607582;

  --accent: var(--brand-primary);
  --accent-hover: color-mix(in srgb, var(--brand-primary) 86%, #000);
  --accent-soft: color-mix(in srgb, var(--brand-primary) 9%, var(--surface));
  --accent-text: #086571;

  --green: #148047;  --green-soft: #e6f5ec;  --green-text: #106d3c;
  --amber: #ef9410;  --amber-soft: #fff4de;  --amber-text: #9c5508;
  --red: #ca343b;    --red-soft: #fdecec;    --red-text: #ad242c;
  --teal: #087f8c;   --teal-soft: #e6f3f4;   --teal-text: #086571;
  --violet: #7553e6; --violet-soft: #f1edfd; --violet-text: #5a39c2;
  --grey: #7a8e9c;   --grey-soft: #edf2f4;   --grey-text: #526876;

  --sidebar: var(--brand-dark);
  --sidebar-2: color-mix(in srgb, var(--brand-dark) 92%, var(--brand-dark-text));
  --sidebar-line: color-mix(in srgb, var(--brand-dark-text) 14%, transparent);
  --sidebar-text: color-mix(in srgb, var(--brand-dark-text) 76%, var(--brand-dark));
  --sidebar-strong: var(--brand-dark-text);

  --radius-s: 6px;
  --radius: 9px;
  --radius-l: 14px;
  --shadow-s: 0 1px 2px rgba(15, 23, 41, 0.05);
  --shadow: 0 2px 6px rgba(17, 43, 60, 0.04), 0 1px 2px rgba(17, 43, 60, 0.02);
  --shadow-l: 0 24px 60px -16px rgba(15, 23, 41, 0.35);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 25%, transparent);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b151e;
  --surface: #12222e;
  --surface-2: #172a37;
  --surface-3: #203543;
  --border: #2a3d4a;
  --border-strong: #3f5665;
  --text: #e9f0f4;
  --text-2: #c3d1da;
  --muted: #96abb8;

  --accent: var(--brand-primary);
  --accent-hover: color-mix(in srgb, var(--brand-primary) 86%, #000);
  --accent-soft: color-mix(in srgb, var(--brand-primary) 18%, var(--surface));
  --accent-text: #79d5dd;

  --green: #148047;  --green-soft: rgba(45, 189, 110, 0.14);  --green-text: #76dba3;
  --amber: #f4a62a;  --amber-soft: rgba(244, 166, 42, 0.14);  --amber-text: #f6bf62;
  --red: #ca343b;    --red-soft: rgba(240, 87, 92, 0.14);    --red-text: #ff9ba0;
  --teal: #28b5c0;   --teal-soft: rgba(71, 193, 201, 0.12);   --teal-text: #79d5dd;
  --violet: #9479ff; --violet-soft: rgba(148, 121, 255, 0.16); --violet-text: #b9a8ff;
  --grey: #6c7890;   --grey-soft: rgba(138, 148, 168, 0.13);  --grey-text: #aab3c5;

  --sidebar: var(--brand-dark);
  --sidebar-2: color-mix(in srgb, var(--brand-dark) 92%, var(--brand-dark-text));

  --shadow-s: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-l: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 35%, transparent);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.25; }
h2 { font-size: 14.5px; font-weight: 650; }
h3 {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 10px;
}
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100; padding: 10px 16px;
  border-radius: var(--radius); background: var(--surface); color: var(--accent-text);
  box-shadow: var(--shadow-l); font-weight: 600; transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.num { font-variant-numeric: tabular-nums; }

.i {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Tonos: cada estado, fase y resultado tiene su color (--tone), un fondo suave y un texto. */
.chip {
  --tone: var(--grey); --tone-soft: var(--grey-soft); --tone-text: var(--grey-text);
}
.chip.sonando, .st-sonando, .chip.marcando, .st-marcando, .chip.entrante, .tone-accent {
  --tone: var(--accent); --tone-soft: var(--accent-soft); --tone-text: var(--accent-text);
}
.chip.disponible, .chip.atendida, .chip.ok, .st-disponible, .tone-green {
  --tone: var(--green); --tone-soft: var(--green-soft); --tone-text: var(--green-text);
}
.chip.pausa, .chip.cola, .chip.desbordada, .chip.warn, .st-pausa, .tone-amber {
  --tone: var(--amber); --tone-soft: var(--amber-soft); --tone-text: var(--amber-text);
}
.chip.abandonada, .chip.no_atendida, .chip.error, .chip.bad, .chip.desborde, .tone-red {
  --tone: var(--red); --tone-soft: var(--red-soft); --tone-text: var(--red-text);
}
.chip.en_llamada, .chip.hablando, .st-en_llamada, .tone-teal {
  --tone: var(--teal); --tone-soft: var(--teal-soft); --tone-text: var(--teal-text);
}
.chip.tras_llamada, .st-tras_llamada, .chip.servicio, .chip.ia, .chip.saliente, .tone-violet {
  --tone: var(--violet); --tone-soft: var(--violet-soft); --tone-text: var(--violet-text);
}
.chip.fuera_de_horario, .chip.solo_mensaje {
  --tone: var(--grey); --tone-soft: var(--grey-soft); --tone-text: var(--grey-text);
}

/* ---------- Estructura: barra lateral (supervisor) y barra superior ---------- */

.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 32px;
  padding: 20px 14px 16px; background: var(--sidebar); color: var(--sidebar-text);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 0 6px; }
.brand-mark {
  min-width: 36px; max-width: 104px; height: 36px; display: grid; place-items: center; flex: none;
  color: var(--brand-primary-text);
}
.brand-mark img { display: block; width: auto; max-width: 104px; height: 36px; object-fit: contain; }
.brand-mark img[hidden] { display: none; }
.brand-mark img:not([hidden]) + .brand-fallback { display: none; }
.brand-mark:has(img[hidden]) { width: 36px; border-radius: 10px; background: var(--brand-primary); }
.brand-mark .i { width: 19px; height: 19px; }
.brand-name {
  display: grid; min-width: 0; overflow-wrap: anywhere; color: var(--sidebar-strong); font-weight: 700; font-size: 15px;
  letter-spacing: -0.01em; line-height: 1.2;
}
.brand-name small { font-size: 11.5px; font-weight: 500; letter-spacing: 0; color: var(--sidebar-text); }

.nav { display: grid; gap: 4px; }
.nav-label {
  padding: 14px 12px 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--sidebar-text);
}
.nav-label:first-child { padding-top: 0; }
.nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 42px; padding: 10px 12px; border: none;
  border-radius: 8px; background: none; color: var(--sidebar-text); font: 500 13.5px var(--font);
  cursor: pointer; text-align: left; transition: background 0.15s, color 0.15s;
}
.nav button .i { width: 18px; height: 18px; }
.nav button:hover { background: rgba(255, 255, 255, 0.05); color: var(--sidebar-strong); }
.nav button.active {
  background: color-mix(in srgb, var(--brand-accent) 15%, transparent); color: var(--sidebar-strong); box-shadow: inset 3px 0 0 var(--brand-accent);
}
.nav button.active .i { color: var(--brand-accent); }
.nav button:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: -2px; }
.nav-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: auto; padding: 0 6px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
}
.nav-count.warn { background: var(--amber-soft); color: var(--amber-text); }

.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px;
  background: var(--sidebar-2); border: 1px solid var(--sidebar-line);
}
.user-text { min-width: 0; flex: 1; }
.user-text .name {
  color: var(--sidebar-strong); font-weight: 600; font-size: 13px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-text .meta { font-size: 12px; color: var(--sidebar-text); }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  min-height: 82px; padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
}
.page-title p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.topbar-date {
  display: inline-flex; align-items: center; gap: 7px; margin-right: 6px; color: var(--muted);
  font-size: 13px; font-weight: 500; white-space: nowrap;
}

main.page {
  width: 100%; max-width: 1600px; margin: 0 auto; padding: 24px 28px 48px;
  display: grid; gap: 20px; align-content: start;
}

/* Indicador de conexión: un punto de color y un texto (lo cambia el JS con la clase ok). */
.status-dot {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.status-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--red); box-shadow: 0 0 0 3px var(--red-soft);
}
.status-dot.ok::before {
  background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: breathe 2.4s infinite;
}
@keyframes breathe { 50% { box-shadow: 0 0 0 5px transparent; } }

/* ---------- Tarjetas ---------- */

.card {
  min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); box-shadow: var(--shadow);
}
.card > header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 54px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card > header h2 { display: flex; align-items: center; gap: 9px; }
.card > header h2 .i { color: var(--accent-text); }
.card > header .sub { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px; }
.card > :last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }

.count {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.count.hot { background: var(--amber-soft); color: var(--amber-text); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2.live-focused { grid-template-columns: minmax(0, 1fr); }
.live-views { display: grid; justify-items: start; gap: 8px; min-width: 0; }
.live-views .segmented { max-width: 100%; }
.live-views .segmented button { min-height: 44px; }
.live-views p { margin: 0; font-size: 12.5px; }
.videowall .app { grid-template-columns: minmax(0, 1fr); }
.videowall .sidebar, .videowall .live-views, .videowall #theme-btn, .videowall #tab-directo .actions { display: none; }
.videowall .topbar { position: static; }
.videowall #tab-directo { width: 100%; }
.contact-name { white-space: normal; overflow-wrap: anywhere; }

/* ---------- Indicadores del día ---------- */

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpi {
  display: grid; gap: 5px; padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow);
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--tone-soft, var(--surface-3)); color: var(--tone-text, var(--muted));
}
.kpi-icon .i { width: 17px; height: 17px; }
.kpi .value {
  margin-top: 4px; font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi .sub { color: var(--muted); font-size: 12px; min-height: 17px; }

/* ---------- Tablas ---------- */

.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 11px 14px; text-align: left; white-space: nowrap; background: var(--surface-2);
  border-bottom: 1px solid var(--border); color: var(--text-2);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13.5px; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; transition: background 0.1s; }
tbody tr.clickable:hover, tbody tr.clickable:focus-within { background: var(--accent-soft); }
th.num, td.num { text-align: right; }
table.compact th, table.compact td { padding-left: 8px; padding-right: 8px; }
table.compact th:first-child, table.compact td:first-child { padding-left: 16px; }
table.compact th:last-child, table.compact td:last-child { padding-right: 16px; }
td.actions { white-space: nowrap; text-align: right; }
.cell-main { font-weight: 500; white-space: nowrap; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 1px; white-space: nowrap; }
td.num { white-space: nowrap; }
td.comment { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 0 !important; }
.empty-state {
  display: grid; justify-items: center; gap: 8px; padding: 34px 16px; text-align: center;
  color: var(--muted); font-size: 13px;
}
.empty-state .i { width: 22px; height: 22px; stroke-width: 1.75; color: var(--border-strong); }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin: 1px 2px 1px 0;
  border-radius: 6px; background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}

.tag .i { width: 12px; height: 12px; }
.person .meta .i { width: 13px; height: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px;
  border-radius: 999px; background: var(--tone-soft); color: var(--tone-text);
  font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); flex: none; }
.chip.sonando::before { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* Nivel de servicio con su barra. */
.sla { display: inline-flex; align-items: center; gap: 8px; }
.sla-bar { width: 52px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.sla-bar div { height: 100%; border-radius: inherit; background: var(--tone); }

/* ---------- Personas: iniciales y punto de estado ---------- */

.avatar {
  position: relative; width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar .presence {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--tone, var(--grey)); border: 2px solid var(--surface);
}
.sidebar .avatar .presence, .agent-top .avatar .presence { border-color: var(--sidebar); }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .name { font-weight: 600; white-space: nowrap; }
.person .meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px;
  padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-s);
  font: 500 13.5px/1 var(--font); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--grey); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--brand-primary-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ok:hover:not(:disabled) { background: color-mix(in srgb, var(--green) 88%, #000); }
.btn.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); color: var(--amber-text); }
.btn.warn:hover:not(:disabled) { background: color-mix(in srgb, var(--amber) 18%, var(--surface)); border-color: var(--amber); }
.btn.bad { background: var(--red); border-color: var(--red); color: #fff; }
.btn.bad:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 88%, #000); }
.btn.active { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-text); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.small .i { width: 14px; height: 14px; }
.btn.big { height: 46px; padding: 0 20px; border-radius: 10px; font-size: 14.5px; font-weight: 600; }
.btn.big .i { width: 18px; height: 18px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.small { width: 30px; }
.btn.link {
  height: auto; padding: 2px 4px; border: none; background: none; box-shadow: none;
  color: var(--accent-text); font-weight: 600;
}
.btn.link:hover { text-decoration: underline; }

/* Desplegable y botón pegados (motivo de la pausa + Pausa). */
.join { display: inline-flex; }
.join > select { border-radius: 8px 0 0 8px; border-right: none; }
.join > .btn { border-radius: 0 8px 8px 0; }

/* ---------- Formularios ---------- */

input, select, textarea {
  min-width: 0; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); color: var(--text);
  font: 13.5px var(--font); transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; padding: 9px 11px; line-height: 1.5; }
select {
  appearance: none; padding-right: 32px; cursor: pointer; background-repeat: no-repeat;
  background-position: right 10px center; background-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858fa3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: var(--grey); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type="checkbox"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); cursor: pointer; }
label { display: grid; gap: 6px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.field-title { color: var(--text-2); font-size: 12.5px; font-weight: 500; margin-bottom: 8px; }

.toolbar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 18px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.toolbar label { font-size: 12px; }
.toolbar input, .toolbar select { height: 34px; }
.toolbar .btn { height: 34px; }

/* Casillas como botones que se marcan (colas de un usuario). */
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  color: var(--text); font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.checks label:hover { border-color: var(--grey); }
.checks label:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text);
}

/* ---------- Avisos ---------- */

.banner {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid; font-size: 13.5px; font-weight: 500;
}
.banner::before {
  content: ""; width: 18px; height: 18px; flex: none; background: currentColor;
  -webkit-mask: var(--alert-icon) center / contain no-repeat; mask: var(--alert-icon) center / contain no-repeat;
}
.banner.bad { background: var(--red-soft); color: var(--red-text); border-color: color-mix(in srgb, var(--red) 28%, transparent); }
.banner.warn { background: var(--amber-soft); color: var(--amber-text); border-color: color-mix(in srgb, var(--amber) 32%, transparent); }
.banner.info { background: var(--teal-soft); color: var(--teal-text); border-color: color-mix(in srgb, var(--teal) 30%, transparent); }

:root {
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  --check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 100; display: flex; align-items: center;
  gap: 10px; max-width: min(440px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px;
  background: #111a2c; color: #f4f6fa; border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-l); font-size: 13.5px; font-weight: 500; animation: rise 0.2s ease-out;
}
.toast::before {
  content: ""; width: 18px; height: 18px; flex: none; background: #4ade80;
  -webkit-mask: var(--check-icon) center / contain no-repeat; mask: var(--check-icon) center / contain no-repeat;
}
.toast.bad::before {
  background: #ff8d91; -webkit-mask-image: var(--alert-icon); mask-image: var(--alert-icon);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Ventanas ---------- */

dialog {
  width: min(880px, 94vw); padding: 0; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-l);
}
dialog::backdrop { background: rgba(7, 11, 22, 0.5); backdrop-filter: blur(3px); }
dialog[open] { animation: pop 0.18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.dialog-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.dialog-head p { margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.head-icon {
  width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
}
.head-icon .i { width: 19px; height: 19px; }
.dialog-body { display: grid; gap: 22px; max-height: 72vh; padding: 22px; overflow-y: auto; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px;
  border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px;
}

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.facts > div {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); font-size: 13.5px; font-weight: 500;
}
.facts .label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.facts .wide { grid-column: 1 / -1; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li {
  position: relative; display: grid; grid-template-columns: 56px 16px minmax(0, 1fr); gap: 10px;
  padding: 5px 0; font-size: 13px;
}
.timeline li:not(:last-child)::after {
  content: ""; position: absolute; left: 73.5px; top: 19px; bottom: -6px; width: 1px; background: var(--border-strong);
}
.timeline .t { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .dot {
  width: 9px; height: 9px; margin: 5px auto 0; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.timeline strong { font-weight: 600; }

.transcript { display: grid; gap: 8px; }
.transcript .line {
  justify-self: end; max-width: 82%; padding: 8px 12px; border-radius: 12px 12px 4px 12px;
  background: var(--surface-3); font-size: 13.5px;
}
.transcript .line.agente { justify-self: start; border-radius: 12px 12px 12px 4px; background: var(--violet-soft); }
.transcript .line.sistema { justify-self: center; background: none; color: var(--muted); font-size: 12px; padding: 2px 10px; }
.transcript .who { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }

/* Reproductor de la grabación. */
.player {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-l);
  background: linear-gradient(120deg, var(--accent-soft), var(--surface-2) 70%);
}
.player-play { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 8px 18px -8px var(--accent); }
.player-play .i { width: 18px; height: 18px; }
.player-main { flex: 1; min-width: 220px; display: grid; gap: 8px; }
.player-times { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.player-times .file { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-times .file .i { width: 14px; height: 14px; color: var(--accent-text); }
.player.broken { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 28%, transparent); }
.player.broken [data-player="time"] { color: var(--red-text); font-weight: 500; }
.player-seek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; padding: 0; border: none;
  border-radius: 999px; cursor: pointer; box-shadow: none;
  background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--border-strong) var(--p, 0%));
}
.player-seek:hover { border: none; }
.player-seek:focus { box-shadow: var(--ring); }
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.player-seek::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
th.icon-col, td.icon-col { width: 40px; padding-left: 6px; padding-right: 6px; text-align: center; }
th.icon-col .i { width: 14px; height: 14px; vertical-align: middle; }
.rec { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); }
.rec .i { width: 14px; height: 14px; }

/* Registro de errores y avisos. */
.log-detail td { background: var(--surface-2); }
.log-detail pre {
  margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border);
  white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text-2);
}

/* Formulario de la llamada (formularios.toml). */
.call-form {
  display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); background: var(--accent-soft);
}
.call-form .note-head label {
  display: flex; align-items: center; gap: 7px; color: var(--accent-text); font-size: 13px; font-weight: 600;
}
.call-form .note-head label .i { width: 15px; height: 15px; }
.form-by { font-size: 12px; }
.form-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.form-field { display: grid; gap: 5px; align-content: start; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.form-field.wide { grid-column: 1 / -1; }
.form-field input, .form-field select, .form-field textarea { width: 100%; }
.req { color: var(--red-text); font-weight: 700; }

/* Resumen que dejó la IA. */
.summary-box {
  min-width: 0; overflow-wrap: anywhere;
  display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--radius); background: var(--violet-soft);
  border: 1px solid color-mix(in srgb, var(--violet) 24%, transparent);
}
.summary-box .label { display: flex; align-items: center; gap: 6px; color: var(--violet-text); font-size: 12px; font-weight: 600; }

/* Comentario de la llamada y nota fija del número. */
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.note-editor { display: grid; gap: 8px; }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-editor label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.note-editor label .i { color: var(--muted); width: 15px; height: 15px; }
.note-head .btn { margin-left: auto; }
.note-editor textarea { width: 100%; min-height: 64px; resize: vertical; }
.note-fixed {
  padding: 12px 14px; border-radius: var(--radius); background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent);
}
.note-fixed .note-editor label, .note-fixed .note-editor label .i { color: var(--amber-text); }
.note-fixed textarea { background: color-mix(in srgb, var(--surface) 75%, transparent); }
.comment { color: var(--muted); font-size: 12.5px; font-style: italic; }

/* ---------- Acceso ---------- */

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  gap: 40px; padding: 40px 56px; color: var(--sidebar-text);
  background:
    radial-gradient(900px 520px at 10% 115%, color-mix(in srgb, var(--brand-primary) 25%, transparent), transparent 60%),
    radial-gradient(700px 440px at 105% -5%, color-mix(in srgb, var(--brand-accent) 9%, transparent), transparent 60%),
    var(--sidebar);
}
.login-brand::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 45%, #000 15%, transparent 70%);
  mask-image: radial-gradient(ellipse at 30% 45%, #000 15%, transparent 70%);
}
.login-brand > * { position: relative; }
.login-brand .brand { padding: 0; }
.login-hero h2 {
  max-width: 460px; color: var(--sidebar-strong); font-size: clamp(32px, 3.2vw, 46px); font-weight: 700; line-height: 1.15; letter-spacing: -0.035em;
}
.login-hero h2 span { text-decoration: underline; text-decoration-color: var(--brand-accent); text-underline-offset: 7px; text-decoration-thickness: 3px; }
.login-hero p { max-width: 430px; margin-top: 16px; font-size: 15px; line-height: 1.6; }
.login-features { list-style: none; display: grid; gap: 14px; margin: 32px 0 0; padding: 0; }
.login-features li { display: flex; align-items: center; gap: 12px; color: var(--sidebar-strong); font-size: 14px; }
.login-features .feature-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand-accent) 9%, transparent); border: 1px solid var(--sidebar-line); color: var(--sidebar-strong);
}
.login-foot { font-size: 12.5px; color: var(--sidebar-text); }

.login-main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login { width: min(390px, 100%); display: grid; gap: 20px; }
.login .mobile-brand { display: none; }
.login-head { display: grid; gap: 8px; margin-bottom: 10px; }
.login-head h1 { font-size: 30px; letter-spacing: -0.03em; }
.login-head p { color: var(--muted); }
.input-icon { position: relative; display: block; }
.input-icon .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { width: 100%; height: 46px; padding-left: 40px; font-size: 14.5px; }
.login .error { min-height: 20px; color: var(--red-text); font-size: 13px; font-weight: 500; }
.login .btn { width: 100%; height: 46px; font-size: 15px; font-weight: 600; }
.login-note { padding-top: 4px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------- Puesto del agente ---------- */

.agent-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  min-height: 70px; padding: 12px 24px; background: var(--sidebar); color: var(--sidebar-text);
  border-bottom: 1px solid var(--sidebar-line);
}
.agent-top .brand { max-width: min(420px, 45vw); padding: 0; margin-right: 8px; }
.agent-top .status-dot, .sidebar .status-dot {
  background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.14); color: var(--sidebar-strong);
}
.agent-top .status-dot::before { box-shadow: 0 0 0 3px rgba(240, 87, 92, 0.22); }
.agent-top .status-dot.ok::before { box-shadow: 0 0 0 3px rgba(45, 189, 110, 0.22); }
.agent-top .btn.ghost, .sidebar .btn.ghost { color: var(--sidebar-text); }
.agent-top .btn.ghost:hover, .sidebar .btn.ghost:hover { background: color-mix(in srgb, var(--brand-dark-text) 8%, transparent); color: var(--sidebar-strong); }
.top-user {
  display: flex; align-items: center; gap: 10px; margin-left: 6px; padding-left: 14px;
  border-left: 1px solid var(--sidebar-line);
}

.agent-main {
  display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start;
  width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px;
}
.stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
.agent-history { max-height: 34rem; overflow-y: auto; scrollbar-gutter: stable; }
.agent-history thead { position: sticky; top: 0; z-index: 1; }

/* Mi estado */
.state-card {
  display: grid; overflow: hidden; border-color: color-mix(in srgb, var(--tone, var(--grey)) 28%, var(--border));
  background: linear-gradient(180deg, var(--tone-soft, var(--grey-soft)) 0%, var(--surface) 85%);
}
.state-main { display: flex; align-items: center; gap: 16px; padding: 20px 22px 18px; flex-wrap: wrap; }
.state-ring {
  width: 52px; height: 52px; border-radius: 15px; flex: none; display: grid; place-items: center;
  background: var(--surface); color: var(--tone-text, var(--grey-text));
  border: 1px solid color-mix(in srgb, var(--tone, var(--grey)) 25%, var(--border));
}
.state-ring .i { width: 24px; height: 24px; }
.st-sonando .state-ring { animation: wiggle 1.2s infinite; }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-8deg); } 20%, 40% { transform: rotate(8deg); } }
.state-text { flex: 1; min-width: 180px; }
.state-label, .state-timer .label {
  color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
}
.state-name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.state-name .reason {
  display: inline-flex; align-items: center; min-height: 24px; max-width: 100%; padding: 2px 10px; border-radius: 999px; overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--border); color: var(--tone-text);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0; align-self: center;
}
.state-hint { margin-top: 2px; color: var(--muted); font-size: 13px; }
.state-timer { text-align: right; }
.state-timer .num { display: block; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.state-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 22px;
  border-top: 1px solid var(--border); background: var(--surface);
}
.after-call {
  display: flex; align-items: center; gap: 8px; padding: 10px 22px; border-top: 1px dashed var(--border-strong);
  background: var(--surface-2); color: var(--text-2); font-size: 13px;
}
.after-call .i { color: var(--muted); }

/* Audio del puesto web */
.device { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; }
.device-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted); transition: all 0.2s;
}
.device-icon .i { width: 20px; height: 20px; }
#audio-card.on .device-icon { background: var(--green-soft); color: var(--green-text); }
.device-text { flex: 1; min-width: 240px; }
.device-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.device-text p { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.device-meter { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dialer { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 18px; }
.dialer > label { flex: 1 1 180px; }
.dialer input, .dialer select { width: 100%; }
.dialer-hint { flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.dialpad-dialog { width: min(420px, 96vw); max-height: calc(100dvh - 24px); }
.dialpad-dialog .dialog-head { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.dialpad-dialog .dialog-foot { position: sticky; bottom: 0; z-index: 2; background: var(--surface); }
.dialpad-body { display: grid; gap: 12px; }
.dialpad-body > label { display: grid; gap: 6px; }
#dialpad-number { width: 100%; height: 50px; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: 0.025em; }
.dialpad-tools { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 12px; }
.dialpad-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dialpad-key { display: flex; flex-direction: column; gap: 0; min-height: 64px; height: auto; padding: 6px; background: var(--surface-2); }
.dialpad-key strong { font-size: 27px; font-weight: 600; line-height: 1.2; }
.dialpad-key small { min-height: 12px; color: var(--muted); font-size: 10px; letter-spacing: 0.1em; }
.dialpad-dialog .form-error:empty { display: none; }
.dialpad-dialog .dialog-foot .btn { min-height: 44px; }
.queue-categorization { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.queue-categorization > p { font-size: 12.5px; }
.queue-categorization textarea { width: 100%; min-height: 100px; }
.category-cell { min-width: 130px; max-width: 260px; overflow-wrap: anywhere; }
#category-dialog { width: min(540px, 96vw); max-height: calc(100dvh - 24px); }
#category-dialog .dialog-head { position: sticky; top: 0; z-index: 2; background: var(--surface); }
#category-dialog #category-call { overflow-wrap: anywhere; }
#category-dialog select { width: 100%; margin-top: 5px; min-height: 44px; }
#category-dialog .btn { min-height: 44px; }
.category-choice-preview { min-height: 0; overflow-wrap: anywhere; }
.category-choice-preview:empty, #category-error:empty, #category-count:empty { display: none; }
.category-savebar .btn { width: 100%; }
.category-alternatives { display: grid; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.category-alternatives .btn { flex: 1 1 130px; white-space: normal; line-height: 1.25; }
.connection-banner { margin: 16px 28px 0; }
.agent-top + .connection-banner { width: calc(100% - 48px); max-width: 1432px; margin: 16px auto 0; }
.live-unverified #sip-pill::before, .live-unverified #live::before { background: var(--grey); box-shadow: 0 0 0 3px var(--grey-soft); animation: none; }
.live-unverified .state-card, .live-unverified #agents .chip, .live-unverified #agent-counts .chip { --tone: var(--grey); --tone-soft: var(--grey-soft); --tone-text: var(--grey-text); }
.live-unverified .presence { --tone: var(--grey); }
.meter {
  width: 120px; height: 8px; border-radius: 2px; background: var(--surface-3); overflow: hidden;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
  mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
}
.meter div {
  width: 0; height: 100%; transition: width 0.1s linear;
  background: linear-gradient(90deg, var(--green) 0 70%, var(--amber) 85%, var(--red));
  background-size: 120px 100%;
}

/* Llamada */
.call-empty { display: grid; justify-items: center; gap: 8px; padding: 40px 24px 44px; text-align: center; }
.big-icon {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--surface-3); color: var(--muted); box-shadow: 0 0 0 8px var(--surface-2);
}
.big-icon .i { width: 26px; height: 26px; stroke-width: 1.75; }
.call-empty strong { font-size: 15px; }
.call-empty p { max-width: 380px; color: var(--muted); font-size: 13px; }

.last-call { display: grid; gap: 12px; padding: 16px 22px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.last-call-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.last-call-head .i { color: var(--muted); }

.call-box { display: grid; grid-template-columns: minmax(0, 1fr); }
.call-hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 22px;
  background: linear-gradient(120deg, var(--tone-soft, var(--surface-2)) 0%, transparent 75%);
  border-bottom: 1px solid var(--border);
}
.call-avatar {
  position: relative; width: 58px; height: 58px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--surface); color: var(--tone-text, var(--grey-text));
  border: 1px solid color-mix(in srgb, var(--tone, var(--grey)) 30%, var(--border));
}
.call-avatar .i { width: 24px; height: 24px; }
.st-sonando .call-avatar::before, .st-sonando .call-avatar::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--tone);
  animation: ripple 1.8s ease-out infinite;
}
.st-sonando .call-avatar::after { animation-delay: 0.9s; }
@keyframes ripple { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.9); opacity: 0; } }
.call-who { flex: 1; min-width: 200px; display: grid; gap: 3px; }
.call-kicker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.call-kicker > span:not(.chip) { display: inline-flex; align-items: center; gap: 5px; }
.call-kicker .i { width: 14px; height: 14px; }
.call-number { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.call-name { color: var(--text-2); font-weight: 500; }
.call-timer { text-align: right; }
.call-timer .label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
.call-timer .num { display: block; font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.call-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 18px 22px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.call-controls:empty { display: none; }
.call-sections { display: grid; gap: 20px; padding: 20px 22px 22px; }

.history-list { display: grid; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.history-item {
  display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--surface-2); }
.history-item .when { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.history-item .what { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .extra { grid-column: 2 / -1; display: flex; align-items: flex-start; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.history-item .extra .i { width: 13px; height: 13px; margin-top: 2px; color: var(--muted); }
.history-item .extra.comment { color: var(--muted); }

.transfer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.transfer .label { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: 13px; font-weight: 600; }
.transfer .label .i { color: var(--muted); }
.transfer > label { flex: 1 1 180px; }
.transfer > label select { width: 100%; }
.transfer .transfer-help { flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.transfer > .banner { flex-basis: 100%; }
.segmented.queue-mode button[aria-pressed="true"] {
  background: var(--accent); color: var(--brand-primary-text, #fff); font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Informes y navegación entre páginas de resultados. */
.inline-filter { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.inline-filter select { height: 32px; }
.period-summary { padding: 12px 18px; color: var(--text-2); font-size: 12.5px; border-bottom: 1px solid var(--border); }
.access-table { max-height: 36rem; overflow: auto; }
.access-table table { min-width: 700px; }
.access-table .access-text { max-width: 260px; overflow-wrap: anywhere; white-space: normal; }
#access-error { color: var(--red); }
#registry-nav button { min-height: 44px; }
.card > .period-summary:last-child { border-bottom: none; }
.pagination { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--border); font-size: 12.5px; }
.report-filters .segmented { align-self: center; }
.report-note { padding: 12px 18px; color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--border); }
#report-warnings ul { margin: 6px 0 0; padding-left: 18px; }
.report-volume { position: relative; display: inline-flex; justify-content: flex-end; align-items: center; min-width: 80px; padding: 3px 6px; border-radius: 4px; overflow: hidden; }
.report-volume > span { position: absolute; top: 0; bottom: 0; left: 0; width: var(--volume, 0%); background: var(--accent-soft); }
.report-volume strong { position: relative; font-weight: 600; }
.report-agents th, .report-agents td { white-space: nowrap; }
.pause-breakdown { min-width: 130px; }
.pause-breakdown summary { cursor: pointer; color: var(--text-2); }
.pause-breakdown ul { display: grid; gap: 6px; list-style: none; padding: 10px 0 0; margin: 0; }
.pause-breakdown li { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; }
.pause-breakdown li > span { max-width: 220px; white-space: normal; }
#state-detail { width: min(1100px, 96vw); }

/* Agenda común de los dos perfiles. */
.contacts-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.contacts-header h2 { display: inline-flex; align-items: center; gap: 8px; }
.contacts-header h2 .i { color: var(--accent-text); }
.contacts-search > label { flex: 1; min-width: 160px; }
.contacts-search input { width: 100%; }
.contacts-status { padding: 10px 18px; color: var(--muted); font-size: 12.5px; }
.contacts-editor { display: grid; gap: 12px; margin: 0 18px 18px; padding: 16px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.contacts-editor h3 { margin: 0; }
.contacts-fields { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; }
.contacts-fields input { width: 100%; }
.contacts-delete { margin: 0 18px 18px; flex-wrap: wrap; }
.contacts-delete > span { flex: 1 1 220px; overflow-wrap: anywhere; }
.contacts-list-wrap { max-height: 32rem; overflow-y: auto; scrollbar-gutter: stable; }
.contacts-table .contact-name { min-width: 160px; max-width: 360px; overflow-wrap: anywhere; font-weight: 600; }
.contacts-table .contact-number { text-align: left; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#agent-contacts-dialog { width: min(920px, 96vw); }
#agent-contacts-dialog .dialog-head { position: sticky; top: 0; z-index: 2; background: var(--surface); }
#agent-contacts-dialog .contacts-list-wrap { max-height: min(32rem, 45dvh); }

/* Mis colas */
.queue-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.queue-item:last-child { border-bottom: none; }
.queue-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted);
}
.queue-item .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.queue-count { text-align: right; line-height: 1.1; }
.queue-count strong { display: block; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.queue-count small { color: var(--muted); font-size: 11.5px; }
.queue-item.waiting .queue-icon { background: var(--amber-soft); color: var(--amber-text); }
.queue-item.waiting .queue-count strong { color: var(--amber-text); }

/* ---------- Configuración (supervisor) ---------- */

.subnav {
  display: flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: 100%; padding: 4px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
}
.subnav button {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border: none;
  border-radius: 8px; background: none; color: var(--text-2); font: 500 13.5px var(--font); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.subnav button:hover { background: var(--surface-3); color: var(--text); }
.subnav button.active { background: var(--accent-soft); color: var(--accent-text); }
.subnav button.dirty::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft);
}
#config-status:empty, #config-body:empty { display: none; }
#config-status { scroll-margin-top: 96px; }
/* Con la barra de guardar a la vista, los avisos salen encima de ella. */
body:has(#tab-configuracion:not(.hidden) .savebar:not(.hidden)) .toast { bottom: 92px; }
.stack-s { display: grid; gap: 14px; align-content: start; min-width: 0; }
.section-head { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.section-head h2 { font-size: 16px; }
.section-head p { margin-top: 2px; color: var(--muted); font-size: 13px; max-width: 760px; }
.config-fold-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.config-fold-tools > .muted { font-size: 12px; }
.config-fold-tools .btn { min-height: 44px; }
.config-item { scroll-margin-top: 110px; }
.config-item > summary {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; min-height: 64px;
  list-style: none; cursor: pointer; border-radius: inherit;
}
.config-item > summary::-webkit-details-marker { display: none; }
.config-item > summary::marker { content: ""; }
.config-item > summary:hover { background: var(--surface-2); }
.config-item > summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.config-item[open] > summary { border-bottom: 1px solid var(--border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.config-chevron { display: grid; place-items: center; flex: none; color: var(--accent-text); }
.config-item[open] .config-chevron { transform: rotate(90deg); }
.config-item-heading { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; flex: 1; min-width: 0; }
.config-item-title { display: flex; align-items: center; gap: 9px; overflow-wrap: anywhere; min-width: 0; }
.config-item-title .i { flex: none; color: var(--accent-text); }
.config-item-heading > .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; overflow-wrap: anywhere; }
.config-item-heading .chip, .config-item-heading .tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.config-item-hint { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; flex: none; }
.config-item:not([open]) .when-open, .config-item[open] .when-closed { display: none; }
.config-item-actions { flex-wrap: wrap; }
.config-item > .card-body, .config-item > .card-body > * { min-width: 0; }
.campaign-toolbar { padding: 0; margin-bottom: 16px; flex-wrap: wrap; }
.campaign-card > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 18px; min-height: 64px; cursor: pointer; }
.campaign-card > summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.campaign-card[open] > summary { border-bottom: 1px solid var(--border); }
.campaign-chevron { display: grid; place-items: center; color: var(--accent-text); }
.campaign-card[open] .campaign-chevron { transform: rotate(90deg); }
.campaign-heading { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.campaign-card .card-body > *, .campaign-card section, .campaign-editor, .campaign-editor fieldset { min-width: 0; }
.campaign-editor fieldset { border: 0; padding: 0; margin: 0; }
.campaign-editor .form-grid input, .campaign-editor .form-grid select { width: 100%; }
.campaign-editor .muted, .campaign-runtime, .campaign-progress { font-size: 12.5px; }
.campaign-message:empty, #campaigns-error:empty { display: none; }
.campaign-preview { overflow-wrap: anywhere; }
.campaign-preview ul { margin: 10px 0; padding-left: 20px; }
.campaign-import { border-top: 1px solid var(--border); padding-top: 18px; }
.campaign-import input { max-width: 100%; }
.campaign-targets { max-height: 34rem; }
.campaign-targets table { min-width: 900px; }
.campaign-targets td { max-width: 260px; white-space: normal; overflow-wrap: anywhere; }
.campaign-agent { border-top: 1px solid var(--border); padding: 12px 20px 16px; }
.campaign-agent label { min-height: 44px; font-weight: 600; }
.campaign-agent input[type=checkbox] { width: 20px; height: 20px; }
.campaign-agent p { margin-top: 4px; font-size: 12.5px; line-height: 1.5; }
.campaign-context { padding: 10px 12px; margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 12.5px; overflow-wrap: anywhere; }
.campaign-context strong { display: flex; align-items: center; gap: 7px; }
.campaign-call-notes { max-height: 8rem; overflow-y: auto; margin-top: 4px; white-space: pre-wrap; }
@media (max-width: 720px) {
  .campaign-card .btn, .campaign-toolbar .btn { min-height: 44px; height: auto; padding-block: 10px; white-space: normal; line-height: 1.3; }
  .campaign-card .form-grid { grid-template-columns: minmax(0, 1fr); }
  .campaign-card input:not([type=checkbox]), .campaign-card select { min-height: 44px; font-size: 16px; }
  .campaign-card > summary { padding: 14px; }
}
.hint { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.tag.mono { font-size: 11.5px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; }
label.inline input { width: 90px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.form-error { min-height: 18px; color: var(--red-text); font-size: 13px; font-weight: 500; }
.key {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; flex: none;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 7px;
  background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.key.wide { color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.rows { display: grid; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.segmented { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.segmented button {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border: none;
  border-radius: 7px; background: none; color: var(--text-2); font: 500 13px var(--font); cursor: pointer;
}
.segmented button .i { width: 15px; height: 15px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.table-wrap.bordered { border: 1px solid var(--border); border-radius: var(--radius); }
table.editor td { padding-top: 6px; padding-bottom: 6px; }
.table-wrap.bordered table.editor { min-width: 640px; }
table.editor input:not([type="checkbox"]), table.editor select, table.editor textarea { width: 100%; }
table.editor textarea { min-height: 36px; resize: vertical; }
table.editor input[readonly] { background: var(--surface-2); color: var(--muted); }
td.center { text-align: center; }
label.btn.disabled { opacity: 0.45; pointer-events: none; }
.savebar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px 12px 18px; border-radius: 14px; background: var(--sidebar); color: var(--sidebar-strong);
  border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: var(--shadow-l); font-weight: 500; animation: rise 0.2s ease-out;
}
.savebar > .i { color: #f6bf62; }
.savebar .btn:not(.primary) { background: transparent; color: #f4f6fa; border-color: rgba(255, 255, 255, 0.22); }
.savebar .btn:not(.primary):hover { background: rgba(255, 255, 255, 0.08); }
.banner.problems ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; display: grid; gap: 3px; }
.banner > .btn { margin-left: auto; }
.banner > span { align-self: center; }
pre.code {
  margin: 0; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
  white-space: pre-wrap; word-break: break-word; font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text-2);
}
dialog.small { width: min(520px, 94vw); }

/* Flujo de una llamada */
.flow { display: grid; }
.flow-step { position: relative; display: flex; align-items: flex-start; gap: 14px; padding-bottom: 20px; }
.flow-step::after {
  content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--border);
}
.flow-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
}
.flow-title { font-weight: 600; line-height: 1.3; }
.flow-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; color: var(--text-2); font-size: 13px; }
.flow-tree { display: grid; gap: 12px; }
.flow-lang { display: grid; gap: 8px; justify-items: start; }
.flow-lang > .flow-node { justify-self: stretch; }
.flow-node { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.flow-node-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 10px 14px; }
.flow-node-head > .i { color: var(--muted); }
.flow-node.menu > .flow-node-head { border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 12px 12px 0 0; }
.flow-node.menu > .flow-node-head .flow-sub { margin: 0; }
.flow-options { display: grid; gap: 10px; padding: 12px 14px; }
.flow-option { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: start; }
.flow-option > .key { justify-self: start; margin-top: 9px; }
.flow-node.queue { border-left: 3px solid var(--teal); }
.flow-node.queue.by-service { border-left-color: var(--violet); }
.flow-who { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; padding: 0 14px 12px; font-size: 13px; }
.flow-who > .i { margin-top: 2px; }
.flow-who.people > .i { color: var(--teal-text); }
.flow-who.service > .i { color: var(--violet-text); }
.flow-fallback { display: flex; align-items: center; gap: 6px; padding: 0 14px 12px; color: var(--muted); font-size: 12.5px; }
.flow-fallback .i { width: 14px; height: 14px; }
.flow-node.missing { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--red-soft); color: var(--red-text); font-weight: 500; }
.flow-node.loop { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--muted); border-style: dashed; }
.flow-node.ending { border-left: 3px solid var(--grey); }
.flow-node.ending > .flow-node-head .flow-sub { margin: 0; }
.flow-closed { display: grid; gap: 8px; margin: 0 14px 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.flow-closed-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.flow-closed-label .i { width: 14px; height: 14px; }
.days { display: grid; gap: 8px; margin-bottom: 10px; }
.card-body > input, .day-row input { width: 100%; }
.day-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 12px; }
.day-name { font-weight: 600; font-size: 13px; color: var(--text-2); }
.prompt-name { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; color: var(--muted); }
.quote { color: var(--text-2); font-style: italic; }

/* ---------- Pantallas estrechas ---------- */

@media (max-width: 1180px) {
  .agent-main { grid-template-columns: minmax(0, 1fr) 330px; }
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; align-items: center; }
  .sidebar .brand-name, .sidebar .nav-label, .sidebar .user-text, .nav button span { display: none; }
  .sidebar .brand-mark, .sidebar .brand-mark img { max-width: 36px; }
  .nav button { position: relative; justify-content: center; padding: 10px; }
  .nav-count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  .nav { margin-top: 10px; }
  .user-card { flex-direction: column; padding: 8px 6px; }
}
@media (max-width: 1360px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .agent-main, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .topbar-date { display: none; }
  .agent-top .brand-name, .agent-top .user-text { display: none; }
  .agent-main .btn, .agent-top .btn { min-height: 44px; }
  .agent-top .btn, .agent-main .btn.icon { min-width: 44px; }
  .agent-main .btn { white-space: normal; line-height: 1.25; }
  .agent-main input:not([type="checkbox"]):not([type="range"]), .agent-main select { min-height: 44px; font-size: 16px; }
  .agent-main textarea { font-size: 16px; }
  .agent-main.is-in-call .agent-workspace > .active-call-card { order: -2; }
  .agent-main.is-in-call .agent-workspace > #sip-banner:not(.hidden) { order: -3; }
  .contacts-component .btn, #agent-contacts-dialog .btn { min-height: 44px; white-space: normal; line-height: 1.25; }
  .dialpad-dialog .btn { min-height: 44px; }
  #agent-contacts-dialog .btn.icon { min-width: 44px; }
  .contacts-component input { min-height: 44px; font-size: 16px; }
  #category-dialog select { font-size: 16px; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 14px 16px 10px; }
  .sidebar .brand-name { display: grid; }
  .nav { display: flex; grid-column: 1 / -1; grid-row: 2; min-width: 0; margin: 0; padding-bottom: 4px; overflow-x: auto; }
  .nav button { width: auto; min-height: 38px; flex: none; gap: 7px; padding: 9px 11px; }
  .nav button span { display: inline; }
  .nav button.active { box-shadow: inset 0 -2px 0 var(--brand-accent); }
  .nav-count { position: static; min-width: 18px; height: 18px; margin-left: 0; }
  .sidebar-foot { grid-column: 2; grid-row: 1; margin: 0; }
  .sidebar .brand-mark, .sidebar .brand-mark img { max-width: 104px; }
  .user-card { flex-direction: row; background: none; border: none; padding: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 27px; }
  .topbar { position: static; gap: 10px; padding: 16px; flex-wrap: wrap; }
  .page-title { flex-basis: calc(100% - 48px); }
  .topbar > .spacer { display: none; }
  .topbar #theme-btn { margin-left: auto; }
  main.page { padding: 16px; }
  .agent-top { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px 12px; min-height: 64px; padding: 12px; }
  .agent-top .brand { grid-column: 1; grid-row: 1; max-width: 100%; margin: 0; }
  .agent-top > .spacer { display: none; }
  .agent-top #theme-btn { grid-column: 2; grid-row: 1; }
  .agent-top .top-user { grid-column: 3; grid-row: 1; }
  .agent-top #live { grid-column: 1 / -1; grid-row: 2; justify-self: start; max-width: 100%; }
  .agent-top .brand-name, .agent-top .user-text, .agent-top #sip-pill { display: none; }
  .agent-top .brand-mark, .agent-top .brand-mark img { max-width: 104px; }
  .top-user { gap: 8px; margin-left: 0; padding-left: 10px; }
  .agent-main { padding: 16px; }
  .state-main { gap: 12px; padding: 18px; }
  .state-text { min-width: min(160px, 100%); }
  .state-actions { padding: 14px 18px; }
  .state-actions > .spacer { display: none; }
  .state-actions > .btn { flex: 1 1 130px; }
  .state-actions > .join { flex: 1 1 240px; max-width: 100%; }
  .state-actions > .join select { flex: 1; width: 0; }
  .state-timer { text-align: left; }
  .device { padding: 16px; }
  .device-text { min-width: min(220px, 100%); }
  .call-hero { gap: 14px; padding: 18px; }
  .call-avatar { width: 44px; height: 44px; }
  .call-who { min-width: min(160px, 100%); }
  .call-number { font-size: clamp(22px, 6.5vw, 26px); }
  .call-timer { text-align: left; }
  .call-controls, .call-sections { padding: 16px 18px; }
  .call-controls > .btn { flex: 1 1 140px; }
  .call-controls > .btn.bad { flex-basis: 100%; margin-bottom: 4px; }
  .call-controls > .chip { min-height: 24px; height: auto; padding-block: 3px; white-space: normal; }
  .dialer > label, .dialer > .btn { flex-basis: 100%; }
  .transfer > .label, .transfer > label, .transfer > .btn { flex-basis: 100%; }
  .note-head { flex-wrap: wrap; }
  .notes { grid-template-columns: minmax(0, 1fr); }
  .history-item { grid-template-columns: 90px minmax(0, 1fr); padding: 10px; }
  .history-item > .chip { grid-column: 2; justify-self: start; }
  .toolbar > label { min-width: 0; }
  .savebar { bottom: 10px; padding: 12px; }
  .report-filters > label { flex: 1 1 130px; }
  .report-filters input, .report-filters select { width: 100%; }
  .report-filters .segmented { flex-basis: 100%; }
  .report-filters .segmented button { flex: 1; justify-content: center; }
  #access-filters input, #access-filters select, #access-filters .btn { min-height: 44px; height: auto; }
  .pagination > .muted { flex-basis: 100%; }
  .contacts-fields { grid-template-columns: minmax(0, 1fr); }
  .contacts-search > label { flex-basis: 100%; }
  .contacts-header, .contacts-status { padding-inline: 14px; }
  .contacts-editor { margin-inline: 14px; padding: 12px; }
  .contacts-table thead { display: none; }
  .contacts-table, .contacts-table tbody, .contacts-table tr, .contacts-table td { display: block; }
  .contacts-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .contacts-table td, .contacts-table td:first-child, .contacts-table td:last-child { min-width: 0; max-width: none; padding: 3px 0; border: none; }
  .contacts-table td.empty { padding: 0; }
  .contacts-table .contact-number { margin-bottom: 8px; overflow-wrap: anywhere; white-space: normal; }
  .contact-actions > .btn { flex: 1 1 75px; }
  .connection-banner { margin: 12px 16px 0; }
  .agent-top + .connection-banner { width: calc(100% - 32px); margin: 12px auto 0; }
}
@media (max-width: 860px) {
  .login-page { grid-template-columns: minmax(0, 1fr); }
  .login-brand { display: none; }
  .login .mobile-brand { display: flex; }
  .login .mobile-brand .brand-name { color: var(--text); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
