/* ============================================================
   CONVOCATORIAS — ProfeAcademī  ·  REDISEÑO 2026
   Selección de estudiantes para talleres / reforzamientos / eventos,
   con validación de conflictos contra el calendario de pruebas y
   exportación de Lista de Convocados + Autorizaciones (jsPDF).

   Lenguaje visual: glassmorphism + micro-sombras + glow azul/verde
   coherente con el header de ProfeAcademī. Tokens propios por tema,
   compatibles con los classnames del JS sin tocar la lógica.
   ============================================================ */

/* -----------------------------------------------
   TOKENS POR TEMA
   ----------------------------------------------- */
body, body.theme-light {
  --surf:#ffffff; --surf2:#f4f8ff;
  --glass:rgba(255,255,255,0.72); --glass-h:rgba(255,255,255,0.92);
  --glass-strong:rgba(255,255,255,0.86);
  --input-bg:rgba(255,255,255,0.66);
  --bdr:rgba(20,40,90,0.10); --bdr-h:rgba(20,40,90,0.20);
  --fg1:#16213e; --fg2:#3a4663; --fg3:#6b7693; --fgm:#9aa3bd;
  --sh-sm:0 2px 10px rgba(20,40,90,0.07); --sh-md:0 8px 26px rgba(20,40,90,0.12); --sh-lg:0 18px 50px rgba(20,40,90,0.18);
  --note-bg:#fffaf0; --note-bg-2:#fff3d6; --note-bdr:rgba(245,158,11,0.28);
  --mint-bg:#ecfdf5; --mint-bg-2:#d6f7e8; --mint-bdr:rgba(16,185,129,0.30);
  --danger-bg:#fef2f2; --danger-bg-2:#fee2e2; --danger-bdr:rgba(239,68,68,0.30);
  --c-add:#3b82f6; --c-new:#10b981; --c-new-d:#059669;
  --c-pdf:#1f2937; --c-pdf-d:#111827; --c-del:#ef4444; --warn:#f59e0b;
  --active:#3b82f6; --active-bg:rgba(59,130,246,0.08);
  --r-card:22px; --r-lg:18px; --r-md:14px; --r-sm:10px; --r-pill:50px;
}
body.theme-dark {
  --surf:#1a1a2e; --surf2:#20243d;
  --glass:rgba(255,255,255,0.055); --glass-h:rgba(255,255,255,0.10);
  --glass-strong:rgba(255,255,255,0.08);
  --input-bg:rgba(255,255,255,0.05);
  --bdr:rgba(255,255,255,0.11); --bdr-h:rgba(255,255,255,0.22);
  --fg1:rgba(255,255,255,0.93); --fg2:rgba(255,255,255,0.72); --fg3:rgba(255,255,255,0.50); --fgm:rgba(255,255,255,0.34);
  --sh-sm:0 2px 10px rgba(0,0,0,0.5); --sh-md:0 8px 26px rgba(0,0,0,0.48); --sh-lg:0 18px 50px rgba(0,0,0,0.55);
  --note-bg:rgba(245,158,11,0.08); --note-bg-2:rgba(245,158,11,0.14); --note-bdr:rgba(245,158,11,0.30);
  --mint-bg:rgba(16,185,129,0.12); --mint-bg-2:rgba(16,185,129,0.18); --mint-bdr:rgba(16,185,129,0.34);
  --danger-bg:rgba(239,68,68,0.12); --danger-bg-2:rgba(239,68,68,0.20); --danger-bdr:rgba(239,68,68,0.40);
  --c-add:#3b82f6; --c-new:#10b981; --c-new-d:#34d399;
  --c-pdf:#e5e7eb; --c-pdf-d:#ffffff; --c-del:#f87171; --warn:#fbbf24;
  --active:#60a5fa; --active-bg:rgba(96,165,250,0.14);
}
body.theme-rosa {
  --surf:#ffffff; --surf2:#fdeef4;
  --glass:rgba(255,255,255,0.74); --glass-h:rgba(255,255,255,0.93);
  --glass-strong:rgba(255,255,255,0.87);
  --input-bg:rgba(255,255,255,0.68);
  --bdr:rgba(233,30,99,0.16); --bdr-h:rgba(233,30,99,0.30);
  --fg1:#880e4f; --fg2:#ad1457; --fg3:#c2185b; --fgm:rgba(136,14,79,0.45);
  --sh-sm:0 2px 10px rgba(233,30,99,0.10); --sh-md:0 8px 26px rgba(233,30,99,0.16); --sh-lg:0 18px 50px rgba(233,30,99,0.20);
  --note-bg:#fff8ec; --note-bg-2:#fff0d6; --note-bdr:rgba(245,158,11,0.30);
  --mint-bg:#ecfdf5; --mint-bg-2:#d6f7e8; --mint-bdr:rgba(16,185,129,0.30);
  --danger-bg:#fef2f2; --danger-bg-2:#fee2e2; --danger-bdr:rgba(239,68,68,0.30);
  --c-add:#e91e63; --c-new:#10b981; --c-new-d:#059669;
  --c-pdf:#880e4f; --c-pdf-d:#6a0a3d; --c-del:#ef4444; --warn:#f59e0b;
  --active:#e91e63; --active-bg:rgba(233,30,99,0.08);
}
body.theme-neon {
  --surf:#1c2230; --surf2:#161b27;
  --glass:rgba(0,220,255,0.05); --glass-h:rgba(0,220,255,0.11);
  --glass-strong:rgba(0,220,255,0.08);
  --input-bg:rgba(0,220,255,0.045);
  --bdr:rgba(0,220,255,0.16); --bdr-h:rgba(0,220,255,0.30);
  --fg1:rgba(230,248,255,0.95); --fg2:rgba(180,220,255,0.80); --fg3:rgba(120,180,255,0.56); --fgm:rgba(80,140,255,0.40);
  --sh-sm:0 2px 10px rgba(0,0,0,0.55); --sh-md:0 8px 26px rgba(0,220,255,0.12); --sh-lg:0 18px 50px rgba(0,0,0,0.6);
  --note-bg:rgba(255,210,0,0.07); --note-bg-2:rgba(255,210,0,0.13); --note-bdr:rgba(255,210,0,0.30);
  --mint-bg:rgba(0,255,200,0.08); --mint-bg-2:rgba(0,255,200,0.14); --mint-bdr:rgba(0,255,200,0.32);
  --danger-bg:rgba(255,92,138,0.10); --danger-bg-2:rgba(255,92,138,0.18); --danger-bdr:rgba(255,92,138,0.40);
  --c-add:#00d4ff; --c-new:#00ffaa; --c-new-d:#00d890;
  --c-pdf:#e6f8ff; --c-pdf-d:#c9eeff; --c-del:#ff5c8a; --warn:#ffd200;
  --active:#00d4ff; --active-bg:rgba(0,212,255,0.12);
}

