:root {
  /* Marca Ryng — verde teal #08956a del logo oficial */
  --brand-50:  #E6F6F0;
  --brand-100: #CCECDF;
  --brand-200: #99D9BF;
  --brand-300: #66C5A0;
  --brand-400: #33B280;
  --brand-500: #0AA572;
  --brand-600: #08956A;   /* color exacto del logo */
  --brand-700: #077A58;
  --brand-800: #056044;
  --brand-900: #044431;

  /* Accent sutil del logo (R translúcida). Usar solo en elementos muy puntuales. */
  --accent-purple: #903A8A;
  --accent-purple-soft: rgba(144, 58, 138, 0.26);

  /* Neutros con tinte verde muy sutil (coherente con el logo) */
  --bg:            #F2F6F4;
  --surface:       #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.72);  /* para cards/sidebar/topbar — deja ver el watermark */
  --surface-2:     #ECF1EE;
  --border:        #DDE5E0;
  --border-strong: #C8D2CB;
  --text:          #18181B;
  --text-muted:    #6B6B76;
  --text-subtle:   #A1A1AA;

  /* Semánticos */
  --success: #16A34A;
  --warning: #D97706;
  --danger:  #DC2626;
  --info:    #2563EB;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-pop: 0 4px 12px rgba(16,16,22,0.08), 0 1px 3px rgba(16,16,22,0.06);

  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
/* El fondo decorativo (halo/rejilla/franja) lo aplica themes.css vía --deco. */
body > * { position: relative; z-index: 1; }

/* Layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
}
/* Logo: alineado horizontalmente con los íconos de los nav items.
   .sidebar padding es 16px 12px; los nav items agregan padding 8px 10px.
   Para que el borde izquierdo del logo coincida con el ícono del nav,
   .logo add 10px de padding-left. Verticalmente: 8px arriba (sumado al 16 del sidebar = 24),
   20px abajo antes de la primera sección "OPERACIÓN". */
.sidebar .logo {
  padding: 8px 10px 20px;
  display: block;
}
.sidebar .logo .brand-logo { display: block; width: auto; }
.nav { display: flex; flex-direction: column; gap: 14px; flex: 1; overflow-y: auto; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section-title {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-sm);
}
.nav-section-title:hover { color: var(--text-muted); }
.nav-section-title::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-right: 2px;
  transition: transform 0.15s;
}
.nav-section.collapsed .nav-section-title::after { transform: rotate(-45deg); }
.nav-section-items { display: flex; flex-direction: column; gap: 2px; overflow: hidden; max-height: 1000px; transition: max-height 0.2s ease; }
.nav-section.collapsed .nav-section-items { max-height: 0; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: background 0.1s, color 0.1s;
}
.nav a .nav-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  transition: color 0.1s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a:hover .nav-icon { color: var(--text); }
.nav a.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav a.active .nav-icon { color: var(--brand-600); }
.sidebar .foot {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-subtle);
}
.sidebar .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 10px;
}
.sidebar .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar .user-meta { display: flex; flex-direction: column; min-width: 0; }
.sidebar .user-name {
  color: var(--sidebar-fg);
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar .user-role {
  color: var(--sidebar-fg);
  opacity: 0.7;
  font-size: 11px;
  text-transform: lowercase;
}
.sidebar .logout {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--sidebar-fg) 25%, transparent);
  color: var(--sidebar-fg);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
  width: 100%;
  text-align: left;
}
.sidebar .logout:hover { border-color: color-mix(in srgb, var(--sidebar-fg) 45%, transparent); }

.main { padding: 0; overflow-y: auto; display: flex; flex-direction: column; }
.main > #main { padding: 20px 32px 32px; flex: 1; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  gap: 16px;
}
.topbar-greet {
  color: var(--text-muted);
  font-size: 14px;
}
.topbar-greet strong {
  color: var(--text);
  font-weight: 600;
}
.topbar-time {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.topbar-time .muted { color: var(--text-subtle); text-transform: capitalize; }
.topbar-time .mono { font-family: ui-monospace, SFMono-Regular, monospace; color: var(--text); }

/* Avatar reutilizable para listas (ej. Supervisor) */
.row-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  margin-right: 8px;
  vertical-align: middle;
}

