/* Panel interno y portal del cliente. Rediseño 2026-09-27: texto en Inter
   y JetBrains Mono en cifras/KPIs (Poppins en títulos desde el
   rebranding de quantumpyme.com, 2026-09-27); menú con iconos. */
:root {
  --navy: #1a2844;
  --navy-2: #121d33;
  --red: #e84b3d;
  --red-2: #f5a84d;
  --red-3: #f5a84d;
  --red-soft: rgba(232, 75, 61, 0.08);
  --bg: #f5f6f8;
  --ink: #1a2844;
  --ink-2: #344054;
  --muted: #667085;
  --stroke: #e4e7ec;
  --white: #ffffff;

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --info: #2563eb;

  --chart-1: #e84b3d;
  --chart-2: #2563eb;
  --chart-3: #0f9488;
  --chart-4: #a16207;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Poppins", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(26, 40, 68, 0.05), 0 1px 3px rgba(26, 40, 68, 0.04);
  --shadow-hover: 0 12px 28px -8px rgba(26, 40, 68, 0.16);
  --sidebar-w: 256px;
}

* { box-sizing: border-box; }

img, audio, video, iframe { max-width: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:not([class]) { color: var(--red); text-decoration-color: rgba(232, 75, 61, 0.35); text-underline-offset: 2px; }
a:not([class]):hover { text-decoration-color: var(--red); }
p { line-height: 1.6; }
strong, b { font-weight: 600; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 1.55rem; font-weight: 700; margin: 0 0 1.5rem; line-height: 1.25; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 2rem 0 0.85rem; }
h3 { font-size: 0.95rem; font-weight: 700; margin: 1.25rem 0 0.5rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

/* ---- Layout: menú lateral + contenido ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #e6e6e6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.sidebar-logo { padding: 1.4rem 1.25rem 1rem; display: flex; align-items: center; justify-content: space-between; }
.sidebar-logo img { width: 100%; max-width: 160px; display: block; }
.sidebar-close { display: none; }

.sidebar-account {
  display: flex; align-items: center; gap: 0.7rem;
  margin: 0 0.85rem 0.75rem; padding: 0.7rem 0.75rem;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
}
.avatar {
  width: 2.3rem; height: 2.3rem; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--red) 0%, #b30009 100%);
  color: #fff; font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
}
.sidebar-account-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-account-text strong { font-size: 0.85rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-text small { font-size: 0.72rem; color: #98a2b3; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.25rem 0.75rem 1rem; }
.nav-icon { font-size: 1.05rem; opacity: 0.85; }
/* Grupos plegables (<details>/<summary>, sin JS): solo el grupo con la
   página actual arranca abierto. */
.nav-group { display: flex; flex-direction: column; }
.nav-group-label {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; color: #c3c9d4;
  cursor: pointer; list-style: none; user-select: none;
  transition: background 0.15s, color 0.15s;
}
.nav-group-label::-webkit-details-marker { display: none; }
.nav-group-label span { flex: 1; }
.nav-group-label:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-group-label::after {
  content: ""; width: 0.4rem; height: 0.4rem; margin-right: 0.2rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); opacity: 0.6; transition: transform 0.2s ease;
}
.nav-group[open] > .nav-group-label { color: #fff; }
.nav-group[open] > .nav-group-label::after { transform: rotate(45deg); }
.nav-group-links {
  display: flex; flex-direction: column; gap: 0.1rem;
  margin: 0.1rem 0 0.35rem 1.35rem; padding-left: 0.6rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #aeb6c2;
  text-decoration: none;
  font-size: 0.84rem;
  transition: background 0.15s, color 0.15s;
}
.nav-link-top { font-size: 0.875rem; font-weight: 500; color: #c3c9d4; }
.nav-group-links .nav-link .nav-icon { font-size: 0.95rem; }
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(232, 75, 61, 0.22), rgba(232, 75, 61, 0.08));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--red);
}
.nav-link.active .nav-icon { opacity: 1; color: var(--red-3); }
.sidebar-footer { padding: 0.75rem; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-footer .nav-link { color: #98a2b3; }

.main-wrap { flex: 1; min-width: 0; }
main { max-width: 1120px; margin: 0 auto; padding: 2.25rem 2.25rem 3.5rem; }
main.wide { max-width: 1440px; }

/* Móvil: barra superior con botón de menú; el menú entra desde la izquierda. */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.mobile-bar, .nav-backdrop { display: none; }

/* ---- Cabecera de página reutilizable ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0.35rem 0 0; color: var(--muted); }
.page-eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 600; color: var(--red); margin-bottom: 0.4rem;
}

/* ---- Stat tiles ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-tile {
  background: var(--white);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.stat-value { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-left: 0.2rem; }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--stroke);
  padding: 1.4rem 1.6rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 760px) { .card-row { grid-template-columns: 1fr; } }

/* ---- Transcripción de llamada / guion del asistente: texto plano con
   saltos de línea reales (system_prompt/transcript los traen), sin clase
   propia hasta ahora — se veía todo corrido en una sola línea porque el
   white-space por defecto de un <div> colapsa los saltos de línea (bug
   real visto por Carlos, 2026-09-13, en /portal/guion, pero afectaba
   igual a /llamadas/{id} y /portal/llamadas/{id}). pre-wrap conserva los
   saltos y sigue envolviendo líneas largas. */
.transcript {
  white-space: pre-wrap;
  line-height: 1.6;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", monospace;
  font-size: 0.85rem;
}

/* ---- Transcripción en burbujas: asistente (azul claro, negrita) y persona (blanca, sin negrita) ---- */
.chat { display: flex; flex-direction: column; gap: 0.6rem; max-width: 46rem; }
.chat-fila { display: flex; }
.chat-asistente { justify-content: flex-start; }
.chat-persona { justify-content: flex-end; }
.chat-burbuja {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-asistente .chat-burbuja {
  background: #e8f1fd;
  border-color: #c9ddf8;
  color: var(--navy);
  font-weight: 700;
  border-top-left-radius: 3px;
}
.chat-persona .chat-burbuja {
  background: var(--white);
  color: var(--ink-2);
  font-weight: 400;
  border-top-right-radius: 3px;
}
.chat-quien {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Selector de rango de fechas (Resumen del portal de cliente) ---- */
.range-picker { margin-bottom: 1.75rem; }
.range-picker-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.range-tab {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.range-tab:hover { border-color: var(--red); color: var(--red); }
.range-tab.active { background: var(--red); border-color: var(--red); color: var(--white); }
.range-tab input[type="date"] {
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
}

/* ---- Bar chart ---- */
.bar-chart { display: flex; align-items: flex-end; gap: 0.4rem; height: 170px; padding-top: 1.5rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar-fill {
  width: 60%;
  max-width: 26px;
  background: var(--red);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: opacity 0.15s;
}
.bar-fill.bar-fill-nonzero { min-height: 3px; }
.bar-fill:hover { opacity: 0.7; }
.bar-fill::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -6px);
  background: var(--navy);
  color: #fff;
  font-size: 0.68rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 2;
}
.bar-fill:hover::after { opacity: 1; }
.bar-label { font-size: 0.62rem; color: var(--muted); margin-top: 0.45rem; letter-spacing: 0.02em; height: 0.8rem; }

/* ---- Status breakdown ---- */
.status-breakdown { display: flex; flex-direction: column; gap: 0.65rem; }
.status-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.status-dot { width: 0.6rem; height: 0.6rem; border-radius: 999px; flex-shrink: 0; }
.status-name { width: 6.5rem; flex-shrink: 0; color: var(--ink); }
.status-bar-track { flex: 1; background: #f1f2f4; border-radius: 999px; height: 0.5rem; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 999px; min-width: 3px; }
.status-count { width: 1.5rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
  background: #fbfbfc;
  border: 1px dashed #d0d5dd;
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
}
.empty-state::before {
  content: ""; display: block; width: 2.6rem; height: 2.6rem; margin: 0 auto 0.75rem;
  border-radius: 999px; background: var(--red-soft) center / 1.2rem no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e7000b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
}

/* ---- Tables ---- */
/* Envoltorio con scroll horizontal para tablas con varias columnas — en
   escritorio no hace nada (la tabla ya cabe), pero en un móvil evita que
   una tabla ancha (p.ej. Llamadas, Facturas) rompa el ancho de la página
   entera; se puede desplazar la tabla a los lados en vez de perder columnas. */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--white); border: 1px solid var(--stroke); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid #eef0f3; font-size: 0.875rem; }
th { background: #f9fafb; font-weight: 600; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f9fafb; }
td { color: var(--ink-2); }
a.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
a.row-link:hover { color: var(--red); }

a.call-link { text-decoration: underline; text-decoration-color: transparent; transition: color 0.15s, text-decoration-color 0.15s; }
a.call-link:hover { color: var(--red); text-decoration-color: var(--red); }

.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.22rem 0.6rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.3;
  white-space: nowrap; background: rgba(119, 128, 141, 0.14); color: #4b5563;
}
.badge::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 999px; background: currentColor; opacity: 0.8; }
.badge-nuevo { background: rgba(250, 178, 25, 0.15); color: #8a5c00; }
.badge-contactado { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-descartado { background: rgba(119, 128, 141, 0.14); color: #4b5563; }
.badge-agendado { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-aplicada { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-descartada { background: rgba(119, 128, 141, 0.14); color: #4b5563; }
.badge-pendiente { background: rgba(119, 128, 141, 0.14); color: #4b5563; }
.badge-llamando { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-callback_programado { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-no_contesta { background: rgba(236, 131, 90, 0.16); color: #9a4420; }
.badge-baja { background: rgba(208, 59, 59, 0.14); color: #a52424; }
.badge-enviado { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-respondio_llamada { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-sin_interes { background: rgba(208, 59, 59, 0.14); color: #a52424; }
.badge-borrador { background: rgba(119, 128, 141, 0.14); color: #4b5563; }
.badge-enviando { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-enviada { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-abierto { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-clic { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-rebotado { background: rgba(208, 59, 59, 0.14); color: #a52424; }
.badge-fallo { background: rgba(208, 59, 59, 0.14); color: #a52424; }
.badge-entrante { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-saliente { background: rgba(147, 51, 234, 0.14); color: #6b21a8; }
.badge-atendida { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-grabadora { background: rgba(250, 178, 25, 0.15); color: #8a5c00; }
.badge-no_contestado { background: rgba(236, 131, 90, 0.16); color: #9a4420; }
.badge-rechazada { background: rgba(208, 59, 59, 0.14); color: #a52424; }
.badge-riesgo-alto { background: rgba(208, 59, 59, 0.14); color: #a52424; }
.badge-riesgo-medio { background: rgba(236, 131, 90, 0.16); color: #9a4420; }
.badge-riesgo-bajo { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-aviso { background: rgba(250, 178, 25, 0.15); color: #8a5c00; }
.badge-diagnostico_realizado { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-no_contactado { background: rgba(208, 59, 59, 0.14); color: #a52424; }
.badge-cancelado { background: rgba(119, 128, 141, 0.14); color: #4b5563; }
.badge-activa { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-pausada { background: rgba(119, 128, 141, 0.14); color: #4b5563; }
.badge-pagado { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.badge-expirado { background: rgba(119, 128, 141, 0.14); color: #4b5563; }
.badge-en-curso { background: rgba(250, 178, 25, 0.15); color: #8a5c00; }

/* ---- Barra de filtros ---- */
.filters-bar { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: flex-end; }
.filters-bar .form-field { margin-bottom: 0; flex: 1 1 150px; min-width: 130px; }
.filters-bar .form-field.grow { flex: 1.6 1 190px; }
.filters-actions { display: flex; align-items: center; gap: 0.85rem; margin-left: auto; }
.filters-count { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }

/* ---- Tabla compacta (columnas fijas, sin scroll lateral) ---- */
table.compact { table-layout: fixed; }
table.compact th, table.compact td { padding: 0.55rem 0.7rem; font-size: 0.82rem; overflow: hidden; }
table.compact td { vertical-align: top; }
.cell-stack { display: flex; flex-direction: column; gap: 0.15rem; line-height: 1.3; min-width: 0; }
.cell-primary { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-secondary { color: var(--muted); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-entry { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.call-entry .badge { padding: 0.05rem 0.4rem; font-size: 0.62rem; flex-shrink: 0; }
.cell-notes {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; cursor: help;
}
table.compact tr.filtered-out { display: none; }

/* ---- Marcador secuencial (dialer) ---- */
.dialer-status { border-left: 3px solid var(--red); }
.dialer-status-row { display: flex; align-items: center; gap: 0.85rem; }
.dialer-status-row span { color: var(--muted); font-variant-numeric: tabular-nums; }
.dialer-status-row form { margin-left: auto; }
pre.code { background: var(--navy); color: #d4d4d4; padding: 1rem; border-radius: var(--radius); overflow-x: auto; font-size: 0.8rem; }

form.login-form { background: var(--white); padding: 2rem 2rem 1.75rem; border-radius: 16px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); }
form.login-form .login-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; margin: 0 0 0.25rem; }
form.login-form .login-sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 1.4rem; }
form.login-form label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 0.35rem; }
form.login-form input { width: 100%; padding: 0.7rem 0.8rem; margin-bottom: 1rem; border: 1px solid #d0d5dd; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.95rem; }
form.login-form input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(232, 75, 61, 0.12); }
form.login-form button {
  width: 100%; padding: 0.75rem; background: var(--red); color: #fff; border: none; margin-top: 0.25rem;
  border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-weight: 600; font-size: 0.95rem;
  box-shadow: 0 8px 20px -8px rgba(232, 75, 61, 0.6); transition: background 0.15s, transform 0.15s;
}
form.login-form button:hover { background: #c50009; }
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(232, 75, 61, 0.28), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(37, 99, 235, 0.18), transparent 60%),
    var(--navy);
}
.login-box { width: 100%; max-width: 380px; }
.login-foot { text-align: center; color: #98a2b3; font-size: 0.8rem; margin-top: 1.25rem; }
.login-foot a { color: #d0d5dd; }
.login-logo { display: block; width: clamp(110px, 35vw, 160px); margin: 0 auto 1.75rem; }

/* Alta self-service (/alta, ver plan cached-sprouting-hopper.md) — mismo
   fondo/logo que login-wrap, pero más ancho: es un wizard de varios
   pasos con formularios más largos, no una caja de usuario/contraseña. */
.alta-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 1.5rem; }
.alta-box { width: 100%; max-width: 560px; }
.alta-box .card { background: var(--white); padding: 1.75rem; border-radius: var(--radius); box-shadow: var(--shadow-hover); border: 1px solid var(--stroke); margin-bottom: 1.25rem; }
.alta-box h1 { font-size: 1.25rem; margin: 0 0 0.5rem; color: var(--white); }
.alta-box .hint { color: #c7ccd6; margin-top: 0; margin-bottom: 1.25rem; }
.alta-box .card .hint { color: var(--muted); }
/* Alta de QuantumVoice (voz, Lite y prueba): fondo blanco y logo de QuantumVoice. Automail y Community Manager
   no llevan la clase y conservan el fondo oscuro de siempre. */
.alta-voz .alta-wrap { background: var(--white); }
.alta-voz .login-logo-voz { width: clamp(180px, 55vw, 280px); }
.alta-voz .alta-box h1 { color: var(--navy); }
.alta-voz .alta-box .hint { color: var(--muted); }
.alta-voz .alta-box .card { box-shadow: 0 1px 3px rgba(26, 40, 68, 0.08); }
.alta-numero-caminos { display: grid; gap: 1rem; }
@media (min-width: 480px) { .alta-numero-caminos { grid-template-columns: 1fr 1fr; } }
.alta-camino-btn {
  display: block; width: 100%; text-align: left; padding: 1rem; border: 1px solid var(--stroke);
  border-radius: var(--radius); background: var(--white); cursor: pointer; font-family: inherit;
  /* appearance: none + color explícito — sin esto, algunos navegadores en
     modo oscuro del sistema (macOS) pintan el <button> con su apariencia
     nativa de control (texto claro) ignorando que ya fijamos el fondo a
     blanco arriba, dejando el texto invisible (bug real reportado por
     Carlos, 2026-09-12). */
  appearance: none; -webkit-appearance: none; color: var(--ink);
}
.alta-camino-btn:hover { border-color: var(--red); }
.alta-camino-btn strong { display: block; margin-bottom: 0.35rem; }
.alta-codigo-desvio { font-family: "JetBrains Mono", monospace; font-size: 1.1rem; background: #f4f5f7; padding: 0.5rem 0.75rem; border-radius: 6px; display: inline-block; }

.error { color: var(--critical); margin-bottom: 1rem; font-size: 0.88rem; }
select.estado { padding: 0.3rem; border-radius: 6px; border: 1px solid var(--stroke); font-family: inherit; }
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.back-link:hover { color: var(--red); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.6rem 1.15rem; background: var(--red); color: #fff; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 0.875rem; text-decoration: none; font-family: inherit;
  font-weight: 600; line-height: 1.2;
  box-shadow: 0 1px 2px rgba(26, 40, 68, 0.08), 0 4px 12px -4px rgba(232, 75, 61, 0.45);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn:hover { background: #c50009; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:focus-visible { outline: 3px solid rgba(232, 75, 61, 0.3); outline-offset: 2px; }
.btn .icono { font-size: 1.05em; }
.btn-secondary { background: var(--white); color: var(--ink-2); border: 1px solid #d0d5dd; box-shadow: 0 1px 2px rgba(26, 40, 68, 0.05); }
.btn-secondary:hover { background: #f9fafb; color: var(--ink); border-color: #98a2b3; }
.btn-danger { background: var(--white); color: var(--critical); border: 1px solid rgba(208, 59, 59, 0.4); box-shadow: none; }
.btn-danger:hover { background: rgba(208, 59, 59, 0.06); color: #a52424; }
.upload-form { display: flex; gap: 0.75rem; align-items: center; }
.hint { color: var(--muted); font-size: 0.84rem; margin-top: 0.5rem; line-height: 1.5; }

/* Subnav de una subpágina colgando de una ficha (p.ej. ficha de cliente
   -> WhatsApp) — enlaces simples, no un componente de tabs con JS. */
.subnav { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--stroke); margin: 0 0 1.5rem; overflow-x: auto; }
.subnav-link {
  display: inline-block; padding: 0.65rem 0.85rem; color: var(--muted); text-decoration: none;
  font-size: 0.9rem; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap;
  margin-bottom: -1px;
}
.subnav-link:hover { color: var(--ink); }
.subnav-link.active { color: var(--red); border-bottom-color: var(--red); }

.wizard-progreso { margin-bottom: 1.5rem; }
.wizard-progreso-barra { display: flex; gap: 0.3rem; }
.wizard-progreso-segmento {
  flex: 1; height: 0.3rem; border-radius: 999px; background: var(--stroke);
}
.wizard-progreso-segmento.activo { background: var(--red); }
.wizard-progreso-texto {
  margin: 0.5rem 0 0; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em;
}

.wizard-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.wizard-chip {
  border: 1px solid var(--stroke); background: var(--white); color: var(--ink);
  border-radius: 999px; padding: 0.35rem 0.9rem; font-size: 0.85rem; cursor: pointer;
}
.wizard-chip:hover { border-color: var(--red); color: var(--red); }

details.wizard-avanzado { margin-top: 1rem; border-top: 1px solid var(--stroke); padding-top: 1rem; }
details.wizard-avanzado summary { cursor: pointer; font-weight: 600; color: var(--ink); }

.form-field { margin-bottom: 1rem; }
.form-field label {
  display: block; font-size: 0.84rem; font-weight: 600; color: var(--ink-2); margin-bottom: 0.4rem;
}
.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.form-field select, .form-field textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #d0d5dd; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.92rem; background: var(--white); color: var(--ink);
  box-shadow: 0 1px 2px rgba(26, 40, 68, 0.04); transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field textarea { min-height: 180px; resize: vertical; font-size: 0.88rem; line-height: 1.55; }
.form-field .hint { margin-top: 0.35rem; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(232, 75, 61, 0.12);
}
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }

.agenda-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.agenda-header h1 { margin: 0; }
.agenda-nav { display: flex; align-items: center; gap: 0.9rem; }
.agenda-nav h2 { font-size: 0.95rem; margin: 0; text-transform: capitalize; color: var(--ink); min-width: 9rem; text-align: center; }
.btn-icon {
  width: 1.9rem; height: 1.9rem; padding: 0; line-height: 1.9rem; text-align: center;
  border-radius: 999px; font-size: 1.1rem; background: var(--white); color: var(--navy);
  border: 1px solid var(--stroke); box-shadow: var(--shadow); text-transform: none;
}
.btn-icon:hover { background: #f3f4f6; color: var(--red); }
.agenda-card { background: var(--white); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; padding: 0.5rem; border: 1px solid var(--stroke); }
table.agenda-grid { width: 100%; border-collapse: separate; border-spacing: 0.35rem; table-layout: fixed; box-shadow: none; }
table.agenda-grid th {
  font-weight: 600; padding: 0.4rem; font-size: 0.7rem; text-align: center;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: transparent; border-bottom: none;
}
table.agenda-grid td { vertical-align: top; height: 6.5rem; padding: 0.4rem; font-size: 0.75rem; border-radius: 8px; background: #fbfbfd; border-bottom: none; }
td.agenda-vacio { background: transparent; }
.agenda-dia {
  font-weight: 600; color: var(--muted); font-size: 0.78rem; margin-bottom: 0.3rem;
  width: 1.4rem; height: 1.4rem; line-height: 1.4rem; text-align: center; border-radius: 999px;
}
.agenda-dia-hoy { background: var(--red); color: #fff; }
.agenda-eventos { display: flex; flex-direction: column; gap: 0.2rem; }
.agenda-cita {
  background: var(--navy); color: #fff; border-radius: 5px; padding: 0.15rem 0.4rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 0.3rem;
}
.agenda-hora { font-weight: 600; flex-shrink: 0; color: var(--red-3); }
.agenda-titulo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.agenda-cita { text-decoration: none; cursor: pointer; }
a.agenda-cita:hover { background: var(--navy-2); }

/* ---- Asistente de guion (chat), /campanas-demo ---- */
.asistente-mensajes {
  max-height: 320px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 0.5rem; margin-bottom: 0.75rem;
}
.asistente-msg {
  padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.85rem;
  white-space: pre-wrap; max-width: 85%;
}
.asistente-msg-user {
  align-self: flex-end; background: var(--navy); color: var(--white);
}
.asistente-msg-assistant {
  align-self: flex-start; background: var(--bg); border: 1px solid var(--stroke);
}
.asistente-input { display: flex; gap: 0.5rem; align-items: flex-start; }
.asistente-input textarea { flex: 1; }

/* ---- WhatsApp: burbujas de conversación ---- */
.badge-bot { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-humano { background: rgba(12, 163, 12, 0.14); color: #0a7d0a; }
.wa-thread { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.5rem; }
.wa-msg { max-width: 70%; }
.wa-msg.wa-out { align-self: flex-end; }
.wa-meta { font-size: 0.68rem; color: var(--muted); margin-bottom: 0.2rem; }
.wa-msg.wa-out .wa-meta { text-align: right; }
.wa-bubble {
  background: var(--white);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  box-shadow: var(--shadow);
  white-space: pre-wrap;
}
.wa-msg.wa-out .wa-bubble { background: rgba(37, 99, 235, 0.08); }
.wa-bubble.wa-tool { color: var(--muted); font-size: 0.78rem; font-style: italic; }

/* ---- Móvil: el menú lateral pasa a ser un cajón con barra superior ---- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 30;
    padding: 0.65rem 1rem; background: var(--navy);
    box-shadow: 0 4px 16px rgba(26, 40, 68, 0.2);
  }
  .mobile-bar-logo { height: 30px; width: auto; }
  .mobile-bar-btn, .sidebar-close {
    display: grid; place-items: center; width: 2.4rem; height: 2.4rem;
    border-radius: 10px; color: #fff; font-size: 1.3rem; cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
  }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; height: 100%;
    width: min(86vw, 300px);
    transform: translateX(-100%); transition: transform 0.25s ease, box-shadow 0.25s ease;
    visibility: hidden;
  }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 40;
    background: rgba(10, 15, 26, 0.55); opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .nav-toggle:checked ~ .sidebar { transform: none; visibility: visible; box-shadow: 12px 0 32px rgba(0, 0, 0, 0.35); }
  .nav-toggle:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }
  main { padding: 1.25rem 1rem 2rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Calendario mensual (/agenda, /portal/agenda): con table-layout:fixed
     y width:100%, envolverlo en .table-wrap no serviría de nada por sí
     solo (la tabla se limita a encoger al ancho de pantalla, no aparece
     scroll). Se le fija un ancho mínimo para que cada día conserve un
     tamaño usable — el resto se recorre con scroll horizontal, en vez de
     que el nombre de cada cita quede ilegible en columnas de ~45px. */
  table.agenda-grid { min-width: 620px; }
  table.agenda-grid td { height: 5rem; padding: 0.3rem; }

  /* Burbujas de chat (WhatsApp, asistente de guion): el 70/85% máximo
     pensado para pantallas de escritorio deja muy poco ancho útil en un
     móvil estrecho — se ensanchan para aprovechar casi todo el hueco. */
  .wa-msg, .asistente-msg { max-width: 92%; }
}

/* ---- Portal del cliente: tarjetas de precio (elegir/cambiar de plan) ---- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 260px));
  justify-content: center;
  gap: 1.1rem;
  max-width: 640px;
  margin: 1rem auto 1.5rem;
}
.pricing-card {
  position: relative;
  display: block;
  background: var(--white);
  border: 2px solid var(--stroke);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  opacity: 0;
  transform: translateY(14px);
  animation: pricing-card-in 0.45s ease forwards;
}
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--red-3); }
.pricing-card input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pricing-card:has(input:checked) {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(232, 75, 61, 0.14), var(--shadow-hover);
}
.pricing-card-eyebrow { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--red); margin-bottom: 0.5rem; }
.pricing-card-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; }
.pricing-card-price { font-size: 1.75rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.pricing-card-price .unit { font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: none; }
.pricing-card-minutes { font-size: 0.75rem; color: var(--muted); margin: 0.35rem 0 1rem; }
.pricing-card-features { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; color: var(--ink); }
.pricing-card-features li { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.5rem; line-height: 1.3; }
.pricing-card-features li::before {
  content: "";
  flex-shrink: 0;
  width: 14px; height: 14px; margin-top: 0.15rem;
  background: var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M16.7 5.3a1 1 0 010 1.4l-7.5 7.5a1 1 0 01-1.4 0l-3.5-3.5a1 1 0 111.4-1.4l2.8 2.8 6.8-6.8a1 1 0 011.4 0z' clip-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M16.7 5.3a1 1 0 010 1.4l-7.5 7.5a1 1 0 01-1.4 0l-3.5-3.5a1 1 0 111.4-1.4l2.8 2.8 6.8-6.8a1 1 0 011.4 0z' clip-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pricing-card-ribbon {
  position: absolute; top: -11px; right: 16px;
  background: var(--red); color: var(--white);
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.28rem 0.65rem; border-radius: 999px;
  box-shadow: var(--shadow);
}
.pricing-card-current {
  position: absolute; top: -11px; left: 16px;
  background: var(--good); color: var(--white);
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.28rem 0.65rem; border-radius: 999px;
  box-shadow: var(--shadow);
}
@keyframes pricing-card-in { to { opacity: 1; transform: translateY(0); } }

/* ---- Portal del cliente: tarjeta "tu plan" (hero) ---- */
.plan-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: var(--white);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-hover);
}
.plan-hero::after {
  content: "";
  position: absolute; right: -50px; top: -60px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(232, 75, 61, 0.4), transparent 70%);
}
.plan-hero-label { position: relative; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: #b8c0cc; margin-bottom: 0.4rem; }
.plan-hero-name { position: relative; font-size: 1.6rem; font-weight: 700; margin-bottom: 0.3rem; }
.plan-hero-detail { position: relative; font-size: 0.85rem; color: #cfd5de; }

/* ---- Portal del cliente: extras recurrentes como tarjetas con toggle ---- */
.addon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.addon-card {
  background: var(--white);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 0.85rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.addon-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.addon-card-body { flex: 1; min-width: 0; }
.addon-card-name { font-weight: 600; font-size: 0.85rem; }
.addon-card-price { font-size: 0.72rem; color: var(--muted); }
.addon-card-desc { font-size: 0.72rem; color: var(--muted); margin-top: 0.3rem; line-height: 1.35; }
.addon-card-checkbox { flex-shrink: 0; }
/* La tarjeta de un extra con wizard (Adenda de Activación) lleva más texto
   variable (badge de estado, hint de "requiere número propio"...) que una
   tarjeta ligera de toggle — en fila, ese texto forzaba el ancho de
   .addon-card-wizard-action (flex-shrink:0, sin límite) y aplastaba
   .addon-card-body hasta partir el nombre/descripción palabra por palabra
   (bug real visto por Carlos, 2026-09-13). En columna, cuerpo y acción
   usan siempre el ancho completo de la tarjeta, sin competir por espacio. */
.addon-card-wizard { flex-direction: column; align-items: stretch; }
.addon-card-wizard-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
  padding-top: 0.85rem; margin-top: 0.85rem; border-top: 1px solid var(--stroke);
}
.addon-card-wizard-action .btn, .addon-card-wizard-action .btn-secondary {
  padding: 0.4rem 0.8rem; font-size: 0.68rem;
}
.addon-card-wizard-action .hint { margin: 0; }
.addon-card.addon-card-bloqueado { opacity: 0.55; }
.addon-card.addon-card-bloqueado:hover { transform: none; box-shadow: var(--shadow); }

/* Recuadros de "Extras opcionales" agrupados por familia (Correo IA, Redes
   sociales IA, Telefonía, Mensajería) — sin esto, todos los extras se veían
   en una sola rejilla plana, sin separación visual por tipo. */
.addon-grupo { background: var(--bg-soft, #f7f7f9); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.addon-grupo-titulo { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.8rem; margin-bottom: 0.75rem; }
.addon-grupo .addon-grid { margin: 0; }

/* ---- Portal del cliente: grid de tarjetas de voz (identidad del asistente) ---- */
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; margin: 0.5rem 0 1rem; }
.voice-card {
  position: relative;
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--white);
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.voice-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.voice-card:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.voice-card.selected {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(232, 75, 61, 0.14), var(--shadow-hover);
}
.voice-card-play {
  flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--bg);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.voice-card-play:hover:not(:disabled) { background: var(--red); color: var(--white); border-color: var(--red); }
.voice-card-play:disabled { opacity: 0.35; cursor: not-allowed; }
.voice-card-langs { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.voice-subgrupo-titulo { margin: 0.9rem 0 0.2rem; font-weight: 600; font-size: 0.85rem; }
.voice-subgrupo-titulo .hint { font-weight: 400; margin-left: 0.4rem; }
.voice-card-lang {
  margin-top: 0.15rem; padding: 0.1rem 0.45rem; font-size: 0.7rem; line-height: 1.4;
  border: 1px solid var(--stroke); border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer; align-self: flex-start;
}
.voice-card-lang:hover { background: var(--red); color: var(--white); border-color: var(--red); }
.voice-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.voice-card-name { font-weight: 600; font-size: 0.85rem; }
.voice-card-gender { font-size: 0.72rem; color: var(--muted); text-transform: capitalize; }
.voice-card-check {
  flex-shrink: 0; opacity: 0; color: var(--red); font-weight: 700; font-size: 1rem;
  transition: opacity 0.15s ease;
}
.voice-card.selected .voice-card-check { opacity: 1; }
.voice-legal-notice { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--stroke); line-height: 1.4; }

/* Interruptor (checkbox real oculto + <span> estilado a su lado) */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; background: var(--stroke); border-radius: 999px;
  transition: background 0.2s ease; pointer-events: none;
}
.switch-track::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--white); border-radius: 50%; transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(26, 40, 68, 0.25);
}
.switch input:checked + .switch-track { background: var(--good); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }

/* ---- Portal del cliente: aviso flash con animación de entrada ---- */
.flash-in { animation: flash-in 0.3s ease; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Aviso crítico destacado — NUNCA usar `.hint` para esto: `.hint`
   es texto pequeño y apagado a propósito para notas secundarias, y hay
   avisos (p.ej. "no canceles el desvío todavía" en la migración a número
   dedicado) que tienen que verse aunque el usuario solo pase el ojo por
   la página. Variante `.bien` para el mismo tipo de aviso cuando la
   noticia es buena (número ya activo) — mismo tratamiento visual, otro
   color, ver `--warning`/`--good` en :root. ---- */
.aviso-critico {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(250, 178, 25, 0.12);
  border: 1px solid var(--warning);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.aviso-critico strong { color: #8a5c00; }
.aviso-critico.bien { background: rgba(12, 163, 12, 0.08); border-color: var(--good); }
.aviso-critico.bien strong { color: #0a7d0a; }
.aviso-critico-icono { flex-shrink: 0; font-size: 1.25rem; line-height: 1.3; }
.aviso-critico p { margin: 0 0 0.35rem; }
.aviso-critico p:last-child { margin-bottom: 0; }

/* ---- Wizards del portal: cabecera con icono + caja de explicación
   neutra ("qué va a pasar y por qué"), pensada para clientes sin
   experiencia técnica. No sustituye a `.aviso-critico` (reservado para lo
   que nunca se puede pasar por alto, p.ej. "no canceles el desvío
   todavía") ni a `.pasos-explicacion` (lista numerada de fases): es un
   tercer nivel, más suave, para una nota corta de contexto antes de un
   paso o formulario concreto. ---- */
.titulo-con-icono { display: flex; align-items: center; gap: 0.6rem; }
.titulo-con-icono .icono { font-size: 1.35rem; line-height: 1; flex-shrink: 0; }

.explicacion-paso {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-left: 4px solid var(--info);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  line-height: 1.55;
}
.explicacion-paso-icono { flex-shrink: 0; font-size: 1.15rem; line-height: 1.3; }
.explicacion-paso p { margin: 0 0 0.35rem; }
.explicacion-paso p:last-child { margin-bottom: 0; }
.explicacion-paso strong { color: var(--navy); }

/* ---- Grid de voces del portal: cuando hay más de un tier en el
   catálogo del cliente (p.ej. plan Plus/Full ve "básico" + "plus"), se
   agrupan bajo un título corto en vez de una única cuadrícula plana —
   ver portal_identidad.html. ---- */
.voice-grupo-titulo {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 1.5rem 0 0;
}
.voice-grupo-titulo:first-child { margin-top: 0; }

/* ---- Pasos de explicación previa (migración a número dedicado, tarea
   B10) — lista numerada dentro de una card, sin componente nuevo más
   allá de tipografía/espaciado. ---- */
.pasos-explicacion { list-style: none; margin: 0; padding: 0; counter-reset: paso; }
.pasos-explicacion li {
  counter-increment: paso;
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--stroke);
}
.pasos-explicacion li:last-child { border-bottom: none; }
.pasos-explicacion li::before {
  content: counter(paso);
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Servicios y saldo (resumen) ---- */
.icono { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }
.svc-panel { margin-bottom: 1.5rem; }
.svc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.1rem; }
.svc-resumen { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.svc-resumen-item { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.74rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 999px; }
.svc-refrescar { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--muted); text-decoration: none; border: 1px solid var(--stroke); border-radius: 999px; padding: 0.35rem 0.75rem; transition: color .15s, border-color .15s; }
.svc-refrescar:hover { color: var(--ink); border-color: var(--ink); }
.svc-refrescar:hover .icono { transform: rotate(180deg); }
.svc-refrescar .icono { transition: transform .4s; }

/* Tonos de estado (pastillas, resumen) */
.svc-tono-ok { background: rgba(12, 163, 12, 0.12); color: #0a7d0a; }
.svc-tono-aviso { background: rgba(250, 178, 25, 0.18); color: #8a5c00; }
.svc-tono-error { background: rgba(208, 59, 59, 0.13); color: #a52424; }
.svc-tono-sin_configurar { background: rgba(119, 128, 141, 0.14); color: #4b5563; }

.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.svc {
  --acento: var(--muted);
  position: relative; display: flex; flex-direction: column; gap: 0.9rem; min-width: 0;
  background: var(--white); border: 1px solid var(--stroke); border-radius: 14px; padding: 1rem 1.1rem 0.9rem;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; overflow: hidden;
}
.svc::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--acento); }
.svc:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.svc-twilio { --acento: #e84b3d; }
.svc-elevenlabs { --acento: #1a2844; }
.svc-anthropic { --acento: #c2410c; }
.svc-deepgram { --acento: #0f9488; }
.svc-resend { --acento: #2563eb; }
.svc-stripe { --acento: #6d28d9; }
.svc-buffer { --acento: #db2777; }
.svc-estado-aviso { border-color: rgba(250, 178, 25, 0.6); }
.svc-estado-error { border-color: rgba(208, 59, 59, 0.5); }

.svc-top { display: flex; align-items: center; gap: 0.7rem; }
.svc-logo {
  width: 2.5rem; height: 2.5rem; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  color: var(--acento); background: color-mix(in srgb, var(--acento) 11%, transparent); font-size: 1.2rem;
}
.svc-titulo { flex: 1; min-width: 0; }
.svc-nombre { font-weight: 700; color: var(--ink); line-height: 1.2; }
.svc-plan { font-size: 0.76rem; color: var(--muted); margin-top: 0.1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.svc-manual { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; border: 1px dashed var(--muted); border-radius: 4px; padding: 0 0.3rem; }
.svc-pill { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.25rem 0.55rem; border-radius: 999px; white-space: nowrap; align-self: flex-start; }

.svc-hero { display: flex; align-items: center; gap: 0.9rem; padding: 0.85rem; border-radius: 12px; background: #f6f7f9; }
.svc-hero-icono { width: 2.6rem; height: 2.6rem; border-radius: 999px; display: grid; place-items: center; background: var(--white); color: var(--acento); font-size: 1.25rem; box-shadow: var(--shadow); flex-shrink: 0; }
.svc-estado-sin_configurar .svc-hero-icono, .svc-estado-error .svc-hero-icono { color: var(--muted); }
.svc-hero-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.svc-hero-valor { font-size: 1.5rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.svc-hero-valor.svc-negativo { color: var(--critical); }
.svc-moneda { font-size: 0.72rem; font-weight: 600; color: var(--muted); margin-left: 0.3rem; }
.svc-hero-sub { font-size: 0.74rem; color: var(--muted); margin-top: 0.1rem; }
.svc-anillo { width: 4.2rem; height: 4.2rem; flex-shrink: 0; }
.svc-anillo circle { fill: none; stroke-width: 8; }
.svc-anillo-fondo { stroke: #e6e8ec; }
.svc-anillo-valor { stroke: var(--good); stroke-linecap: round; }
.svc-estado-aviso .svc-anillo-valor { stroke: var(--warning); }
.svc-estado-error .svc-anillo-valor { stroke: var(--critical); }
.svc-anillo text { font-size: 15px; font-weight: 700; fill: var(--ink); font-family: inherit; }

.svc-filas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.svc-filas li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.55rem; font-size: 0.82rem; padding: 0.45rem 0; border-top: 1px dashed var(--stroke); }
.svc-filas li:first-child { border-top: 0; padding-top: 0; }
.svc-fila-icono { color: var(--acento); display: inline-flex; }
.svc-fila-etiqueta { color: var(--muted); flex: 1; white-space: nowrap; }
.svc-fila-valor { font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }
.svc-fila-valor .svc-moneda { margin-left: 0.2rem; }
.svc-dias { display: inline-block; margin-left: 0.3rem; font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 999px; color: var(--acento); background: color-mix(in srgb, var(--acento) 10%, transparent); }

.svc-notas p { display: flex; gap: 0.4rem; margin: 0 0 0.3rem; font-size: 0.74rem; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.svc-notas .icono { margin-top: 0.15rem; }
.svc-estado-aviso .svc-notas .icono { color: #b07d00; }
.svc-estado-error .svc-notas .icono { color: var(--critical); }
.svc-enlace { margin-top: auto; display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; font-weight: 600; color: var(--acento); text-decoration: none; align-self: flex-start; }
.svc-enlace:hover { text-decoration: underline; }

/* ---- KPIs de la portada (resumen) ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi {
  --acento: var(--navy);
  position: relative; display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; overflow: hidden;
  background: var(--white); border: 1px solid var(--stroke); border-radius: 14px; padding: 1rem 1.1rem;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kpi::after { content: ""; position: absolute; right: -1.6rem; top: -1.6rem; width: 5.5rem; height: 5.5rem; border-radius: 999px; background: color-mix(in srgb, var(--acento) 7%, transparent); pointer-events: none; }
.kpi-live { --acento: #0ca30c; }
.kpi-mes { --acento: #e84b3d; }
.kpi-total { --acento: #1a2844; }
.kpi-duracion { --acento: #0f9488; }
.kpi-leads { --acento: #2563eb; }
.kpi-citas { --acento: #6d28d9; }
.kpi-coste { --acento: #c2410c; }
.kpi-minuto { --acento: #a16207; }

.kpi-top { display: flex; align-items: center; gap: 0.55rem; }
.kpi-icono { width: 2.1rem; height: 2.1rem; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 1.05rem; color: var(--acento); background: color-mix(in srgb, var(--acento) 11%, transparent); }
.kpi-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); flex: 1; min-width: 0; }
.kpi-valor { font-size: 1.85rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 0.25rem; }
.kpi-unidad { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-left: 0.3rem; }
.kpi-sub { font-size: 0.76rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; }
.kpi-sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-direcciones span { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-direcciones span:first-child .icono { color: var(--good); }
.kpi-direcciones span:last-child .icono { color: var(--info); }
.kpi-chip { font-size: 0.68rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; color: #0a7d0a; background: rgba(12, 163, 12, 0.12); }
.kpi-falta { color: #a52424; }

/* Punto "en vivo" */
.kpi-pulso { width: 0.6rem; height: 0.6rem; border-radius: 999px; background: #c4c9d1; flex-shrink: 0; }
.kpi-live-activa .kpi-pulso { background: var(--good); animation: kpi-pulso 1.6s ease-out infinite; }
@keyframes kpi-pulso {
  0% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.55); }
  100% { box-shadow: 0 0 0 0.6rem rgba(12, 163, 12, 0); }
}
@media (prefers-reduced-motion: reduce) { .kpi-live-activa .kpi-pulso { animation: none; } }

/* Reparto del coste */
.kpi-barra { display: flex; height: 0.55rem; border-radius: 999px; overflow: hidden; background: #eceef1; gap: 2px; margin-top: 0.3rem; }
.kpi-seg { height: 100%; min-width: 3px; }
.kpi-seg-twilio { background: #e84b3d; }
.kpi-seg-elevenlabs { background: #1a2844; }
.kpi-seg-anthropic { background: #c2410c; }
.kpi-seg-deepgram { background: #0f9488; }
.kpi-leyenda { list-style: none; margin: 0.2rem 0 0.1rem; padding: 0; display: grid; grid-template-columns: 1fr; gap: 0.15rem; font-size: 0.76rem; color: var(--muted); }
.kpi-leyenda li { display: flex; align-items: center; gap: 0.35rem; }
.kpi-leyenda b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-punto { width: 0.55rem; height: 0.55rem; border-radius: 3px; flex-shrink: 0; }

/* ---- Campos fuera de .form-field (formularios antiguos): mismo aspecto ---- */
main input[type="text"], main input[type="email"], main input[type="password"], main input[type="tel"],
main input[type="number"], main input[type="date"], main input[type="time"], main input[type="url"],
main select, main textarea {
  font-family: inherit; font-size: 0.9rem; color: var(--ink);
  padding: 0.5rem 0.7rem; border: 1px solid #d0d5dd; border-radius: var(--radius-sm); background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
main input:focus, main select:focus, main textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(232, 75, 61, 0.12);
}
main input[type="checkbox"], main input[type="radio"] { accent-color: var(--red); width: 1rem; height: 1rem; }
main label { font-size: 0.9rem; }
main ul, main ol { line-height: 1.6; }
.success {
  color: #0a7d0a; background: rgba(12, 163, 12, 0.08); border: 1px solid rgba(12, 163, 12, 0.3);
  border-radius: var(--radius-sm); padding: 0.6rem 0.85rem; font-size: 0.9rem;
}
.error {
  color: #a52424; background: rgba(208, 59, 59, 0.07); border: 1px solid rgba(208, 59, 59, 0.3);
  border-radius: var(--radius-sm); padding: 0.6rem 0.85rem;
}

/* ---- Portada del portal: accesos rápidos, extras, rango, medidor ---- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.85rem; margin-bottom: 1.75rem; }
.quick-card {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.95rem 1rem;
  background: var(--white); border: 1px solid var(--stroke); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: rgba(232, 75, 61, 0.3); }
.quick-icon {
  width: 2.5rem; height: 2.5rem; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--red-soft); color: var(--red); font-size: 1.15rem;
}
.quick-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.quick-text strong { font-size: 0.92rem; }
.quick-text small { font-size: 0.78rem; color: var(--muted); }
.quick-arrow { color: #98a2b3; transition: transform 0.15s, color 0.15s; }
.quick-card:hover .quick-arrow { transform: translateX(3px); color: var(--red); }

.addon-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.addon-panel {
  display: flex; flex-direction: column; gap: 0.85rem; align-items: flex-start;
  background: var(--white); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.addon-panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--red), var(--red-2)); }
.addon-panel-head { display: flex; align-items: center; gap: 0.8rem; }
.addon-panel-head h2 { margin: 0; font-size: 1rem; }
.addon-panel-head small { color: var(--muted); font-size: 0.8rem; }
.addon-panel-icon { width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 1.2rem; flex-shrink: 0; }
.addon-panel-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; width: 100%; }
.addon-panel-items li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); background: #f9fafb; }
.addon-panel-items li > .icono { color: var(--muted); }
.addon-panel-items a { color: var(--ink); text-decoration: none; }
.addon-panel-items a strong { color: var(--red); }
.addon-panel-items a:hover { text-decoration: underline; }
.addon-panel .hint { margin: 0; }

.welcome-card { display: flex; gap: 1.1rem; align-items: flex-start; }
.welcome-card h2 { margin: 0 0 0.4rem; }
.welcome-icon { width: 3rem; height: 3rem; border-radius: 14px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-size: 1.4rem; flex-shrink: 0; }

.range-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.25rem; }
.range-custom {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.35rem 0.8rem; border: 1px solid var(--stroke); border-radius: 999px; background: var(--white);
  color: var(--muted); font-size: 0.85rem;
}
.range-custom.active { border-color: var(--red); }
.range-custom input[type="date"] { padding: 0.3rem 0.5rem; font-size: 0.85rem; border-radius: 999px; }
.range-custom .btn { padding: 0.4rem 0.85rem; border-radius: 999px; font-size: 0.8rem; }
.range-tab { background: var(--white); }

.meter { height: 0.45rem; border-radius: 999px; background: #eceef1; overflow: hidden; margin-top: 0.35rem; }
.meter span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #111827, #475467); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.card-head h2 { margin: 0; display: inline-flex; align-items: center; gap: 0.5rem; }
.card-head h2 .icono { color: var(--red); }
.card-head-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--red); text-decoration: none; }
.card-head-link:hover { text-decoration: underline; }

.kpi-label { text-transform: none; letter-spacing: 0; font-size: 0.82rem; font-weight: 500; }
.kpi-valor { font-family: var(--font-mono); }
.kpi-sub a { color: var(--red); font-weight: 600; text-decoration: none; }

/* ---- Fichas: cabecera con avatar, datos en cuadrícula, mini cifras ---- */
.page-head-id { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.page-head-id p { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.88rem; }
.avatar-lg { width: 3.2rem; height: 3.2rem; border-radius: 14px; font-size: 1.1rem; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.6rem 1.5rem; margin: 0 0 1.25rem; }
.info-item { padding: 0.6rem 0; border-bottom: 1px dashed var(--stroke); min-width: 0; }
.info-item dt { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 0.2rem; }
.info-item dt .icono { color: var(--red); }
.info-item dd { margin: 0; font-size: 0.92rem; color: var(--ink); overflow-wrap: anywhere; }
.info-item dd .hint { display: block; margin: 0.15rem 0 0; font-size: 0.76rem; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.75rem; }
.mini-stats > div { background: #f9fafb; border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.2rem; }
.mini-stats span { font-size: 0.78rem; color: var(--muted); }
.mini-stats strong { font-family: var(--font-mono); font-size: 1.3rem; }
.mini-stats .mini-stat-good strong { color: #0a7d0a; }
.mini-stats .mini-stat-bad strong { color: var(--critical); }
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; }
.hint .icono { vertical-align: -0.15em; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 600px) {
  .quick-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .quick-card { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.85rem; }
  .quick-text small, .quick-arrow { display: none; }
  .range-custom { border-radius: var(--radius); }
  .page-head-id { align-items: flex-start; }
}

/* Controles de voz del admin (panel/templates/_ajustes_voz.html, static/ajustes_voz.js) */
.ajustes-voz .ajuste input[type="range"] { width: 100%; accent-color: var(--red); }
.ajustes-voz .ajuste output { font-variant-numeric: tabular-nums; color: var(--red); font-weight: 600; }
.ajustes-voz .ajuste .no-aplica-texto { display: none; }
.ajustes-voz .ajuste.no-aplica { opacity: 0.5; }
.ajustes-voz .ajuste.no-aplica .no-aplica-texto { display: inline; color: var(--red); font-weight: 600; }
.ajustes-voz .atajos-frases { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.ajustes-voz .atajo-frase {
  border: 1px solid var(--stroke); background: var(--white); color: var(--ink-2);
  border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.82rem; cursor: pointer;
}
.ajustes-voz .atajo-frase:hover { border-color: var(--red); color: var(--red); }
.ajustes-voz .acciones-voz { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0.5rem 0; }
.ajustes-voz .auto-probar { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--ink-2); }
.ajustes-voz .estado-error { color: var(--red); font-weight: 600; }
.ajustes-voz audio { height: 36px; max-width: 100%; }
.card-voz { margin-bottom: 1rem; }

/* ---- Estadísticas de contenido de las llamadas (portal) ---- */
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin: 1.25rem 0; }
.insight-grid h3, .card h3 { font-size: 0.9rem; margin: 1rem 0 0.5rem; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 3rem; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; font-size: 0.85rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { background: var(--stroke); border-radius: 999px; height: 0.55rem; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--navy); border-radius: 999px; min-width: 3px; }
.hbar-fill.hbar-neg { background: var(--red); }
.hbar-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.insight-list { margin: 0 0 0.5rem; padding-left: 1.1rem; font-size: 0.88rem; }
.insight-list li { margin-bottom: 0.3rem; }

.gap-row { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; align-items: flex-start; padding: 0.75rem 0; border-top: 1px solid var(--stroke); }
.gap-main { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 260px; min-width: 0; }
.gap-meta { font-size: 0.82rem; color: var(--muted); }
.gap-up { color: var(--red); margin-left: 0.4rem; }
.gap-down { color: var(--navy); margin-left: 0.4rem; }
.gap-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* ---- Finanzas y auditoría (panel interno) ---- */
.fz-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1.2rem; }
.fz-toolbar select, .fz-toolbar input { padding: .45rem .6rem; border: 1px solid var(--stroke); border-radius: 8px; font: inherit; background: var(--white); }
.fz-seg { display: inline-flex; border: 1px solid var(--stroke); border-radius: 8px; overflow: hidden; background: var(--white); }
.fz-seg a { padding: .42rem .8rem; font-size: .84rem; color: var(--ink-2); text-decoration: none; }
.fz-seg a.on { background: var(--navy); color: #fff; }
.fz-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.fz-kpi { background: var(--white); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 1rem 1.15rem; }
.fz-kpi .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fz-kpi .val { font-size: 1.65rem; font-weight: 700; color: var(--ink); margin: .15rem 0; font-variant-numeric: tabular-nums; }
.fz-kpi .sub { font-size: .8rem; color: var(--muted); }
.fz-delta { display: inline-block; font-size: .75rem; font-weight: 600; padding: .05rem .4rem; border-radius: 999px; margin-left: .35rem; }
.fz-delta.up { background: rgba(12,163,12,.12); color: #0a7d0a; }
.fz-delta.down { background: rgba(208,59,59,.12); color: #a52424; }
.fz-delta.flat { background: #eef0f3; color: var(--muted); }
.fz-neg { color: var(--critical) !important; }
.fz-pos { color: var(--good) !important; }
.fz-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.fz-grid2 .card, .fz-card { margin-bottom: 0; }
.fz-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.fz-card-head h3 { margin: 0 0 .2rem; }
.fz-card-head .hint { margin: 0; }
.fz-chart { width: 100%; height: auto; display: block; }
.fz-grid { stroke: #eef0f3; stroke-width: 1; }
.fz-axis { fill: var(--muted); font-size: 11px; font-family: var(--font-sans); }
.fz-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--ink-2); margin-top: .5rem; }
.fz-legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.fz-donut-row { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.fz-donut { width: 170px; height: 170px; flex: none; }
.fz-donut-centro { font-size: 17px; font-weight: 700; fill: var(--ink); }
.fz-rows { flex: 1; min-width: 180px; font-size: .86rem; }
.fz-rows div { display: flex; justify-content: space-between; gap: .8rem; padding: .28rem 0; border-bottom: 1px solid #f1f3f6; }
.fz-rows i { display: inline-block; width: .65rem; height: .65rem; border-radius: 3px; margin-right: .4rem; }
.fz-note { background: #fff8e6; border: 1px solid #f5d98a; border-radius: 10px; padding: .65rem 1rem; font-size: .85rem; margin-bottom: 1.2rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.fz-audit-code { font-family: var(--font-mono, ui-monospace, monospace); font-size: .8rem; }
.fz-res { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.fz-res.ok { background: rgba(12,163,12,.12); color: #0a7d0a; }
.fz-res.error { background: rgba(250,178,25,.18); color: #8a5c00; }
.fz-res.denegado { background: rgba(208,59,59,.12); color: #a52424; }
.fz-canal { font-size: .76rem; color: var(--ink-2); background: #eef0f3; border-radius: 6px; padding: .08rem .45rem; }
tr.fz-click { cursor: pointer; }
tr.fz-click:hover td { background: #f9fafb; }
tr.fz-detalle td { background: #f9fafb; font-size: .82rem; color: var(--ink-2); }
tr.fz-detalle dl { display: grid; grid-template-columns: 110px 1fr; gap: .25rem .8rem; margin: 0; }
tr.fz-detalle dt { color: var(--muted); }
tr.fz-detalle dd { margin: 0; word-break: break-all; }