/* Glows derivados del color activo (coherentes con el botón volver del header) */
:where(body) {
  --glow-active: 0 6px 22px color-mix(in srgb, var(--active) 38%, transparent), 0 0 18px color-mix(in srgb, var(--active) 18%, transparent);
  --glow-new:    0 6px 22px color-mix(in srgb, var(--c-new) 40%, transparent), 0 0 18px color-mix(in srgb, var(--c-new) 18%, transparent);
  --ease: cubic-bezier(.4,0,.2,1);
}

/* -----------------------------------------------
   BASE / ACCESIBILIDAD
   ----------------------------------------------- */
html, body { overflow-x: hidden; max-width: 100%; }
.app-container { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; width: 100%; box-sizing: border-box; padding: 0; }
.v2-main { max-width: 1180px; margin: 0 auto; padding: 16px 14px 132px; box-sizing: border-box; }
@media (min-width: 600px) { .v2-main { padding: 22px 22px 96px; } }
@media (min-width: 1180px) { .v2-main { padding: 26px 26px 60px; } }

.lbl { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--fgm); }

/* Focus-visible coherente con el color activo del tema */
.v2-main :focus-visible,
.cv-fab:focus-visible,
.cv-conv-item .rm:focus-visible {
  outline: 2.5px solid var(--active);
  outline-offset: 2px;
  border-radius: var(--r-md);
}
.cv-field input:focus-visible, .cv-field select:focus-visible,
.v2-search input:focus-visible { outline: none; }