/* Encabezado de vista */
.view-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }
.view-title { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.view-sub { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }

/* Cards / KPIs */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1200px) { .grid-5, .grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.kpi { padding: 14px 16px; }
.kpi-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; text-transform: none; }
.kpi-value { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.kpi-dot { display: inline-block; width: 6px; height: 6px; border-radius: 999px; margin-right: 6px; vertical-align: middle; }
.kpi-dot.ok { background: var(--success); }
.kpi-dot.warn { background: var(--warning); }
.kpi-dot.danger { background: var(--danger); }
.kpi-dot.muted { background: var(--text-subtle); }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s;
}
.btn:hover { border-color: var(--border-strong); }
.btn.primary { background: var(--brand-600); border-color: var(--brand-600); color: white; }
.btn.primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn.ghost { border: none; background: transparent; color: var(--text-muted); padding: 4px 8px; }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.ghost.danger { color: var(--bad, var(--danger)); background: transparent; border: none; }
.btn.ghost.danger:hover { background: color-mix(in srgb, var(--bad, var(--danger)) 10%, transparent); color: var(--bad, var(--danger)); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Enlaces usados como control (botón, pestaña, segmentado, item de nav/card)
   nunca llevan subrayado — ni en hover ni visited. */
.btn, .tab, .seg-opt, .card-link, .nav a, .quick-item, .report-card,
a.btn, a.tab, a.seg-opt, a.card-link, a.quick-item, a.report-card,
.btn:hover, .tab:hover, .seg-opt:hover, .card-link:hover,
a.btn:hover, a.tab:hover, a.seg-opt:hover, a.card-link:hover,
a.btn:visited, a.tab:visited, a.seg-opt:visited, a.card-link:visited {
  text-decoration: none;
}

/* Tablas */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
th { background: var(--surface-2); font-weight: 500; color: var(--text-muted); font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, th.mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
tbody tr:hover { background: var(--surface-2); }
td .actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Tags/badges */
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 500;
}
.tag.ok      { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.tag.warn    { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.tag.danger  { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.tag.brand   { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.tag.mode-blaster { background: #EFF6FF; color: #1E40AF; border-color: #DBEAFE; }
.tag.mode-preview { background: #F3E8FF; color: #6B21A8; border-color: #E9D5FF; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.field input, .field select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px var(--brand-100);
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.login-card {
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.login-card .brand {
  margin-bottom: 16px;
  text-align: center;
  padding: 8px 0 4px;
}
.login-card .subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; text-align: center; }
.login-card .error { color: var(--danger); font-size: 12px; margin-top: 8px; min-height: 16px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 4px; }

/* Utility */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.hidden { display: none; }
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-600);
  border-radius: 999px;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state (legacy — vistas que aún no migraron a .empty-state) */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   §primitivos — Fase 3
   TopBar · PageHeader · StatCard · DataTable · Badge/Chip
   Segmented · EmptyState · QuickActions · LiveDot · Progress
   Medidas y tokens siguen ryng-estilos.html 1:1.
   ============================================================ */

/* --- TopBar (search pill + bell + fecha+reloj pill) --- */
.topbar { height: 70px; padding: 0 32px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: 10px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-line);
  color: inherit;
  font-size: 13px;
}
.pill-icon { color: inherit; opacity: 0.75; flex-shrink: 0; }
.pill-search { width: 230px; }
.pill-search .muted { opacity: 0.85; color: inherit; }
.pill-bell { width: 38px; padding: 0; justify-content: center; position: relative; }
.pill-bell .pill-dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn);
}
.pill-date { gap: 10px; }
.pill-date-txt { opacity: 0.85; text-transform: capitalize; }
.pill-clock { font-weight: 600; font-size: 14px; letter-spacing: 0.02em; }
.topbar-greet { font-size: 15px; opacity: 0.9; }
.topbar-greet strong { opacity: 1; font-weight: 700; }

/* --- PageHeader (hero) --- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 20px;
}
.page-head-main { min-width: 0; }
.page-title { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -0.02em; color: var(--hero-fg); }
.page-sub { margin-top: 4px; font-size: 14px; color: var(--text-muted); opacity: 0.9; display: flex; gap: 14px; flex-wrap: wrap; }
.page-sub span { display: inline-flex; align-items: center; gap: 6px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.conn-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--conn-bg); color: var(--conn-fg);
  border: 1px solid var(--conn-line);
  font-size: 13px; font-weight: 600;
}
/* Variantes por estado del WebRTC */
.conn-pill--ok     { background: var(--conn-bg);  color: var(--conn-fg);  border-color: var(--conn-line); }
.conn-pill--warn   { background: var(--ic3-bg);   color: var(--ic3-fg);   border-color: color-mix(in srgb, var(--ic3-fg) 30%, transparent); }
.conn-pill--danger { background: var(--bad-bg);   color: var(--bad);      border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.conn-pill--muted  { background: var(--kpi-bg);   color: var(--text-muted); border-color: var(--border); }

/* --- StatCard (card variante stat con icono+chip+valor+hint) --- */
.stat {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--rad, 16px);
  padding: 18px 20px;
  box-shadow: var(--card-sh);
  backdrop-filter: blur(var(--blur, 0px));
  -webkit-backdrop-filter: blur(var(--blur, 0px));
  position: relative;
  overflow: hidden;
}
.stat-head { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.stat-label { flex: 1; min-width: 0; }
.stat-value { margin-top: 16px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); display: flex; align-items: center; gap: 10px; }
.stat-value-text { font-family: var(--font-sans); }
.stat-hint { margin-top: 4px; font-size: 13px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.stat-hint .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Caja de ícono 38x38 con fondo+color por significado */
.ic {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--ic-bg); color: var(--ic-fg);
}
.ic.ic-brand { background: var(--ic-bg);  color: var(--ic-fg); }
.ic.ic-blue  { background: var(--ic2-bg); color: var(--ic2-fg); }
.ic.ic-amb   { background: var(--ic3-bg); color: var(--ic3-fg); }
.ic.ic-gray  { background: var(--kpi-bg); color: var(--text-muted); }
.ic.ic-danger{ background: var(--bad-bg); color: var(--bad, var(--danger)); }
.ic .ic-svg  { color: currentColor; }

/* Chip (dentro de StatCard head) y badges */
.stat-head .chip {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-fg);
}
.badge,
.chip {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-fg);
  line-height: 1.4;
  white-space: nowrap;
}
.badge-ok,    .chip-ok     { background: var(--chip-bg); color: var(--chip-fg); }
.badge-warn,  .chip-warn   { background: var(--ic3-bg);  color: var(--ic3-fg); }
.badge-info,  .chip-info   { background: var(--ic2-bg);  color: var(--ic2-fg); }
.badge-danger,.chip-danger { background: var(--bad-bg);  color: var(--bad, var(--danger)); }
.badge-muted, .chip-muted  { background: var(--kpi-bg);  color: var(--text-muted); }

/* --- LiveDot con animación pulse --- */
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 var(--ok);
  animation: ryng-ping 2s infinite;
}
.live-dot.off    { background: var(--text-subtle); animation: none; }
.live-dot.warn   { background: var(--warn); }
.live-dot.danger { background: var(--bad, var(--danger)); }
@keyframes ryng-ping {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  100% { box-shadow: 0 0 0 8px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none !important; }
}