/* -----------------------------------------------
   FORMULARIO DEL EVENTO  (card glassmorphism)
   ----------------------------------------------- */
.cv-event {
  position: relative; z-index: 1; overflow: hidden;
  margin: 0 0 16px; padding: 0;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--bdr); border-radius: var(--r-card);
  box-shadow: var(--sh-md);
}
.cv-event-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 15px 18px;
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--active) 12%, transparent) 0%,
      color-mix(in srgb, var(--active) 3%, transparent) 55%, transparent 100%);
  border-bottom: 1px solid var(--bdr);
}
.cv-event-head::before {
  content: ""; width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  background:
    linear-gradient(135deg, var(--active), color-mix(in srgb, var(--active) 55%, #ffffff)) padding-box;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / 18px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / 18px no-repeat;
  box-shadow: var(--glow-active);
}
.cv-event-head .lbl { margin: 0; font-size: 11px; color: var(--fg2); }
.cv-event-head .hint { font-size: 11.5px; color: var(--fg3); flex: 1; min-width: 140px; }

.cv-grid {
  display: grid; gap: 12px; padding: 16px 18px 18px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.cv-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cv-field.span2 { grid-column: span 2; }

.cv-field > .lbl { padding-left: 2px; }
.cv-field input, .cv-field select {
  width: 100%; box-sizing: border-box; min-height: 46px; padding: 11px 13px;
  border: 1.5px solid var(--bdr); border-radius: var(--r-md);
  background: var(--input-bg); color: var(--fg1);
  font-family: inherit; font-size: 14px; font-weight: 600; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.cv-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa3bd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.cv-field input::placeholder { color: var(--fgm); font-weight: 500; }
.cv-field input:hover, .cv-field select:hover { border-color: var(--bdr-h); }
.cv-field input:focus, .cv-field select:focus {
  border-color: var(--active); background: var(--glass-h);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--active) 16%, transparent);
}
.cv-field input[type="date"], .cv-field input[type="time"] { font-weight: 700; }
body.theme-dark .cv-field input[type="date"]::-webkit-calendar-picker-indicator,
body.theme-dark .cv-field input[type="time"]::-webkit-calendar-picker-indicator,
body.theme-neon .cv-field input[type="date"]::-webkit-calendar-picker-indicator,
body.theme-neon .cv-field input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.85); }

/* -----------------------------------------------
   BARRA DE ACCIÓN
   ----------------------------------------------- */
.cv-actionbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
  padding: 12px 14px; border-radius: var(--r-card);
  background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--bdr); box-shadow: var(--sh-sm);
}
.cv-actionbar .v2-total { display: flex; align-items: baseline; gap: 7px; font-size: 13px; font-weight: 700; color: var(--fg2); white-space: nowrap; }
.cv-actionbar .v2-total b { font-size: 20px; color: var(--active); transition: color .2s var(--ease); }
.cv-actionbar-spacer { flex: 1; }

.btn-selall {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1.5px solid var(--bdr); background: transparent; color: var(--fg2);
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: all .2s var(--ease);
}
.btn-selall:hover:not(:disabled) { border-color: var(--c-new); color: var(--c-new); background: var(--mint-bg); box-shadow: var(--glow-new); }
.btn-selall:active:not(:disabled) { transform: scale(.97); }
.btn-selall:disabled { opacity: .5; cursor: not-allowed; border-style: dashed; }
.btn-selall:disabled .btn-selall-lock { display: inline-flex; opacity: .8; }
.btn-selall-lock { display: none; margin-left: -2px; }

/* -----------------------------------------------
   BOTONES PRINCIPALES (pill + glow)
   ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: var(--r-pill); border: none;
  font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), background .22s var(--ease), filter .22s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(.96); }

.btn-save { background: var(--c-new); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--c-new) 26%, transparent); }
.btn-save:hover:not(:disabled) { background: var(--c-new-d); transform: translateY(-2px); box-shadow: var(--glow-new); }

.btn-auth { background: var(--active); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--active) 28%, transparent); }
.btn-auth:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-2px); box-shadow: var(--glow-active); }

.btn-pdf { background: var(--c-pdf); color: var(--surf); }
body.theme-dark .btn-pdf, body.theme-neon .btn-pdf { color: #111827; }
.btn-pdf:hover:not(:disabled) { background: var(--c-pdf-d); transform: translateY(-2px); box-shadow: var(--sh-md); }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

.spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
body.theme-dark .btn-pdf .spin, body.theme-neon .btn-pdf .spin { border-color: rgba(0,0,0,.3); border-top-color:#111; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -----------------------------------------------
   FILTROS (buscador + chips de curso)
   ----------------------------------------------- */
.v2-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
@media (min-width: 720px) { .v2-filters { flex-direction: row; align-items: center; } }
.v2-search { position: relative; flex: 1; min-width: 0; }
.v2-search input {
  width: 100%; min-height: 48px; padding: 12px 44px 12px 42px;
  border: 1.5px solid var(--bdr); border-radius: var(--r-md);
  background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--fg1); font-family: inherit; font-size: 14px; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease); box-sizing: border-box;
}
.v2-search input::placeholder { color: var(--fgm); }
.v2-search input:hover { border-color: var(--bdr-h); }
.v2-search input:focus { border-color: var(--active); background: var(--glass-h); box-shadow: 0 0 0 4px color-mix(in srgb, var(--active) 15%, transparent); }
.v2-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--fgm); pointer-events: none; display: flex; }
.v2-search .clr { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--surf2); color: var(--fg2); cursor: pointer; display: none; align-items: center; justify-content: center; transition: all .15s var(--ease); }
.v2-search .clr.show { display: flex; }
.v2-search .clr:hover { background: var(--danger-bg-2); color: var(--c-del); }

.v2-course-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px; scrollbar-width: none; -ms-overflow-style: none; }
.v2-course-chips::-webkit-scrollbar { display: none; }
.v2-chip {
  flex: 0 0 auto; min-height: 44px; padding: 9px 17px; border-radius: var(--r-pill);
  border: 1.5px solid var(--bdr); background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--fg2); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: all .2s var(--ease);
}
.v2-chip:hover { border-color: var(--active); color: var(--fg1); transform: translateY(-1px); }
.v2-chip.active { background: var(--active); border-color: var(--active); color: #fff; box-shadow: var(--glow-active); }
.v2-chip.loading { font-style: italic; color: var(--fgm); cursor: default; }

/* -----------------------------------------------
   LAYOUT DOS COLUMNAS (roster | convocados)
   ----------------------------------------------- */
.cv-cols { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 940px) { .cv-cols { grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; } }

/* -----------------------------------------------
   NÓMINA / ROSTER
   ----------------------------------------------- */
.v2-rosterhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 0 4px; }
.v2-rosterhead .h { font-size: 13.5px; font-weight: 800; color: var(--fg1); white-space: nowrap; flex-shrink: 0; }
.v2-rosterhead .c { font-size: 12px; font-weight: 600; color: var(--fg3); text-align: right; }
.v2-rosterhead .c b { color: var(--active); }

.roster { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) and (max-width: 939px) { .roster { grid-template-columns: 1fr 1fr; } }

.rcard {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--r-lg);
  border: 1.5px solid var(--bdr); background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  cursor: pointer; text-align: left; font-family: inherit; position: relative; width: 100%;
  min-height: 68px; box-sizing: border-box;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
@media (min-width: 600px) { .rcard { min-height: 64px; } }
.rcard:hover { border-color: var(--bdr-h); transform: translateY(-3px); box-shadow: var(--sh-md); }
.rcard:active { transform: translateY(-1px); }
.rcard.in-active { background: var(--mint-bg); border-color: var(--mint-bdr); }
.rcard.in-active:hover { background: var(--mint-bg-2); }

/* Avatar circular con iniciales (hue generado en JS) */
.rcard-avatar {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; letter-spacing: .02em; color: #fff;
  background: hsl(var(--avatar-hue, 210), 58%, 52%);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.35), 0 2px 6px color-mix(in srgb, hsl(var(--avatar-hue,210),58%,52%) 45%, transparent);
  user-select: none; transition: transform .18s var(--ease);
}
.rcard:hover .rcard-avatar { transform: scale(1.05); }
.rcard.in-active .rcard-avatar { box-shadow: inset 0 1px 1px rgba(255,255,255,.35), 0 0 0 2px var(--mint-bdr); }
.rcard.is-conflict .rcard-avatar { filter: grayscale(.7) opacity(.7); }