/* --- Segmented control (estado agente) --- */
.seg {
  display: inline-flex;
  padding: 4px; gap: 4px;
  border-radius: 12px;
  background: var(--seg-bg);
  border: 1px solid var(--seg-line);
}
.seg-opt {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 9px;
  border: 0; background: transparent;
  color: var(--seg-fg);
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
}
.seg-opt.on {
  background: var(--ok-strong);
  color: #fff;
  box-shadow: 0 6px 14px -6px var(--ok);
}
.seg-opt:disabled { opacity: 0.55; cursor: not-allowed; }
.seg-icon { color: currentColor; }
/* Segmented completo desactivado: atenuado y sin estado activo visible */
.seg--disabled { opacity: 0.6; pointer-events: none; }
.seg--disabled .seg-opt.on { background: transparent; color: var(--seg-fg); box-shadow: none; }
.seg-disabled-hint {
  display: inline-flex; align-items: center;
  margin-left: 12px;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  opacity: 0.9;
}

/* .seg--on-strip: hint para themes.css. En Aurora/Noche no hay franja → se renderiza
   como el .seg normal del tema. En Pulso (ver themes.css) se vuelve translúcido blanco. */
.seg--on-strip {
  background: var(--seg-bg);
  border-color: var(--seg-line);
}
.seg--on-strip .seg-opt { color: var(--seg-fg); }
.seg--on-strip .seg-opt.on {
  background: var(--ok-strong);
  color: #fff;
  box-shadow: 0 6px 14px -6px var(--ok);
}

/* --- EmptyState (dentro de card o standalone) --- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px;
  min-height: 130px;
  border: 1.5px dashed var(--card-line);
  border-radius: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-state .ic { width: 36px; height: 36px; }
.empty-state-title { color: var(--text); font-size: 14px; font-weight: 700; }
.empty-state-hint  { color: var(--text-muted); font-size: 13px; max-width: 42ch; }

/* --- QuickActions (grid 2x2) --- */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.quick-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--kpi-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 700; font-size: 13.5px;
  transition: background 0.1s;
}
.quick-item:hover { background: var(--surface-2); }
.quick-item .ic { width: 32px; height: 32px; border-radius: 9px; }