/* Conflicto académico: bloqueado, en rojo */
.rcard.is-conflict { background: var(--danger-bg); border-color: var(--danger-bdr); cursor: not-allowed; }
.rcard.is-conflict:hover { transform: none; box-shadow: none; }
.rcard.is-conflict .rcard-name { color: var(--c-del); }

.rcard-info { flex: 1; min-width: 0; }
.rcard-name { font-size: 14px; font-weight: 700; color: var(--fg1); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard-sub { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.rcard-course { font-size: 10px; font-weight: 800; padding: 2px 9px; border-radius: var(--r-pill); background: var(--surf2); color: var(--fg3); border: 1px solid var(--bdr); white-space: nowrap; }
.rcard-conflict-badge { font-size: 10px; font-weight: 800; color: var(--c-del); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rcard-conflict-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-del); flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-del) 22%, transparent); }

.rtoggle {
  width: 40px; height: 40px; min-width: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bdr-h); background: var(--surf2); color: transparent;
  transition: all .2s cubic-bezier(.34,1.5,.64,1);
}
.rcard:hover .rtoggle { border-color: var(--active); color: var(--active); }
.rcard.in-active .rtoggle { background: var(--c-new); border-color: var(--c-new); color: #fff; box-shadow: var(--glow-new); }
.rcard.is-conflict .rtoggle { background: transparent; border-color: var(--danger-bdr); color: var(--c-del); }
.rtoggle.pop { animation: v2pop .42s cubic-bezier(.34,1.56,.64,1); }
@keyframes v2pop { 0%{transform:scale(1)} 38%{transform:scale(1.32)} 100%{transform:scale(1)} }

/* -----------------------------------------------
   PANEL DE CONVOCADOS (agrupado por curso)
   ----------------------------------------------- */
.cv-conv {
  border-radius: var(--r-card); border: 1px solid var(--bdr);
  background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--sh-md); overflow: hidden;
  position: sticky; top: calc(var(--pa-header-h, 0px) + 14px);
}
.cv-conv-head {
  display: flex; align-items: center; gap: 9px; padding: 14px 16px; border-bottom: 1px solid var(--bdr);
  color: var(--active);
  background: linear-gradient(135deg, color-mix(in srgb, var(--active) 10%, transparent), transparent 70%);
}
.cv-conv-head .ttl { font-size: 13.5px; font-weight: 800; color: var(--fg1); }
.cv-conv-head .count { margin-left: auto; min-width: 26px; height: 26px; padding: 0 9px; border-radius: var(--r-pill); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800; background: var(--active); color: #fff; box-shadow: var(--glow-active); transition: transform .2s cubic-bezier(.34,1.5,.64,1); }
.cv-conv-body { max-height: 62vh; overflow-y: auto; padding: 10px; scrollbar-width: thin; scrollbar-color: var(--bdr-h) transparent; }
.cv-conv-body::-webkit-scrollbar { width: 7px; }
.cv-conv-body::-webkit-scrollbar-thumb { background: var(--bdr-h); border-radius: var(--r-pill); }

.cv-conv-group { margin-bottom: 10px; }
.cv-conv-group:last-child { margin-bottom: 0; }
.cv-conv-group-h {
  display: flex; align-items: center; gap: 8px; margin-bottom: 3px; padding: 5px 10px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--fg3);
  background: var(--surf2); border-radius: var(--r-pill); border: 1px solid var(--bdr);
}
.cv-conv-group-h > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-conv-group-h .badge { min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--r-pill); display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800; background: var(--active); color: #fff; }
.cv-conv-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--r-md); transition: background .15s var(--ease); }
.cv-conv-item:hover { background: var(--surf2); }
.cv-conv-item .nm { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--fg1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-conv-item .rm {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; border: none; background: var(--surf2); color: var(--fgm);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .15s var(--ease); opacity: 1;
}
@media (min-width: 940px) { .cv-conv-item .rm { opacity: 0; } .cv-conv-item:hover .rm, .cv-conv-item .rm:focus-visible { opacity: 1; } }
.cv-conv-item .rm:hover { background: var(--danger-bg-2); color: var(--c-del); }

.cv-conv-empty { text-align: center; padding: 2.4rem 1.2rem; color: var(--fgm); }
.cv-conv-empty .ico { font-size: 1.9rem; opacity: .8; margin-bottom: .5rem; }
.cv-conv-empty .t { font-size: 13px; font-weight: 700; color: var(--fg3); }
.cv-conv-empty .s { font-size: 12px; margin-top: .3rem; }

/* -----------------------------------------------
   ESTADOS (cargando / vacío / error)
   ----------------------------------------------- */
.state-box { text-align: center; padding: 2.8rem 1.2rem; color: var(--fg3); border: 1.5px dashed var(--bdr); border-radius: var(--r-card); background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.state-ico { font-size: 2rem; margin-bottom: .5rem; opacity: .85; }
.state-title { font-size: 14px; font-weight: 800; color: var(--fg2); margin-bottom: .3rem; }
.state-desc { font-size: 12.5px; color: var(--fgm); line-height: 1.5; }
.error-box { display: flex; gap: 11px; align-items: flex-start; padding: 1.1rem 1.2rem; border-radius: var(--r-lg); background: var(--note-bg-2); border: 1px solid var(--note-bdr); }
.error-box .ico { color: var(--warn); flex-shrink: 0; display: flex; }
.error-box .txt { font-size: 13px; color: var(--fg2); line-height: 1.5; }

/* -----------------------------------------------
   TOASTS  (conflicto rojo · warning ámbar · éxito verde)
   ----------------------------------------------- */
.cv-toast-wrap { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 1500; display: flex; flex-direction: column; gap: 10px; width: calc(100% - 28px); max-width: 440px; pointer-events: none; }
@media (min-width: 940px) { .cv-toast-wrap { left: auto; right: 24px; bottom: 24px; transform: none; align-items: flex-end; } }
.cv-toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--c-del); color: #fff; box-shadow: var(--sh-lg); pointer-events: auto; width: 100%; box-sizing: border-box;
  animation: cv-toast-in .3s cubic-bezier(.34,1.4,.64,1);
}
.cv-toast .ico { flex-shrink: 0; display: flex; margin-top: 1px; opacity: .95; }
.cv-toast .txt { font-size: 13px; font-weight: 600; line-height: 1.45; }
.cv-toast .txt b { font-weight: 800; }
.cv-toast.is-out { animation: cv-toast-out .3s ease forwards; }
@keyframes cv-toast-in  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cv-toast-out { to { opacity: 0; transform: translateY(12px); } }