/* --- DataTable (card tbl) --- */
.card.tbl {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--rad, 16px);
  padding: 18px 20px;
  box-shadow: var(--card-sh);
  backdrop-filter: blur(var(--blur, 0px));
  -webkit-backdrop-filter: blur(var(--blur, 0px));
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.card-title small { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.card-link {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}
.card-link:hover { color: var(--brand-600); }

.card.tbl { overflow-x: auto; }
.card.tbl table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; margin-top: 14px; }
/* Columnas responsivas: hideBelow en renderDataTable → clase col-hide-under-N que oculta <Npx. */
@media (max-width: 1599.98px) { .col-hide-under-1600 { display: none; } }
@media (max-width: 1439.98px) { .col-hide-under-1440 { display: none; } }
@media (max-width: 1279.98px) { .col-hide-under-1280 { display: none; } }
@media (max-width: 1179.98px) { .col-hide-under-1180 { display: none; } }
@media (max-width: 1023.98px) { .col-hide-under-1024 { display: none; } }
.card.tbl th {
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 10px 12px;
  background: var(--kpi-bg);
}
.card.tbl th:first-child { border-radius: 9px 0 0 9px; }
.card.tbl th:last-child  { border-radius: 0 9px 9px 0; }
.card.tbl td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--card-line);
  vertical-align: middle;
  color: var(--text);
}
.card.tbl tbody tr:last-child td { border-bottom: none; }
.card.tbl td.r,
.card.tbl th.r { text-align: right; }
.card.tbl td.r,
.card.tbl td.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
/* Dentro de td (incluido td.r), los botones vuelven a la fuente de UI. */
.card.tbl td .btn { font-family: var(--font-sans); font-variant-numeric: normal; }
/* Celdas que no deben partir en 2 líneas (nombres de campaña, headers, etc.) */
.card.tbl td, .card.tbl th { white-space: nowrap; }
.cell-truncate {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
/* Botones de acción: fila horizontal al borde derecho de la celda */
.actions-row {
  display: inline-flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
}
/* Botón icon-only: cuadrado 32x32 con solo el ícono (ej. ojo para Ver) */
.btn.icon {
  padding: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn.icon svg { width: 16px; height: 16px; }
.btn.sm.icon { width: 28px; height: 28px; }
.btn.sm.icon svg { width: 14px; height: 14px; }
.btn.icon.danger {
  color: var(--bad, var(--danger));
  background: transparent;
  border-color: var(--border);
}
.btn.icon.danger:hover {
  background: color-mix(in oklab, var(--bad, var(--danger)) 10%, transparent);
  border-color: var(--bad, var(--danger));
}
.card.tbl td.empty-td {
  text-align: center;
  padding: 32px 12px;
  color: var(--text-muted);
}

/* Códigos y badges comunes dentro de la tabla */
.code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--kpi-bg);
  color: var(--text);
}
.mode {
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: var(--ic2-bg); color: var(--ic2-fg);
}
.mode.mode-blaster     { background: var(--ic2-bg); color: var(--ic2-fg); }
.mode.mode-progressive { background: var(--chip-bg); color: var(--chip-fg); }
.mode.mode-preview     { background: var(--ic3-bg); color: var(--ic3-fg); }
.trk { display: inline-flex; align-items: center; gap: 6px; }
.trk svg { opacity: 0.7; }

/* Progress bar (columna avance) */
.prog {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.prog b {
  display: block;
  height: 6px; width: 90px;
  border-radius: 9px;
  background: var(--kpi-bg);
  overflow: hidden;
}
.prog b i { display: block; height: 100%; background: var(--ok-strong); border-radius: 9px; }

/* --- Util: etiqueta de sección (showcase, listados) --- */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 20px 0 8px;
}

/* --- Mi panel: fila inferior (Marcar manual + Tu turno hoy) --- */
.dial-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) { .dial-grid { grid-template-columns: 1fr; } }

.dial-row {
  display: flex; align-items: flex-end; gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.dial-field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.dial-field-label {
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
}
.dial-input-wrap {
  display: flex; align-items: center;
  height: 48px;
  border-radius: 12px;
  background: var(--inp-bg);
  border: 1px solid var(--inp-line);
  padding: 0 14px;
  overflow: hidden;
}
.dial-prefix {
  display: inline-flex; align-items: center; gap: 6px;
  padding-right: 10px;
  border-right: 1px solid var(--inp-line);
  font-size: 14px;
  color: var(--text);
}
.dial-flag {
  width: 20px; height: 14px;
  border-radius: 3px;
  background: linear-gradient(#FCD116 0 50%, #003893 50% 75%, #CE1126 75%);
  flex-shrink: 0;
}
.dial-input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  padding: 0 0 0 12px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 15px; font-weight: 600;
  color: var(--text);
  outline: none;
}
.dial-select {
  height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--inp-bg);
  border: 1px solid var(--inp-line);
  font-size: 14px; font-weight: 600;
  color: var(--text);
  font-family: inherit;
}
.dial-btn {
  height: 48px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 700; font-size: 15px;
}
.dial-error { color: var(--danger); font-size: 12px; margin-top: 8px; min-height: 16px; }
.dial-recent-slot { margin-top: 18px; }
.dial-recent-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* --- Pill de input (filtros fuera del header; usa tokens de input "normal") --- */
.input-pill {
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--inp-bg);
  border: 1px solid var(--inp-line);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.input-pill:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-600) 15%, transparent);
}
.input-pill::placeholder { color: var(--text-subtle); }

/* --- Supervisor: filas internas (colas, dispositions) --- */
.sup-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-line);
  font-size: 13px;
}
.sup-row:last-child { border-bottom: none; }
.sup-row-name { color: var(--text); font-weight: 500; flex: 1; min-width: 0; }
.grow { flex: 1; }

/* --- Filtros de listado (input-pill + select-pill en una fila) --- */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* Tarjeta de filtros (Llamadas, listados complejos) */
.filter-card { padding: 14px 16px; }
/* Agrupa Limpiar + Buscar para que caigan juntos cuando wrappea */
.filter-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* --- BarChart horizontal (reportes) --- */
.chart {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--rad, 16px);
  box-shadow: var(--card-sh);
  padding: 18px 20px;
}
.chart-title {
  font-size: 15px; font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
}
.chart-rows {
  display: flex; flex-direction: column; gap: 10px;
}
.chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.chart-label {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--kpi-bg);
  overflow: hidden;
}
.chart-bar i {
  display: block; height: 100%;
  background: var(--_bar, var(--brand-600));
  border-radius: 999px;
  transition: width 0.3s;
}
.chart-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  min-width: 60px;
  text-align: right;
}

/* --- ColumnChart vertical (distribución por hora) --- */
.columns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  align-items: end;
  height: var(--_h, 180px);
  padding-top: 20px;
}
.columns .col {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  height: 100%;
  min-width: 0;
}
.columns .col-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  height: 14px;
}
.columns .col-bar {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}
.columns .col-bar i {
  display: block;
  width: 100%;
  min-height: 2px;
  background: var(--brand-600);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s;
}
.columns .col-label {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--text-subtle);
  font-weight: 600;
  height: 14px;
}

/* --- Heatmap hora × día --- */
.hm { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.hm-row { display: flex; align-items: center; gap: 10px; }
.hm-dow {
  width: 36px;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  text-align: right;
  flex-shrink: 0;
}
.hm-cells {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  flex: 1;
}
.hm-cell {
  height: 18px;
  border-radius: 3px;
  background: var(--kpi-bg);
  position: relative;
  overflow: hidden;
}
/* --_hm es 0..1; capa brand sobre fondo neutro para que las celdas con valor resalten. */
.hm-cell::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--brand-600);
  opacity: var(--_hm, 0);
}
.hm-hours {
  display: flex; align-items: center; gap: 10px;
  margin-top: 4px;
}
.hm-hours .hm-cells {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-subtle);
  font-weight: 600;
  text-align: center;
}
/* Celdas sin dato se ven más tenues que las de valor mínimo */
.hm-cell.hm-cell--empty { background: var(--kpi-bg); opacity: 0.5; }
.hm-cell.hm-cell--empty::before { display: none; }

/* --- Leyenda del heatmap --- */
.hm-legend {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
  justify-content: flex-end;
}
.hm-leg-label { white-space: nowrap; font-weight: 600; }
.hm-leg-scale {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 4px;
  background: var(--kpi-bg);
}
.hm-leg-cell {
  width: 22px; height: 14px;
  border-radius: 2px;
  background: var(--kpi-bg);
  position: relative;
  overflow: hidden;
}
.hm-leg-cell::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--brand-600);
  opacity: var(--_hm, 0);
}

/* --- Catálogo de reportes (grid de tarjetas clicables) --- */
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .report-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px)  { .report-grid { grid-template-columns: 1fr; } }

/* Grid con 4 filas definidas → el foot queda alineado en toda la fila
   independientemente de la longitud de la descripción. */
.report-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--rad, 16px);
  box-shadow: var(--card-sh);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
  min-height: 170px;
}
.report-card:hover {
  border-color: var(--brand-600);
  transform: translateY(-1px);
}
.report-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.report-card-title {
  font-size: 15px; font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.report-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.report-card-foot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  color: var(--brand-600);
  padding-top: 4px;
  border-top: 1px solid var(--card-line);
}

/* --- DateTimePicker custom (dd/mm/aaaa HH:mm, 24h, es-CO) --- */
.dtp-wrap { display: inline-block; min-width: 170px; position: relative; }
.dtp-wrap .dtp-input {
  width: 100%;
  cursor: pointer;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.dtp-popover {
  width: 300px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.4);
  padding: 12px;
  font-family: var(--font-sans);
}
.dtp-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.dtp-title {
  font-size: 14px; font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
  letter-spacing: -0.01em;
}
.dtp-nav {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px; line-height: 1;
  font-family: inherit;
}
.dtp-nav:hover { border-color: var(--brand-600); color: var(--brand-600); }
.dtp-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 10px; font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.08em;
}
.dtp-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dtp-day {
  background: transparent;
  border: 0;
  padding: 0;
  height: 32px; width: 100%;
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.dtp-day:hover:not(.dtp-day-empty) { background: var(--kpi-bg); }
.dtp-day.is-today { color: var(--brand-600); font-weight: 700; }
.dtp-day.is-selected {
  background: var(--brand-600);
  color: #fff;
  font-weight: 700;
}
.dtp-day.is-selected.is-today { color: #fff; }
.dtp-day-empty { visibility: hidden; cursor: default; }
.dtp-time {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.dtp-time-label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-right: 4px; }
.dtp-time select {
  background: var(--inp-bg);
  border: 1px solid var(--inp-line);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
}
.dtp-sep { color: var(--text-muted); font-weight: 700; }
.dtp-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
/* Pager row (contador + botones paginación) */
.pager-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 0 4px;
  font-size: 12px;
}

/* --- Supervisor: cards de agente (vista Cards). Colores por estado via var(--_state). --- */
.sup-agent-card {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--rad, 16px);
  box-shadow: var(--card-sh);
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}
.sup-agent-card[data-state="offline"] { opacity: 0.6; }
.sup-agent-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.sup-agent-id   { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sup-agent-avatar {
  width: 40px; height: 40px;
  border-radius: 999px;
  background: var(--brand-100, var(--kpi-bg));
  color: var(--brand-700, var(--text));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 0 2px var(--_state, var(--state-offline));
}
.sup-agent-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sup-agent-name {
  font-weight: 600; font-size: 13px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.sup-agent-sub {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}

/* Badge coloreado por estado */
.state-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--_state, var(--state-offline)) 16%, transparent);
  color: var(--_state, var(--state-offline));
  white-space: nowrap;
  flex-shrink: 0;
}
.state-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--_state, var(--state-offline));
  flex-shrink: 0;
}