/* -----------------------------------------------
   FAB (móvil) — exportar PDF
   ----------------------------------------------- */
.cv-fabbar { position: fixed; right: 16px; bottom: 18px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 940px) { .cv-fabbar { display: none; } }
.cv-fab { display: inline-flex; align-items: center; gap: 9px; min-height: 54px; padding: 0 22px; border-radius: var(--r-pill); border: none; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 800; box-shadow: var(--sh-lg); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.cv-fab.pdf { background: var(--c-pdf); color: var(--surf); }
body.theme-dark .cv-fab.pdf, body.theme-neon .cv-fab.pdf { color: #111827; }
.cv-fab:active:not(:disabled) { transform: scale(.95); }
.cv-fab:disabled { opacity: .5; cursor: not-allowed; }

/* -----------------------------------------------
   UTILIDADES + RESPONSIVE
   ----------------------------------------------- */
.hide-mobile { display: none; }
@media (min-width: 940px) { .hide-mobile { display: inline-flex; } }
.only-mobile { display: inline-flex; }
@media (min-width: 940px) { .only-mobile { display: none; } }

/* xs mobile (<480): un solo campo por fila, alturas táctiles cómodas */
@media (max-width: 479px) {
  .cv-grid { grid-template-columns: 1fr; }
  .cv-field.span2 { grid-column: span 1; }
  .cv-field input, .cv-field select { min-height: 52px; }
  .cv-actionbar { justify-content: space-between; }
}
/* mobile (480-599): el campo "span2" ocupa el ancho completo */
@media (min-width: 480px) and (max-width: 599px) {
  .cv-field.span2 { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .rtoggle.pop, .cv-toast, .rcard, .btn, .v2-chip, .cv-conv-head .count { animation: none !important; transition: none !important; }
}