.sup-agent-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px;
  gap: 10px;
  min-width: 0;
}
.sup-agent-row .muted { color: var(--text-muted); }

.sup-agent-stats {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--card-line);
  font-size: 11px;
  gap: 10px;
}
.sup-agent-stat-label { color: var(--text-muted); font-size: 10px; display: block; }
.sup-agent-stat-val   { font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.sup-agent-call {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px; margin-top: 2px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--_state, var(--state-on-call)) 10%, transparent);
}
.sup-agent-call-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
  gap: 10px;
  min-width: 0;
}
.sup-agent-call-row .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.sup-agent-call-row .muted { color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Dispositions (Tipificaciones últimas 24 h) --- */
.dispo-row {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--card-line);
}
.dispo-row:last-child { border-bottom: none; }
.dispo-bar {
  height: 6px;
  border-radius: 9px;
  background: var(--kpi-bg);
  overflow: hidden;
}
.dispo-bar i {
  display: block; height: 100%;
  background: var(--_dispo, var(--state-offline));
  border-radius: 9px;
}
.dispo-count { font-size: 13px; font-weight: 700; color: var(--text); min-width: 44px; text-align: right; }
.dispo-pct   { font-size: 11px; font-weight: 600; color: var(--text-muted); min-width: 34px; text-align: right; }

/* --- Badge dev-mode (solo localhost; nunca aparece en producción) --- */
.dev-badge {
  position: fixed;
  right: 16px; bottom: 16px;
  z-index: 10000;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bad, var(--danger));
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4);
  cursor: pointer;
  font-family: var(--font-sans);
}
.dev-badge:hover { filter: brightness(1.08); }

/* --- Reproductor de audio propio --- */
.aplay {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--kpi-bg);
  border: 1px solid var(--card-line);
  border-radius: 10px;
  min-height: 44px;
}
.aplay-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--brand-600);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s;
}
.aplay-btn:hover { background: var(--brand-700); }
.aplay-btn .ic-svg { color: currentColor; }
.aplay-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-width: 60px;
}
.aplay-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 0%;
  background: var(--brand-600);
  border-radius: 999px;
  transition: width 0.1s linear;
}
.aplay-time {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 68px;
  text-align: right;
}
.aplay-speed {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 4px;
  cursor: pointer;
}

/* --- Calidad: nueva evaluación + detalle --- */
.quality-eval { display: flex; flex-direction: column; gap: 16px; }
.quality-player {
  position: sticky; top: 70px; /* debajo del topbar */
  z-index: 10;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 18px;
}
.quality-player-info { flex: 1; min-width: 0; }
.quality-player-phone { font-size: 15px; font-weight: 700; color: var(--text); }
.quality-player-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.quality-player .aplay { flex: 1.3; max-width: 520px; }

.quality-total { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.quality-total strong { font-size: 18px; font-weight: 800; color: var(--text); margin-left: 6px; }

.quality-items { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.qi-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--kpi-bg);
  outline: none;
}
.qi-row:focus { box-shadow: 0 0 0 2px var(--brand-600); }
.qi-hint {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 4px;
}
.qi-hint span { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; margin-right: 4px; }
.qi-hint kbd {
  font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.3;
  margin: 0 2px;
}
.qi-row-read { background: transparent; border-bottom: 1px solid var(--card-line); border-radius: 0; }
.qi-row-read:last-child { border-bottom: none; }
.qi-label { min-width: 0; }
.qi-text  { font-size: 14px; font-weight: 600; color: var(--text); }
.qi-weight{ font-size: 11px; margin-top: 2px; }
.qi-stars { display: inline-flex; align-items: center; gap: 2px; }
.qi-star {
  background: transparent; border: 0; padding: 4px;
  cursor: pointer;
  color: var(--text-subtle);
  display: inline-flex; align-items: center; justify-content: center;
}
.qi-star.is-on { color: var(--state-paused); }
.qi-star:hover { color: var(--state-paused); }
.qi-star-svg { color: currentColor; }
.qi-clear {
  background: transparent; border: 0; padding: 4px 8px;
  color: var(--text-subtle);
  cursor: pointer; font-weight: 700;
  margin-left: 6px;
}
.qi-clear:hover { color: var(--text); }
.qi-score { font-weight: 700; margin-left: 8px; color: var(--text); }
.qi-note { font-size: 13px; }
.qi-note-read { font-size: 13px; color: var(--text); }

/* Ítems con más fallas: label + rubrica subtitle + score + barra invertida */
.worst-items { display: flex; flex-direction: column; gap: 12px; }
.worst-item { display: flex; flex-direction: column; gap: 6px; }
.worst-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.worst-item-labels { min-width: 0; flex: 1; }
.worst-item-label { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.worst-item-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.worst-item-score { font-size: 13px; font-weight: 700; white-space: nowrap; }

/* Rúbricas (lista + items) */
.rubric-items { display: flex; flex-direction: column; gap: 6px; }
.rubric-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: var(--kpi-bg);
  border-radius: 8px;
  font-size: 13px;
}
.rubric-item-label { color: var(--text); font-weight: 500; }
.rubric-item-weight { color: var(--text-muted); font-weight: 700; }

/* --- Calibración AMD --- */
.amd-matrix {
  display: grid;
  grid-template-columns: 180px 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.amd-mx-lbl {
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 10px 8px;
}
.amd-mx-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 18px 10px;
  border-radius: 12px;
  background: var(--kpi-bg);
}
.amd-mx-cell.is-ok  { background: color-mix(in srgb, var(--state-available) 15%, transparent); color: var(--state-available); }
.amd-mx-cell.is-bad { background: color-mix(in srgb, var(--bad) 15%, transparent);              color: var(--bad); }
.amd-mx-n   { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 800; }
.amd-mx-sub { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.9; }

.amd-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.amd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.amd-id { min-width: 0; }
.amd-phone { font-weight: 700; font-size: 14px; color: var(--text); font-family: var(--font-mono); }
.amd-meta  { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.amd-audio { width: 100%; height: 36px; }
.amd-norec { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.amd-done  { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.amd-actions { display: flex; gap: 8px; }
.amd-actions .btn { position: relative; }
.amd-actions kbd {
  margin-left: 4px;
  font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 6px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.3;
}
.amd-card.is-focused { box-shadow: 0 0 0 2px var(--brand-600); border-color: var(--brand-600); }

.amd-shortcuts-hint {
  display: inline-flex; align-items: center; flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.amd-shortcuts-hint span { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; margin-right: 4px; }
.amd-shortcuts-hint kbd {
  font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 6px;
  background: var(--kpi-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.3;
  margin: 0 2px 0 6px;
}

/* --- Datos de formularios: pares etiqueta: valor en línea --- */
.form-values { font-size: 13px; line-height: 1.6; max-width: 420px; white-space: normal; }
.form-pair   { display: inline; }
.form-key    { color: var(--text-muted); font-weight: 600; }
.form-val    { color: var(--text); font-weight: 500; }
.form-sep    { color: var(--text-subtle); margin: 0 2px; }

/* --- Sup agent card: badge wrap debajo del nombre si no cabe --- */
.sup-agent-head { flex-wrap: wrap; }
.sup-agent-id   { flex: 1 1 180px; min-width: 0; }
.state-pill     { flex-shrink: 0; }

/* --- Toasts (feedback no bloqueante) --- */
.toasts {
  position: fixed; right: 16px; top: 16px; z-index: 10001;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 240px; max-width: 360px;
  padding: 10px 14px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  font-size: 13px; font-weight: 500;
  pointer-events: auto;
  transition: opacity .25s ease, transform .25s ease;
}
.toast--error { border-color: var(--bad, var(--danger)); color: var(--bad, var(--danger)); }
.toast--ok    { border-color: var(--ok,  var(--success)); color: var(--ok,  var(--success)); }
.toast--out   { opacity: 0; transform: translateY(-6px); }

/* --- Vista semanal de horarios --- */
.sch-timeline { display: grid; gap: 10px; padding: 4px 2px 2px; }
.sch-grid-head {
  display: grid;
  grid-template-columns: 180px repeat(7, 1fr);
  gap: 8px;
  padding: 0 4px 6px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-subtle);
}
.sch-grid { display: flex; flex-direction: column; gap: 6px; }
.sch-row {
  display: grid;
  grid-template-columns: 180px repeat(7, 1fr);
  gap: 8px;
  align-items: center;
}
.sch-name { min-width: 0; padding: 6px 4px; }
.sch-name > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sch-cell {
  position: relative;
  height: 22px;
  background: var(--kpi-bg, color-mix(in oklab, var(--text) 4%, transparent));
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.sch-span {
  position: absolute; top: 0; bottom: 0;
  background: color-mix(in oklab, var(--brand-600, var(--primary)) 55%, transparent);
  border-left: 1px solid color-mix(in oklab, var(--brand-600, var(--primary)) 80%, transparent);
  border-right: 1px solid color-mix(in oklab, var(--brand-600, var(--primary)) 80%, transparent);
}
.sch-off { display: none; }
.sch-scale {
  display: grid;
  grid-template-columns: 180px repeat(7, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.sch-scale-label {
  font-size: 11px; font-weight: 500;
  color: var(--text-subtle);
  padding: 0 4px;
}
.sch-scale-track {
  grid-column: 2 / -1;
  position: relative; height: 14px;
}
.sch-scale-tick {
  position: absolute; top: 0;
  transform: translateX(-50%);
  font-size: 10px; color: var(--text-subtle);
  font-family: var(--font-mono);
  pointer-events: none;
  white-space: nowrap;
}
.sch-scale-tick:first-child { transform: translateX(0); }
.sch-scale-tick:last-child  { transform: translateX(-100%); }

/* --- Group card: flex column, foot pegado al fondo --- */
.group-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 180px;
}
.group-card-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* --- Roles: pills del sidebar + filas de permisos --- */
.role-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  text-align: left;
}
.role-pill:hover { border-color: var(--brand-600); }
.role-pill.is-active {
  background: color-mix(in oklab, var(--brand-600) 10%, transparent);
  border-color: var(--brand-600);
}
.role-dot {
  width: 8px; height: 8px;
  background: var(--warn, #f59e0b);
  border-radius: 50%;
  flex-shrink: 0;
}
.perm-row {
  display: flex; gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  align-items: flex-start;
}
.perm-row:hover { border-color: var(--brand-600); }
.perm-row input[type="checkbox"] { margin-top: 2px; width: auto; flex-shrink: 0; }

/* --- TTS: celda del reproductor en tabla, compacta --- */
.tts-preview-cell { max-width: 260px; min-width: 180px; }
.tts-preview-cell .aplay { min-width: 0; margin-top: 6px; }
.tts-preview-cell .btn.tts-play { padding: 4px 10px; }
.tts-generating {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500;
  color: var(--text-muted);
}
.tts-generating svg { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* --- Settings: filas, switch sí/no, categorías --- */
.settings-section { padding: 18px; }
.settings-rows { display: flex; flex-direction: column; }
.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--card-line);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { min-width: 0; }
.settings-row-input { flex-shrink: 0; }

/* Switch sí/no */
.switch {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  width: 42px; height: 24px;
  background: var(--border);
  border-radius: 999px;
  transition: background .18s ease;
  flex-shrink: 0;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .18s ease;
}
.switch input:checked ~ .switch-track {
  background: var(--brand-600);
}
.switch input:checked ~ .switch-track .switch-thumb {
  transform: translateX(18px);
}
.switch-label {
  font-size: 13px; font-weight: 500;
  color: var(--text);
  min-width: 24px;
}

/* --- API Docs: endpoints en tarjeta --- */
.api-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.api-endpoint {
  padding: 12px;
  border: 1px solid var(--card-line);
  border-radius: 8px;
}
.api-endpoint-head {
  display: flex; align-items: center; gap: 10px;
}
.api-method {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 50px; text-align: center;
}
.api-method-get    { background: #dbeafe; color: #1e40af; }
.api-method-post   { background: #dcfce7; color: #166534; }
.api-method-put    { background: #fef3c7; color: #92400e; }
.api-method-delete { background: #fee2e2; color: #991b1b; }
.api-method-patch  { background: #e9d5ff; color: #6b21a8; }
.api-path { font-size: 12px; color: var(--text); word-break: break-all; }
.api-example { margin-top: 8px; }
.api-example-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-subtle);
  margin-bottom: 4px;
}
.api-code {
  background: var(--kpi-bg);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 11px; font-family: var(--font-mono);
  line-height: 1.5;
  overflow-x: auto;
  margin: 0;
  color: var(--text);
}
.api-code code { font-family: inherit; background: transparent; padding: 0; color: inherit; }

/* --- Save bar flotante (sticky bottom) para Settings --- */
.savebar {
  position: fixed;
  left: var(--sidebar-w, 220px);
  right: 0;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,.08);
  z-index: 50;
  padding: 10px 24px;
}
.savebar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}
.savebar-msg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
}
.savebar-msg svg { color: var(--warn, #f59e0b); }
.savebar-actions { display: inline-flex; gap: 8px; }

@media (max-width: 900px) {
  .savebar { left: 0; padding: 10px 16px; }
}

/* --- API Docs: aviso de seguridad en caja sólida para legibilidad en los 3 temas --- */
.api-security-notice {
  padding: 16px;
  background: color-mix(in oklab, var(--warn, #f59e0b) 12%, var(--card));
  border: 1px solid var(--warn, #f59e0b);
}
.api-security-icon { color: var(--warn, #f59e0b); display: inline-flex; align-items: center; }
.api-security-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.api-security-body { font-size: 12px; line-height: 1.55; color: var(--text-muted); }
.api-security-body strong { color: var(--text); }
