/* ============================================================
   VEX — Design System (vanilla, cero dependencias, sin build)
   Identidad: SaaS moderno, oscuro, limpio y tecnológico.
   ============================================================ */

:root {
  /* Superficies (capas de profundidad) — escala de grises neutra, sin tinte azul */
  --bg: #0a0a0b;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #17181b 0%, #0a0a0b 60%);
  --surface: #121213;
  --card: #171719;
  --panel: #1f2022;
  --panel-2: #292a2d;

  /* Texto */
  --text: #e9e9ea;
  --muted: #9b9ca0;
  --faint: #6d6e72;

  /* Marca / acentos — grafito metálico (sobrio, tono del logotipo), nada de celeste */
  --primary: #9aa0a8;
  --primary-hover: #b1b6bd;
  --primary-press: #7d828a;
  --primary-soft: rgba(160, 166, 176, 0.10);
  --accent: #b7bcc3;

  /* Verde de marca VEXS — acento SUTIL (uso reducido ~60%), para no restar seriedad */
  --brand: #22c55e;
  --brand-strong: #16a34a;
  --brand-hover: #5bb989;      /* verde más apagado para texto/íconos */
  --brand-soft: rgba(34, 197, 94, 0.05);
  --brand-soft-2: rgba(34, 197, 94, 0.09);
  --brand-glow: rgba(34, 197, 94, 0.14);

  /* Estados */
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --info: #60a5fa;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn-soft: rgba(251, 191, 36, 0.14);
  --err-soft: rgba(248, 113, 113, 0.14);

  /* Bordes y líneas */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 3px var(--primary-soft);

  /* Tokens compuestos — extraídos de valores antes "quemados" para permitir
     el tema claro SIN tocar estructura. En oscuro conservan su valor original. */
  --topbar-bg: rgba(11, 13, 18, 0.72);
  --input-bg: #0e1117;
  --input-bg-focus: #0f1320;
  --code-bg: #0e1117;
  --qa-hover-bg: #191a1c;
  --warn-strong: #b45309;
  --on-primary: #fff;
  --on-graphite: #ececed;
  --grad-graphite: linear-gradient(180deg, #3d4045, #2a2c30);
  --grad-graphite-hover: linear-gradient(180deg, #474a50, #333539);
  --grad-me: linear-gradient(180deg, #34363b, #26282c);

  /* Radios */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Tipografía */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs: 14.5px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 28px;

  /* Espaciado */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Transiciones */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  /* Curva de desaceleración suave (easeOutExpo-ish) para los paneles laterales. */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --drawer-t: 460ms;

  --maxw: 880px;
}

/* ============================================================
   TEMA CLARO — solo redefine COLORES (superficies, texto, líneas,
   sombras y tokens compuestos). Cero cambios de estructura/tamaños.
   Se activa con <html data-theme="light">.
   ============================================================ */
[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, #eef0f3 60%);
  --surface: #eef0f3;
  --card: #ffffff;
  --panel: #f1f3f5;
  --panel-2: #e6e8ec;

  --text: #1a1b1e;
  --muted: #55585f;
  --faint: #8a8d95;

  --primary: #6b7078;
  --primary-hover: #565b62;
  --primary-press: #4a4e55;
  --primary-soft: rgba(90, 96, 106, 0.12);
  --accent: #4b5560;

  --brand: #22c55e;
  --brand-strong: #16a34a;
  --brand-hover: #15803d;
  --brand-soft: rgba(34, 197, 94, 0.10);
  --brand-soft-2: rgba(34, 197, 94, 0.20);
  --brand-glow: rgba(34, 197, 94, 0.18);

  --ok: #16a34a;
  --warn: #b45309;
  --err: #dc2626;
  --info: #2563eb;
  --ok-soft: rgba(22, 163, 74, 0.12);
  --warn-soft: rgba(180, 83, 9, 0.12);
  --err-soft: rgba(220, 38, 38, 0.12);

  --line: rgba(18, 20, 24, 0.10);
  --line-strong: rgba(18, 20, 24, 0.16);

  --shadow-sm: 0 1px 2px rgba(20, 24, 31, 0.06);
  --shadow: 0 8px 24px rgba(20, 24, 31, 0.10);
  --shadow-lg: 0 20px 50px rgba(20, 24, 31, 0.14);

  /* Compuestos en claro */
  --topbar-bg: rgba(255, 255, 255, 0.72);
  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  --code-bg: #f1f3f5;
  --qa-hover-bg: #f0f2f5;
  --warn-strong: #b45309;
  /* Los degradados grafito y la burbuja propia se dejan OSCUROS a propósito:
     botón/burbuja de acento sobre fondo claro — es la identidad VEXS. */
}

/* El logotipo (JPG con fondo negro) se funde con el panel oscuro vía 'lighten'.
   En claro eso lo borraría, así que lo mostramos como una placa oscura. */
[data-theme="light"] .brand-mark {
  mix-blend-mode: normal; background: #0a0a0b; border-radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
::selection { background: var(--primary-soft); }

/* Scrollbars discretos */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Marca ---------------- */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo svg { display: block; border-radius: 9px; box-shadow: var(--shadow-sm); }
.wordmark { font-weight: 800; letter-spacing: 3px; font-size: var(--fs-md); }
.brand { display: inline-flex; align-items: center; font-weight: 800; letter-spacing: 3px; }
.brand.big { font-size: var(--fs-xl); }

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
}
.top-right { display: flex; align-items: center; gap: var(--sp-3); }
/* Cluster derecho del encabezado del chat: badge de plan + botón de paneles,
   alineados y pegados como un solo grupo. */
.head-right { display: flex; align-items: center; gap: 8px; }
.linkbtn {
  background: none; border: 1px solid transparent; color: var(--muted);
  cursor: pointer; font-size: var(--fs-sm); padding: 6px 10px; border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.linkbtn:hover { color: var(--text); background: var(--panel); border-color: var(--line); }

/* Badge / pill de estado con punto */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-xs); font-weight: 600;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
}
.badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 3px transparent;
}
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.err { color: var(--err); background: var(--err-soft); border-color: transparent; }

/* Badge de plan plegable: al encogerse queda un círculo con solo el punto.
   El despliegue es fluido: el texto se desliza y aparece mientras el badge
   se ensancha con una curva de desaceleración (sin saltos ni ancho fijo). */
#planBadge {
  cursor: pointer; gap: 0; overflow: visible;
  transition: padding 380ms var(--ease-out), background var(--t-fast);
}
#planBadge .badge-text {
  display: inline-block; max-width: 360px; overflow: hidden; white-space: nowrap;
  margin-left: 7px; opacity: 1; transform: translateX(0);
  transition: max-width 400ms var(--ease-out), opacity 300ms ease 80ms,
              margin 400ms var(--ease-out), transform 420ms var(--ease-out) 40ms;
}
/* Contador de tareas PRO (Claude) dentro del badge, resaltado como "chip". */
#planBadge .badge-pro {
  font-weight: 700; letter-spacing: .2px;
  background: linear-gradient(90deg, #7c5cff, #b45cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#planBadge.collapsed { padding: 8px; }
#planBadge.collapsed .badge-text {
  max-width: 0; opacity: 0; margin-left: 0; transform: translateX(-6px);
  transition: max-width 300ms var(--ease-out), opacity 160ms ease,
              margin 300ms var(--ease-out), transform 300ms var(--ease-out);
}

/* Estado "activo/en vivo": el punto verde respira e ilumina lento.
   Se aplica a los dos indicadores verdes: badge de estado e integración conectada. */
.badge.ok::before,
.integ-state.on::before { animation: liveGlow 2.4s ease-in-out infinite; }
@keyframes liveGlow {
  0%, 100% {
    box-shadow: 0 0 3px 0 rgba(52, 211, 153, 0.45), 0 0 0 0 rgba(52, 211, 153, 0.30);
    opacity: 0.82;
  }
  50% {
    box-shadow: 0 0 9px 2px rgba(52, 211, 153, 0.85), 0 0 0 4px rgba(52, 211, 153, 0.10);
    opacity: 1;
  }
}

/* ---------------- Botones ---------------- */
.btn {
  appearance: none; border: 1px solid var(--line-strong); border-radius: var(--r);
  cursor: pointer; padding: 11px 16px; font-size: var(--fs); font-weight: 600;
  font-family: inherit; background: var(--panel); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover { background: var(--panel-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
  background: var(--grad-graphite);
  border-color: var(--line-strong); color: var(--on-graphite);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.btn-primary:hover { background: var(--grad-graphite-hover); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55); }
.btn.mini { padding: 7px 12px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn svg { width: 16px; height: 16px; }
.btn-danger {
  background: var(--err-soft); border-color: transparent; color: var(--err);
}
.btn-danger:hover { background: var(--err); border-color: transparent; color: var(--on-primary); box-shadow: 0 6px 16px rgba(248, 113, 113, 0.32); }

/* ---------------- Inputs ---------------- */
input, textarea, select {
  width: 100%; background: var(--input-bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r); padding: 12px 13px;
  font: inherit; margin-bottom: 4px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
/* Móvil: iOS/Telegram hacen ZOOM automático al enfocar un campo con fuente <16px,
   y eso "acerca la pantalla sola". Forzar 16px en pantallas chicas lo evita. */
@media (max-width: 640px) {
  input, textarea, select { font-size: 16px; }
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring); background: var(--input-bg-focus);
}
select {
  appearance: none; cursor: pointer;
  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='%2398a0af' stroke-width='2.2' 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: 38px;
}
label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin: 14px 0 6px; letter-spacing: 0.2px; }
.row { display: flex; gap: var(--sp-2); align-items: center; }
.row input { margin-bottom: 0; }

/* ---------------- Chat ---------------- */
.chat-body { display: flex; flex-direction: column; height: 100dvh; }
.chat {
  flex: 1; overflow-y: auto; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 20px 18px; display: flex; flex-direction: column; gap: 12px;
}
.bubble {
  max-width: 80%; min-width: 0; padding: 12px 15px; border-radius: var(--r-lg); font-size: var(--fs);
  word-break: break-word; overflow-wrap: anywhere; line-height: 1.5; animation: fadeUp 260ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
/* Enlaces largos (URLs/tokens) dentro de una burbuja: que corten y no desborden. */
.bubble a { overflow-wrap: anywhere; word-break: break-word; }
.bubble.bot {
  background: var(--card); align-self: flex-start; border: 1px solid var(--line);
  border-bottom-left-radius: 5px; box-shadow: var(--shadow-sm);
}
.bubble.me {
  background: var(--grad-me); color: var(--on-graphite);
  align-self: flex-end; border: 1px solid var(--line-strong); border-bottom-right-radius: 5px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.bubble b { font-weight: 700; }
.bubble .out {
  white-space: pre-wrap; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 12px; margin: 10px 0 0; font-size: var(--fs-sm); line-height: 1.55;
  max-height: 280px; overflow: auto; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.bubble .dl { display: inline-flex; margin-top: 12px; text-decoration: none; }
/* Indicador "escribiendo / procesando" */
.bubble.bot i { color: var(--muted); font-style: normal; display: inline-flex; align-items: center; gap: 8px; }
.bubble.bot i::after {
  content: ""; width: 34px; height: 8px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 37%, var(--line) 63%);
  background-size: 400% 100%; animation: shimmer 1.2s ease-in-out infinite;
}

/* Botones de opción dentro de una burbuja (selector de curso/tarea) */
.opts { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 12px; max-width: 100%; }
.chip.opt {
  background: var(--panel); text-align: left; justify-content: flex-start;
  width: 100%; max-width: 100%; box-sizing: border-box;
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  border-radius: 14px; line-height: 1.35;
  animation: popIn 240ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
/* Opción seleccionada: usa el ACENTO del usuario (no gris), con destello elegante. */
.chip.picked {
  background: linear-gradient(180deg,
      color-mix(in srgb, var(--brand) 92%, #ffffff 8%),
      var(--brand-strong));
  color: var(--on-brand); font-weight: 700;
  border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, #ffffff 22%, transparent),
    0 8px 22px -6px var(--brand-glow),
    0 0 0 3px var(--brand-soft-2);
  animation: chipPickIn 460ms cubic-bezier(0.22, 1, 0.36, 1);
}
.chip.picked svg { opacity: 1; }
.chip.picked:hover { background: linear-gradient(180deg,
      color-mix(in srgb, var(--brand) 92%, #ffffff 8%),
      var(--brand-strong)); border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
/* Chip "Cancelar": tono discreto para diferenciarlo sin competir con las opciones. */
.chip.opt.cancel { color: var(--muted); opacity: 0.9; }
.chip:disabled { opacity: 0.45; cursor: default; transform: none; }

/* --- Dos superficies separadas: Acciones (botones/flujos) y Chat IA --- */
.surfaces { flex: 1; min-height: 0; display: flex; position: relative; }
.surface[hidden] { display: none !important; }

/* Contenedor de la zona inferior (menú + barra de entrada) */
.composer { position: relative; width: 100%; max-width: var(--maxw); margin: 0 auto; }
/* En la sección de Acciones NO hay caja de escritura: cada paso que pide texto
   abre su propio cajón en línea. El compositor de abajo es solo del Chat IA. */
.center[data-surface="acciones"] .composer { display: none; }

/* Botón "+" que abre el menú de acciones (estilo adjuntar de WhatsApp/Telegram) */
.iconbtn {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.iconbtn:hover { background: var(--panel-2); border-color: var(--primary); }
.iconbtn:active { transform: scale(0.92); }
.iconbtn:focus-visible { outline: none; box-shadow: var(--ring); }
.iconbtn svg { transition: transform var(--t); }
.iconbtn.open { background: var(--primary); border-color: transparent; color: var(--on-primary); }
.iconbtn.open svg { transform: rotate(45deg); } /* + se vuelve × al abrir */

/* Menú de acciones: panel flotante que se abre sobre la barra de entrada */
.actions {
  position: absolute; left: 16px; bottom: calc(100% + 8px); z-index: 40;
  display: none; flex-direction: column; gap: 6px;
  min-width: 250px; max-width: min(360px, calc(100% - 32px)); max-height: 62vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 8px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  scrollbar-width: thin;
}
.actions.open { display: flex; animation: popIn 180ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.actions .chip { white-space: normal; justify-content: flex-start; width: 100%; }
.actions.disabled { opacity: 0.5; pointer-events: none; }
.chip {
  white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 9px 15px; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), background var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
}
.chip:hover {
  background: var(--panel-2); border-color: var(--primary);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.chip:active { transform: translateY(0) scale(0.94); transition-duration: 90ms; }
.chip:focus-visible { outline: none; box-shadow: var(--ring); }
.chip svg { width: 15px; height: 15px; opacity: 0.85; transition: transform var(--t), opacity var(--t); }
.chip:hover svg { opacity: 1; transform: scale(1.12); }

/* Aparición en cascada de la barra de acciones (efecto "resorte" suave). */
.actions .chip { animation: chipIn 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.actions .chip:nth-child(1) { animation-delay: 20ms; }
.actions .chip:nth-child(2) { animation-delay: 65ms; }
.actions .chip:nth-child(3) { animation-delay: 110ms; }
.actions .chip:nth-child(4) { animation-delay: 155ms; }
.actions .chip:nth-child(5) { animation-delay: 200ms; }
.actions .chip:nth-child(6) { animation-delay: 245ms; }
.actions .chip:nth-child(7) { animation-delay: 290ms; }
.actions .chip:nth-child(n+8) { animation-delay: 320ms; }

/* Barra de entrada */
.inputbar {
  display: flex; gap: 8px; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 12px 16px 16px; border-top: 1px solid var(--line); background: transparent;
}
.inputbar input[type="text"] { flex: 1 1 auto; margin-bottom: 0; border-radius: var(--r-pill); padding-left: 16px; }
.send { flex: 0 0 auto; border-radius: var(--r-pill); }
/* Botón "+" para adjuntar imagen al Chat. */
.attach {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface, #fff); color: inherit; cursor: pointer;
}
.attach:hover { background: var(--line); }
/* Vista previa del adjunto pendiente, encima del compositor (estilo ChatGPT). */
/* Zona de adjuntos pendientes: contenedor que ENVUELVE una ficha por archivo. */
.attach-chip {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 0 16px 8px;
  max-width: calc(100% - 32px);
}
.attach-chip .attach-item {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 14px; background: var(--surface, #fff);
  border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.06);
  font-size: 13px; max-width: min(320px, 100%); position: relative;
}
.attach-chip .attach-thumb {
  width: 44px; height: 44px; object-fit: cover; border-radius: 10px; flex: 0 0 auto;
  border: 1px solid var(--line);
}
.attach-chip .attach-ico {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--line); color: var(--muted, #666); flex: 0 0 auto;
}
.attach-chip .attach-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attach-chip .attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.attach-chip .attach-status { font-size: 11px; color: var(--muted, #888); }
.attach-chip .attach-status.ok { color: var(--brand, #2a7); }
.attach-chip .attach-x {
  flex: 0 0 auto; margin-left: 4px; border: 0; background: var(--line); color: inherit;
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; padding: 0;
}
.attach-chip .attach-x:hover { background: var(--danger, #e55); color: #fff; }
.attach-chip .attach-item.loading .attach-thumb, .attach-chip .attach-item.loading .attach-ico { animation: attach-pulse 1.1s ease-in-out infinite; }
@keyframes attach-pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* Archivo adjunto dentro de la burbuja del usuario (texto + archivo juntos). */
.bubble.me .msg-att.img { margin-bottom: 6px; }
.bubble.me .msg-att.img img {
  max-width: 260px; max-height: 260px; border-radius: 12px; display: block;
  border: 1px solid rgba(255,255,255,.25);
}
.bubble.me .msg-att.file {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 6px;
  padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.18);
}
.bubble.me .msg-att.file .attach-ico { width: 26px; height: 26px; }
.bubble.me .msg-att.file .attach-name { font-weight: 600; }
.bubble.me .msg-text { white-space: pre-wrap; }

/* ---------------- Cards / Auth ---------------- */
.center-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: var(--fs-md); font-weight: 700; letter-spacing: 0.2px; }
.auth-card { width: 100%; max-width: 380px; animation: fadeUp 300ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.auth-card .logo { justify-content: center; margin-bottom: 6px; }
.auth-card .btn { width: 100%; margin-top: 18px; }
.acc-meta { color: var(--muted); font-size: var(--fs-sm); margin: 4px 0; }
.err-text { color: var(--err); margin-top: 10px; min-height: 16px; font-size: var(--fs-sm); }

/* ---------------- Admin ---------------- */
.admin { max-width: 680px; margin: 0 auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; }
.admin .btn { width: 100%; margin-top: 14px; }
.admin .row .btn { width: auto; margin-top: 0; }
.clients { display: flex; flex-direction: column; gap: 10px; }
.client-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.client-row:hover { border-color: var(--line-strong); background: var(--panel-2); }
.client-row .btn.mini { width: auto; margin: 0; }

/* Confirmación de éxito con palomita animada (trazo dibujado) */
.ok-check { display: inline-flex; align-items: center; gap: 10px; color: var(--ok); font-weight: 600; }
.ok-check svg { width: 26px; height: 26px; flex: 0 0 auto; }
.ok-check .ring, .ok-check .chk { stroke-dasharray: 1; stroke-dashoffset: 1; }
.ok-check .ring { animation: draw 460ms ease forwards; }
.ok-check .chk { animation: draw 340ms cubic-bezier(0.65, 0, 0.45, 1) forwards 280ms; }

/* ---------------- Animaciones ---------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes chipIn { from { opacity: 0; transform: translateY(10px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes chipPick { 0% { transform: scale(1); } 45% { transform: scale(1.1); } 100% { transform: scale(1); } }
/* Selección elegante: pequeño resorte + halo del acento que florece y se apaga. */
@keyframes chipPickIn {
  0%   { transform: scale(0.985); box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 22%, transparent), 0 8px 22px -6px var(--brand-glow), 0 0 0 0 color-mix(in srgb, var(--brand) 60%, transparent); }
  45%  { transform: scale(1.035); box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 28%, transparent), 0 10px 26px -6px var(--brand-glow), 0 0 0 7px color-mix(in srgb, var(--brand) 32%, transparent); }
  100% { transform: scale(1); box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 22%, transparent), 0 8px 22px -6px var(--brand-glow), 0 0 0 3px var(--brand-soft-2); }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------------- Responsive ---------------- */
@media (min-width: 720px) {
  .bubble { max-width: 72%; }
  .actions { left: 12px; right: 12px; max-width: none; }
}
@media (max-width: 480px) {
  :root { --fs: 14px; }
  .bubble { max-width: 88%; }
  .topbar { padding: 11px 14px; }
  .chat { padding: 16px 14px; }
  /* En teléfono el toggle de tema suelto se retira: el modo vive en Apariencia,
     y así el título no queda apretado ni se parte. */
  #themeToggle { display: none; }
}

/* Documentos de un curso: agrupados por tarea, cada archivo un enlace. */
.doc-task { margin-top: 10px; }
.doc-head { font-weight: 600; margin-bottom: 6px; opacity: .9; }
.doc-task .dl { display: inline-flex; margin: 0 6px 6px 0; }
.hint { margin-top: 10px; font-size: 12px; opacity: .7; }
.hint.warn { opacity: 1; color: var(--warn-strong); font-weight: 600; }
.approval { border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 12px; background: rgba(148,163,184,.08); }
.approval-title { margin-bottom: 6px; }
.approval-lines > div { font-size: 14px; margin: 2px 0; overflow-wrap: anywhere; word-break: break-word; }

/* ============================================================
   Dashboard shell (3 columnas) — inspirado en la maqueta VEXS.
   El chat vive en el centro; los datos reales en el riel derecho.
   ============================================================ */
.app-body { height: 100dvh; overflow: hidden; }
.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 336px;
  height: 100dvh; width: 100%;
  transition: grid-template-columns var(--drawer-t) var(--ease-out);
}
/* Colapso de columnas en escritorio: la columna se encoge a 0 (se conservan las
   3 columnas para no romper el grid) y el panel se desvanece deslizándose. */
.app-shell.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr) 336px; }
.app-shell.rail-collapsed { grid-template-columns: 236px minmax(0, 1fr) 0; }
.app-shell.nav-collapsed.rail-collapsed { grid-template-columns: 0 minmax(0, 1fr) 0; }
.side-nav { overflow: hidden; }
.rail { overflow-x: hidden; }

/* Solo escritorio: el efecto de desvanecer/deslizar al colapsar una columna.
   Aislado en min-width para no interferir con los drawers de móvil. */
@media (min-width: 901px) {
  .app-shell > .side-nav,
  .app-shell > .rail {
    transition: opacity 240ms ease, transform var(--drawer-t) var(--ease-out);
    will-change: transform, opacity;
  }
  .app-shell.nav-collapsed > .side-nav { opacity: 0; transform: translateX(-32px); pointer-events: none; }
  .app-shell.rail-collapsed > .rail { opacity: 0; transform: translateX(32px); pointer-events: none; }
}

/* ---- Sidebar izquierdo ---- */
.side-nav {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: 18px 14px; border-right: 1px solid var(--line);
  background: var(--surface); min-height: 0;
}
.side-brand { padding: 6px 8px 14px; display: flex; align-items: center; }
.brand-mark {
  width: 132px; height: auto; display: block;
  /* El logo trae fondo negro: 'lighten' lo funde en el panel oscuro. */
  mix-blend-mode: lighten;
}
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: var(--r); cursor: pointer;
  background: none; border: 1px solid transparent; color: var(--muted);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; text-align: left;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.nav-item svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--text); border-color: var(--brand-soft-2); }
.nav-item.active svg { color: var(--brand-hover); }

.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px; border-top: 1px solid var(--line); border-radius: 0;
}
.avatar {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: 700; color: var(--on-graphite);
  background: var(--grad-graphite);
  border: 1px solid var(--line-strong);
  text-transform: uppercase;
}
.side-user-info { min-width: 0; flex: 1; }
.side-user-name { font-size: var(--fs-sm); font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: var(--fs-xs); color: var(--faint); text-transform: capitalize; }
.side-user .linkbtn { padding: 6px; }

/* ---- Centro ---- */
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.center-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.center-title { display: flex; align-items: center; gap: 12px; }
.center-title h1 { margin: 0; font-size: var(--fs-md); font-weight: 700; letter-spacing: 0.2px; }
.center-title .sub { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--faint); }
.spark {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-hover);
}
.center .chat { max-width: 780px; }
.center .composer, .center .inputbar { max-width: 780px; }

/* ---- Riel derecho ---- */
.rail {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 16px; border-left: 1px solid var(--line);
  background: var(--surface); overflow-y: auto; min-height: 0;
}
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; cursor: pointer; user-select: none; }
.panel-head h3 { margin: 0; font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.2px; }
.panel-head-right { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.panel-link { background: none; border: none; color: var(--primary-hover); font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: var(--r-sm); }
.panel-link:hover { background: var(--primary-soft); }

/* Flecha de plegado: gira -90° cuando el panel está colapsado. */
.panel-caret { width: 16px; height: 16px; flex: 0 0 auto; color: var(--faint); transition: transform var(--t), color var(--t-fast); }
.panel-head:hover .panel-caret { color: var(--text); }
.panel.collapsed .panel-caret { transform: rotate(-90deg); }
.panel.collapsed .panel-head { margin-bottom: 0; }

/* Contenedor retráctil: anima la altura con grid (1fr -> 0fr), suave y sin saltos. */
.panel-collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--drawer-t) var(--ease-out); }
.panel.collapsed .panel-collapse { grid-template-rows: 0fr; }
/* Expandido: el cuerpo hace scroll propio si crece (evita que quede recortado
   sin poder desplazarse). Colapsado: overflow oculto para que la animación de
   altura no muestre saltos. */
.panel-collapse > .panel-body { overflow-y: auto; min-height: 0; max-height: 58vh; }
.panel.collapsed .panel-collapse > .panel-body { overflow: hidden; }

.panel-body { display: flex; flex-direction: column; gap: 8px; }
.panel-empty { font-size: var(--fs-sm); color: var(--faint); padding: 4px 0; }

/* Fila de tarea en un panel */
.pitem { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: var(--r); transition: background var(--t-fast); text-decoration: none; color: inherit; }
.pitem:hover { background: var(--panel); }
.pitem .dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--muted); }
.pitem.due-over .dot { background: var(--err); }
.pitem.due-soon .dot { background: var(--warn); }
.pitem.due-ok .dot { background: var(--ok); }
.pitem-main { min-width: 0; flex: 1; }
.pitem-name { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem-meta { display: block; font-size: var(--fs-xs); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem-when { display: block; margin-top: 2px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); white-space: nowrap; }
.pitem-when.over { color: var(--err); }
.pitem-when.soon { color: var(--warn); }
/* Fila-tarea clicable (abre el hilo): reset de botón para que se vea como fila. */
button.pitem { width: 100%; text-align: left; border: 0; background: transparent; font: inherit; cursor: pointer; }
button.pitem:hover { background: var(--panel); }
.pitem-new .pitem-name { font-weight: 700; }
.pitem-badge { display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 10px; font-weight: 700; line-height: 16px; border-radius: 8px; background: var(--accent, #6c8cff); color: #fff; vertical-align: middle; }
.newcount { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; font-size: 11px; font-weight: 700; border-radius: 9px; background: var(--err); color: #fff; }

/* Barra superior del hilo de una tarea */
.thread-bar { display: none; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.thread-back { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; padding: 4px 6px; border-radius: var(--r); }
.thread-back:hover { color: var(--text); background: var(--bg); }
.thread-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.thread-title b { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-course { font-size: var(--fs-xs); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-tools { margin-left: auto; flex: 0 0 auto; display: flex; gap: 8px; }
.thread-rubric, .thread-pdf { flex: 0 0 auto; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-weight: 700; font-size: var(--fs-xs); cursor: pointer; padding: 6px 10px; border-radius: var(--r); white-space: nowrap; }
.thread-rubric:hover, .thread-pdf:hover { border-color: var(--accent, #6c8cff); color: var(--accent, #6c8cff); }
.thread-pdf { background: var(--accent, #6c8cff); color: #fff; border-color: transparent; }
.thread-pdf:hover { color: #fff; opacity: .92; }

/* Rubric Engine — tarjeta Quality Score */
.rubric { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rubric-head { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.rubric-score { font-size: 30px; font-weight: 800; line-height: 1; }
.rubric-score span { font-size: var(--fs-sm); font-weight: 700; color: var(--faint); }
.rubric-score.ok { color: var(--ok); }
.rubric-score.warn { color: var(--warn); }
.rubric-score.err { color: var(--err); }
.rubric-sub { font-size: var(--fs-sm); color: var(--muted); }
.rubric-list { display: flex; flex-direction: column; }
.rubric-row { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.rubric-row:last-child { border-bottom: 0; }
.rubric-ico { flex: 0 0 auto; }
.rubric-crit { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rubric-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.rubric-pts { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.rubric-reason { font-size: var(--fs-xs); color: var(--faint); }
.rubric-foot { padding: 8px 12px; font-size: var(--fs-xs); color: var(--faint); background: var(--panel); }

/* Reporte del estudiante: rejilla de métricas */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.stat-num { font-size: var(--fs-lg); font-weight: 800; line-height: 1.1; }
.stat-num.warn { color: var(--warn); }
.stat-num.err { color: var(--err); }
.stat-num.ok { color: var(--ok); }
.stat-label { font-size: var(--fs-xs); color: var(--faint); margin-top: 2px; }

/* Integraciones conectadas */
.integ { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px; border-radius: var(--r); }
.integ-name { font-size: var(--fs-sm); font-weight: 600; }
.integ-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.integ-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.integ-state.on { color: var(--ok); }
.integ-state.off { color: var(--faint); }

/* ---- Botones de cabecera solo-móvil / cierre de drawers ---- */
.iconbtn.ghost { width: 40px; height: 40px; background: transparent; border-color: var(--line); }
.iconbtn.ghost:hover { background: var(--panel); }
/* Los toggles viven en todos los tamaños: en escritorio colapsan la columna,
   en teléfono abren el panel deslizante. */
.mobile-only, .rail-only { display: inline-flex; }
.drawer-close {
  display: none; position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer;
}
.backdrop {
  position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.5);
  opacity: 0; transition: opacity 320ms var(--ease-out), backdrop-filter 320ms ease;
  -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0);
}
.backdrop.show { opacity: 1; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* Aparición en cascada del contenido cuando el drawer entra (se siente "vivo"). */
@keyframes drawerRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Responsive — 2 modos:
   > 900px  : escritorio/laptop. 3 columnas; cada toggle COLAPSA su columna
              (inline, el chat se ensancha). Ideal para quien quiere menos ruido.
   <= 900px : teléfono/tablet angosta. Una columna; ambas barras son paneles
              deslizantes (drawers) con backdrop.
   ============================================================ */
@media (max-width: 900px) {
  /* En modo drawer el colapso inline no aplica: las barras se superponen. */
  .app-shell,
  .app-shell.nav-collapsed,
  .app-shell.rail-collapsed,
  .app-shell.nav-collapsed.rail-collapsed { grid-template-columns: minmax(0, 1fr); }
  /* En móvil el colapso de escritorio no debe afectar: los drawers mandan. */
  .app-shell.nav-collapsed > .side-nav,
  .app-shell.rail-collapsed > .rail { opacity: 1; pointer-events: auto; }

  /* Barra izquierda: drawer desde la izquierda, con curva de desaceleración. */
  .side-nav {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: min(268px, 84vw); height: 100dvh;
    transform: translateX(-100%); transition: transform var(--drawer-t) var(--ease-out);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.55); will-change: transform;
  }
  .app-shell.nav-collapsed > .side-nav { transform: translateX(-100%); }
  .side-nav.open,
  .app-shell.nav-collapsed > .side-nav.open { transform: translateX(0); }
  .side-nav .drawer-close { display: inline-flex; }

  /* Riel derecho: drawer desde la derecha. */
  .rail {
    position: fixed; top: 0; right: 0; z-index: 50;
    width: min(340px, 86vw); height: 100dvh; padding-top: 56px;
    transform: translateX(100%); transition: transform var(--drawer-t) var(--ease-out);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55); will-change: transform;
  }
  .app-shell.rail-collapsed > .rail { transform: translateX(100%); }
  .rail.open,
  .app-shell.rail-collapsed > .rail.open { transform: translateX(0); }
  .rail .drawer-close { display: inline-flex; }

  /* Cascada del contenido al abrir: los ítems entran escalonados. */
  .side-nav.open .nav-item,
  .rail.open .panel { animation: drawerRise 520ms var(--ease-out) both; }
  .side-nav.open .nav-item:nth-child(2) { animation-delay: 40ms; }
  .side-nav.open .nav-item:nth-child(3) { animation-delay: 80ms; }
  .side-nav.open .nav-item:nth-child(4) { animation-delay: 120ms; }
  .side-nav.open .nav-item:nth-child(5) { animation-delay: 160ms; }
  .side-nav.open .nav-item:nth-child(6) { animation-delay: 200ms; }
  .rail.open .panel:nth-child(2) { animation-delay: 60ms; }
  .rail.open .panel:nth-child(3) { animation-delay: 120ms; }
  .rail.open .panel:nth-child(4) { animation-delay: 180ms; }
  .rail.open .panel:nth-child(5) { animation-delay: 240ms; }

  .brand-mark { width: 120px; }
  .center-head { padding: 12px 14px; gap: 10px; }
  .center-title h1 { font-size: var(--fs); }
  .center .chat { padding: 16px 14px; }

  /* Teléfono: el badge de plan y el botón de paneles forman un par pegado.
     El badge encogido crece a un círculo del mismo diámetro que el botón (40px)
     para que se vean como dos gemelos alineados, no como dos piezas sueltas. */
  .head-right { gap: 6px; flex: 0 0 auto; }
  #planBadge.collapsed { padding: 13px; }
  /* El título no debe empujar al cluster ni partirse en dos líneas. */
  .center-title { min-width: 0; flex: 1 1 auto; }
  .center-title > div { min-width: 0; }
  .center-title h1,
  .center-title .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* En teléfono el botón Enviar se reduce a solo el icono para dar aire al texto. */
  .send span { display: none; }
  .send { padding: 12px; }
}

/* ================= Pantalla de inicio (acciones destacadas) ================= */
/* Prioriza los botones sobre el texto: el usuario ve de un vistazo qué puede
   hacer y ejecuta con un clic, sin gastar en interpretar lenguaje natural. */
.home {
  display: flex; flex-direction: column; gap: 26px;
  padding: 8px 2px 12px;
  animation: homeIn 420ms var(--ease-out) both;
}
@keyframes homeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.home-hero h2 {
  margin: 0; font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.4px;
}
.home-hero h2 .accent { color: var(--brand-hover); }
.home-hero .home-lede { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-md); }

/* --- Bienvenida centrada --- */
.home-hero--center { text-align: center; padding-top: 10px; }
.home-hero--center .home-lede { margin-top: 6px; }

/* --- Tarjetas grandes horizontales (iluminadas) --- */
.lead-cards { display: flex; flex-direction: column; gap: 12px; }
.lead-card {
  position: relative; text-align: left; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 18px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line);
  color: var(--text);
  transition: transform var(--t-fast), border-color var(--t), box-shadow var(--t), background var(--t);
}
.lead-card:active { transform: translateY(0) scale(0.995); }
.lead-card:focus-visible { outline: none; box-shadow: var(--ring); }
/* Iluminación dinámica: la luz de marca SUAVE y difusa (glow interno + halo
   externo, sin borde duro) NO está fija en un botón. En reposo brilla el botón
   destacado (.is-primary, el más usado). Al pasar el cursor —o al enfocar con
   teclado— la luz SIGUE al botón bajo el cursor y el destacado se apaga, de modo
   que solo un botón brilla a la vez: el que se está seleccionando.
   Usa var(--brand): respeta el acento y la transparencia que elija el usuario. */
.lead-card.is-primary,
.lead-card.is-sel,
.lead-card:hover,
.lead-card:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 20%, transparent);
  box-shadow:
    inset 0 0 48px -8px color-mix(in srgb, var(--brand) 40%, transparent),
    0 0 56px -10px color-mix(in srgb, var(--brand) 38%, transparent),
    0 10px 30px rgba(0,0,0,0.38);
}
/* El botón realmente apuntado (hover/foco) o el YA seleccionado brilla un poco
   más fuerte y se eleva. */
.lead-card.is-sel,
.lead-card:hover,
.lead-card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
  box-shadow:
    inset 0 0 60px -6px color-mix(in srgb, var(--brand) 50%, transparent),
    0 0 68px -8px color-mix(in srgb, var(--brand) 46%, transparent),
    0 14px 34px rgba(0,0,0,0.42);
}
.lead-card:focus-visible { outline: none; }
/* El destacado en reposo (.is-primary) se apaga si NO es el elegido: cuando hay
   una selección activa (.has-sel, incluida la lista "Más opciones", que es otro
   grupo), o al apuntar/enfocar cualquier tarjeta del inicio. Así SIEMPRE brilla
   uno solo, también en móvil (donde no hay :hover). */
#homeView.has-sel .lead-card.is-primary:not(.is-sel),
#homeView:has(.lead-card:hover) .lead-card.is-primary:not(:hover):not(.is-sel),
#homeView:has(.lead-card:focus-visible) .lead-card.is-primary:not(:focus-visible):not(.is-sel) {
  border-color: var(--line);
  box-shadow: none;
}
.lead-ico {
  width: 48px; height: 48px; border-radius: 13px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft-2); color: var(--brand-hover);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 16%, transparent);
  transition: transform var(--t), box-shadow var(--t);
}
.lead-ico svg { width: 24px; height: 24px; }
/* El icono se ilumina en el mismo botón que lleva la luz: destacado en reposo,
   o el que esté bajo el cursor/foco. */
.lead-card.is-primary .lead-ico,
.lead-card.is-sel .lead-ico,
.lead-card:hover .lead-ico,
.lead-card:focus-visible .lead-ico {
  color: var(--brand);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 34%, transparent),
              0 0 20px -4px var(--brand-glow);
}
/* Si se elige otro botón, el icono del destacado en reposo vuelve a lo normal. */
#homeView.has-sel .lead-card.is-primary:not(.is-sel) .lead-ico,
#homeView:has(.lead-card:hover) .lead-card.is-primary:not(:hover):not(.is-sel) .lead-ico,
#homeView:has(.lead-card:focus-visible) .lead-card.is-primary:not(:focus-visible):not(.is-sel) .lead-ico {
  color: var(--brand-hover);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 16%, transparent);
}
.lead-card:hover .lead-ico { transform: scale(1.05); }
.lead-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.lead-title { font-size: var(--fs-md); font-weight: 700; letter-spacing: -0.2px; }
.lead-sub { font-size: var(--fs-sm); color: var(--muted); }
.lead-arrow { flex: 0 0 auto; color: var(--faint); display: inline-flex; transition: color var(--t), transform var(--t); }
.lead-arrow svg { width: 20px; height: 20px; }
.lead-card:hover .lead-arrow { color: var(--brand-hover); transform: translateX(3px); }

/* --- Botón "Más opciones" (pastilla centrada) --- */
.more-wrap { display: flex; justify-content: center; margin: -6px 0 -8px; }
.more-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r-pill);
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.more-toggle:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }
.more-caret { display: inline-flex; transition: transform var(--t); }
.more-caret svg { width: 16px; height: 16px; }
.more-toggle.is-open .more-caret { transform: rotate(180deg); }

/* --- Tarjeta resumen de pendientes --- */
.home-pending {
  text-align: left; cursor: pointer; width: 100%;
  padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  transition: transform var(--t-fast), border-color var(--t), box-shadow var(--t);
}
.home-pending:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.hp-head { display: flex; align-items: center; gap: 10px; }
.hp-ico { color: var(--brand-hover); display: inline-flex; flex: 0 0 auto; }
.hp-ico svg { width: 20px; height: 20px; }
.hp-count { font-size: var(--fs); font-weight: 700; flex: 1; min-width: 0; }
.hp-all {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--panel); color: var(--brand-hover);
  font-size: var(--fs-xs); font-weight: 600;
}
.hp-all svg { width: 14px; height: 14px; }
.hp-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.hp-item { display: flex; align-items: center; gap: 10px; padding: 6px 2px; }
.hp-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--brand); }
.hp-dot.over { background: var(--err); }
.hp-dot.soon { background: var(--warn); }
.hp-name { flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-when { flex: 0 0 auto; font-size: var(--fs-xs); color: var(--faint); }
.hp-when.over { color: var(--err); }
.hp-when.soon { color: var(--warn); }

/* --- VEXS Today (Lote 1): chip de racha + "¿Qué hacemos primero?" --- */
.streak-chip {
  display: inline-block; margin-top: 10px;
  padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand-hover);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .01em;
}
.today-first {
  text-align: left; cursor: pointer; width: 100%;
  padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--brand-soft); color: var(--text);
  transition: transform var(--t-fast), border-color var(--t), box-shadow var(--t);
}
.today-first:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); }
.today-first.is-clear { cursor: default; border-color: var(--line); }
.today-first.is-clear:hover { transform: none; box-shadow: none; border-color: var(--line); }
.tf-head { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tf-task { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.tf-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--brand); }
.tf-dot.over { background: var(--err); }
.tf-dot.soon { background: var(--warn); }
.tf-dot.ok { background: var(--ok); }
.tf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tf-name { font-size: var(--fs); font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-meta { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-when { flex: 0 0 auto; font-size: var(--fs-xs); font-weight: 700; color: var(--faint); }
.tf-when.over { color: var(--err); }
.tf-when.soon { color: var(--warn); }
.tf-cta {
  margin-top: 14px; display: inline-block;
  padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--brand); color: #fff; font-size: var(--fs-sm); font-weight: 700;
}
.tf-clear { display: flex; align-items: center; gap: 10px; }
.tf-clear-txt { font-size: var(--fs-sm); color: var(--muted); }

/* --- Barra "Preguntar a VEXS" (lleva al Chat IA) --- */
.home-ask {
  display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer;
  padding: 12px 12px 12px 16px; border-radius: var(--r-pill);
  background: var(--input-bg); border: 1px solid var(--line); color: var(--muted);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.home-ask:hover { border-color: var(--line-strong); }
.home-ask:focus-visible { outline: none; box-shadow: var(--ring); }
.ask-plus { display: inline-flex; color: var(--faint); flex: 0 0 auto; }
.ask-plus svg { width: 20px; height: 20px; }
.ask-ph { flex: 1; text-align: left; font-size: var(--fs); color: var(--faint); }
.ask-send {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel); color: var(--text);
  transition: background var(--t-fast), color var(--t-fast);
}
.home-ask:hover .ask-send { background: var(--brand); color: #fff; }
.ask-send svg { width: 17px; height: 17px; }

/* --- Cuadrícula de acciones rápidas --- */
.qa-head { display: flex; align-items: baseline; justify-content: space-between; margin: 2px 0 -8px; }
.qa-head h4 { margin: 0; font-size: var(--fs-md); font-weight: 700; }
.qa-head .qa-all {
  background: none; border: none; color: var(--brand-hover); cursor: pointer;
  font: inherit; font-size: var(--fs-sm); font-weight: 600; padding: 4px 6px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; gap: 4px; transition: background var(--t-fast);
}
.qa-head .qa-all:hover { background: var(--brand-soft); }

.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
/* "Más opciones": mismo formato de tarjeta grande que las destacadas (lista
   vertical), no la parrilla de botones pequeños. */
.more-list { margin-top: 2px; }
.more-list[hidden] { display: none; } /* el atributo hidden debe ganar al display:flex */
.lead-card.qa-reveal { animation: qaReveal 320ms var(--ease-out) both; }
.qa-card.qa-hidden { display: none; }
.qa-card.qa-reveal { animation: qaReveal 320ms var(--ease-out) both; }
@keyframes qaReveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.qa-card {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 12px;
  padding: 15px; border-radius: var(--r); min-height: 118px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  transition: transform var(--t-fast), border-color var(--t), box-shadow var(--t), background var(--t);
}
.qa-card:hover { transform: translateY(-2px); border-color: var(--line-strong); background: var(--qa-hover-bg); box-shadow: var(--shadow); }
.qa-card:active { transform: translateY(0) scale(0.98); }
.qa-card:focus-visible { outline: none; box-shadow: var(--ring); }
.qa-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); color: var(--brand-hover);
  transition: background var(--t), color var(--t), transform var(--t);
}
.qa-ico svg { width: 20px; height: 20px; }
.qa-card:hover .qa-ico { background: var(--panel-2); transform: scale(1.06); }
.qa-body { margin-top: auto; }
.qa-title { display: block; font-size: var(--fs); font-weight: 650; line-height: 1.2; }
.qa-sub { display: block; margin-top: 3px; font-size: var(--fs-xs); color: var(--faint); }

/* --- Consejo VEXS --- */
.home-tip {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  font-size: var(--fs-sm);
}
.home-tip .tip-ico { color: var(--brand-hover); flex: 0 0 auto; display: inline-flex; }
.home-tip .tip-ico svg { width: 18px; height: 18px; }
.home-tip b { color: var(--brand-hover); font-weight: 700; }

@media (max-width: 620px) {
  .home-hero h2 { font-size: 24px; }
  .lead-card { padding: 15px 15px; gap: 13px; }
  .lead-ico { width: 44px; height: 44px; }
  .qa-grid { grid-template-columns: repeat(2, 1fr); }
  .qa-card { min-height: 104px; padding: 13px; }
}

/* ============================================================
   Botón de tema (claro/oscuro) — muestra el icono del modo al que cambiará.
   ============================================================ */
#themeToggle .ico-sun { display: inline-flex; }
#themeToggle .ico-moon { display: none; }
[data-theme="light"] #themeToggle .ico-sun { display: none; }
[data-theme="light"] #themeToggle .ico-moon { display: inline-flex; }
#themeToggle svg { width: 19px; height: 19px; }

/* ============================================================
   Animación de apertura (splash) — el logotipo aparece y se desvanece,
   luego revela la app. Fondo oscuro fijo (independiente del tema) para
   que el logo siempre luzca bien. Se reproduce en cada carga.
   ============================================================ */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: #0a0a0b;
  background-image: radial-gradient(1200px 600px at 50% 40%, #17181b 0%, #0a0a0b 62%);
  animation: splashOut 560ms var(--ease-out) 1120ms forwards;
}
.splash-logo {
  width: min(200px, 52vw); height: auto;
  mix-blend-mode: lighten;
  animation: splashLogo 1240ms var(--ease-out) both;
}
.splash.done { display: none; }
@keyframes splashLogo {
  0%   { opacity: 0; transform: scale(0.92); filter: blur(7px); }
  28%  { opacity: 1; transform: scale(1);    filter: blur(0); }
  72%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  .splash { animation: none; opacity: 0; visibility: hidden; }
  .splash-logo { animation: none; }
}

/* --- "Ponte a prueba": examen didáctico con animaciones de desplazamiento --- */
.quiz-host { width: 100%; }
.quiz {
  width: 100%; max-width: 560px; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow);
  overflow: hidden;
}
.quiz.fade { opacity: 0; transform: translateY(6px); transition: opacity .18s ease, transform .18s ease; }
.quiz-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.quiz-src { font-size: var(--fs-xs); color: var(--faint); flex: 0 1 auto; }
.quiz-count { font-size: var(--fs-xs); color: var(--muted); margin-left: auto; white-space: nowrap; }
.quiz-bar { flex: 1 1 auto; height: 5px; background: var(--panel); border-radius: var(--r-pill); overflow: hidden; min-width: 60px; }
.quiz-bar-fill { display: block; height: 100%; width: 0; background: var(--brand); border-radius: var(--r-pill); transition: width .4s cubic-bezier(.4,0,.2,1); }
.quiz-stage { position: relative; min-height: 120px; }

/* Entrada/salida de cada pregunta: desplazamiento elegante */
.quiz-q, .quiz-result { animation: quizSlideIn .32s cubic-bezier(.22,.61,.36,1) both; }
.quiz-q.enter, .quiz-result.enter { opacity: 0; transform: translateX(24px); }
@keyframes quizSlideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

.quiz-qtext { font-size: var(--fs-md); font-weight: 650; line-height: 1.4; margin-bottom: 4px; }
.quiz-hint { font-size: var(--fs-xs); color: var(--faint); margin-bottom: 10px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.quiz-opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); border-radius: var(--r-md, 12px); cursor: pointer;
  font-size: var(--fs-sm); transition: border-color .15s, background .15s, transform .08s;
}
.quiz-opt:hover { border-color: var(--line-strong); background: var(--panel-2); }
.quiz-opt:active { transform: scale(.99); }
.quiz-opt.sel { border-color: var(--brand); background: var(--brand-soft-2); }
.quiz-mark { flex: 0 0 auto; width: 18px; height: 18px; border: 2px solid var(--line-strong); display: inline-block; position: relative; transition: border-color .15s, background .15s; }
.quiz-mark.ci { border-radius: 50%; }
.quiz-mark.sq { border-radius: 5px; }
.quiz-opt.sel .quiz-mark { border-color: var(--brand); background: var(--brand); }
.quiz-opt.sel .quiz-mark::after { content: ''; position: absolute; inset: 0; margin: auto; width: 6px; height: 10px; border: solid var(--on-brand, #08130c); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px,-1px); }
.quiz-mark.ci::after { border-radius: 0; }

.quiz-nav { display: flex; align-items: center; gap: 4px; margin-top: 16px; }

/* Resultado */
.quiz-score { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 14px; }
.quiz-pct { font-size: 40px; font-weight: 800; color: var(--brand); line-height: 1; }
.quiz-scoresub { font-size: var(--fs-sm); color: var(--muted); }
.quiz-review { padding: 10px 12px; border-radius: var(--r-md, 12px); border: 1px solid var(--line); margin-top: 8px; background: var(--panel); }
.quiz-review.ok { border-color: rgba(52,211,153,.35); background: var(--ok-soft); }
.quiz-review.bad { border-color: rgba(248,113,113,.35); background: var(--err-soft); }
.quiz-rq { font-weight: 600; font-size: var(--fs-sm); margin-bottom: 4px; }
.quiz-ra { font-size: var(--fs-xs); color: var(--text); }
.quiz-rx { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .quiz-q, .quiz-result { animation: none; }
  .quiz-q.enter, .quiz-result.enter { opacity: 1; transform: none; }
}

/* --- Panel admin: búsqueda, resumen y controles de suscripción --- */
.search {
  width: 100%; margin-bottom: 12px; box-sizing: border-box;
}
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 10px; text-align: center;
}
.stat-n { font-size: var(--fs-lg); font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-l { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.stat.good .stat-n { color: var(--ok); }
.stat.warn .stat-n { color: var(--warn); }
.stat.bad .stat-n { color: var(--err); }

.sub-row { flex-direction: column; align-items: stretch; gap: 10px; }
.sub-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sub-meta { text-align: right; white-space: nowrap; }
.sub-days { font-weight: 600; color: var(--text); font-size: var(--fs-sm); }
.sub-days.soon { color: var(--warn); }
.sub-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-controls .btn.mini { width: auto; margin: 0; }

/* ============ Panel de Apariencia (personalización de usuario) ============ */
.appr-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: apprFade 160ms ease both;
}
.appr-overlay[hidden] { display: none; }
@keyframes apprFade { from { opacity: 0; } to { opacity: 1; } }
.appr-card {
  width: min(480px, 100%); max-height: min(88vh, 760px);
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: apprPop 200ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes apprPop { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.appr-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}
.appr-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 700; }
.appr-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  cursor: pointer; transition: color var(--t-fast), background var(--t-fast);
}
.appr-x:hover { color: var(--text); background: var(--panel-2); }
.appr-body { padding: 6px 18px 4px; overflow-y: auto; }
.appr-sec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.appr-sec:last-child { border-bottom: none; }
.appr-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.appr-hint { font-size: var(--fs-sm); color: var(--muted); margin-top: 8px; line-height: 1.4; }

/* Temas listos */
.appr-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.appr-preset {
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel); cursor: pointer; padding: 0; overflow: hidden;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.appr-preset:hover { transform: translateY(-2px); border-color: var(--primary); }
.appr-preset.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft-2); }
.appr-preset-sw { height: 40px; display: flex; }
.appr-preset-sw i { flex: 1; }
.appr-preset-name { display: block; padding: 6px 6px; font-size: 11.5px; font-weight: 600; color: var(--text); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Segmentados (modo, botones) */
.appr-seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.appr-seg-4 { grid-template-columns: repeat(4, 1fr); }
.appr-seg-btn {
  padding: 9px 8px; font-size: var(--fs-sm); font-weight: 600; font-family: inherit;
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.appr-seg-btn:hover { color: var(--text); background: var(--panel-2); }
.appr-seg-btn.active { color: var(--on-brand, #fff); background: var(--brand); border-color: transparent; }

/* Swatches (acento y tono de fondo) */
.appr-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.appr-tones { grid-template-columns: repeat(5, 1fr); }
.appr-sw {
  width: 100%; aspect-ratio: 1; border-radius: 50%;
  border: 2px solid var(--line-strong); cursor: pointer; padding: 0;
  position: relative; transition: transform var(--t-fast), border-color var(--t-fast);
}
.appr-sw:hover { transform: scale(1.1); }
.appr-sw.active { border-color: var(--text); }
.appr-sw.active::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.appr-tones .appr-sw { border-radius: var(--r-sm); }

.appr-custom, .appr-range {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; font-size: var(--fs-sm); color: var(--muted);
}
/* La etiqueta se encoge con puntos suspensivos; el control nunca la empuja fuera. */
.appr-custom > span, .appr-range > span {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.appr-custom input[type="color"] {
  flex: 0 0 auto; width: 40px; height: 26px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: none; cursor: pointer;
}
.appr-range input[type="range"] { flex: 0 0 46%; width: 46%; accent-color: var(--brand); cursor: pointer; }

.appr-btn-preview { display: flex; gap: 10px; margin-top: 12px; }
.appr-btn-preview .btn { flex: 1; pointer-events: none; }

.appr-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--line);
}
.appr-reset {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 9px 14px; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; transition: color var(--t-fast), background var(--t-fast);
}
.appr-reset:hover { color: var(--text); background: var(--panel-2); }
.appr-foot .btn-primary { padding: 9px 20px; }

@media (max-width: 520px) {
  .appr-overlay { padding: 10px; align-items: flex-end; }
  .appr-card { max-height: 92vh; border-radius: var(--r-lg); }
  .appr-body { padding: 4px 14px; }
  .appr-head, .appr-foot { padding-left: 14px; padding-right: 14px; }
  .appr-presets { grid-template-columns: repeat(2, 1fr); }
  .appr-seg-4 { grid-template-columns: repeat(2, 1fr); }
  .appr-swatches { gap: 7px; }
}

/* Color de fondo propio: resalta cuando está en uso. */
.appr-custom.active { color: var(--text); }
.appr-custom.active input[type="color"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft-2); }

/* Imagen de fondo */
.appr-wall { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: var(--fs-sm); color: var(--muted); }
.appr-wall > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appr-wall-btns { flex: 0 0 auto; display: flex; gap: 6px; }
.appr-wall-up, .appr-wall-rm {
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  border-radius: var(--r-sm); padding: 8px 12px; border: 1px solid var(--line);
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.appr-wall-up { background: var(--panel); color: var(--text); }
.appr-wall-up:hover { background: var(--panel-2); border-color: var(--line-strong); }
.appr-wall-rm { background: transparent; color: var(--muted); }
.appr-wall-rm:hover { color: var(--err); border-color: var(--err); }

/* Capa fija del fondo de pantalla + transparencias para que la imagen se vea. */
.wallpaper {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
[data-wallpaper="1"] .app-body,
[data-wallpaper="1"] body { background: transparent; }
[data-wallpaper="1"] .center,
[data-wallpaper="1"] .center .chat { background: transparent; }

/* ---- Estilo de botones principales según preferencia (data-btn en <html>) ---- */
/* --btn-alpha (1 = opaco) grada la transparencia del FONDO del botón; el texto
   queda opaco. Con alpha=1, color-mix devuelve el color pleno (look sin cambios). */
:root { --btn-alpha: 1; }
[data-btn="grafito"] .btn-primary {
  background: linear-gradient(180deg,
    color-mix(in srgb, #3d4045 calc(var(--btn-alpha) * 100%), transparent),
    color-mix(in srgb, #2a2c30 calc(var(--btn-alpha) * 100%), transparent));
}
[data-btn="acento"] .btn-primary {
  background: color-mix(in srgb, var(--brand) calc(var(--btn-alpha) * 100%), transparent);
  color: var(--on-brand, #fff); border-color: transparent; box-shadow: 0 6px 16px var(--brand-glow);
}
[data-btn="acento"] .btn-primary:hover { background: color-mix(in srgb, var(--brand-strong) calc(var(--btn-alpha) * 100%), transparent); box-shadow: 0 8px 22px var(--brand-glow); }
[data-btn="degradado"] .btn-primary {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--brand) calc(var(--btn-alpha) * 100%), transparent),
    color-mix(in srgb, var(--brand-strong) calc(var(--btn-alpha) * 100%), transparent));
  color: var(--on-brand, #fff); border-color: transparent; box-shadow: 0 6px 16px var(--brand-glow);
}
[data-btn="degradado"] .btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 22px var(--brand-glow); }
[data-btn="contorno"] .btn-primary {
  background: transparent; color: var(--brand-hover);
  border-color: var(--brand); box-shadow: none;
}
[data-btn="contorno"] .btn-primary:hover { background: var(--brand-soft-2); box-shadow: none; }

/* La transparencia de botones (--btn-alpha) también alcanza las tarjetas de la
   pantalla de Inicio: tarjetas grandes, pendientes y acciones rápidas.
   Con alpha=1 el color queda pleno (sin cambios); al bajarlo, el fondo se
   translúcida igual que los .btn-primary. El texto y los iconos siguen legibles. */
.lead-card,
.home-pending,
.qa-card {
  background: color-mix(in srgb, var(--card) calc(var(--btn-alpha) * 100%), transparent);
}
.qa-card:hover {
  background: color-mix(in srgb, var(--qa-hover-bg) calc(var(--btn-alpha) * 100%), transparent);
}
.qa-ico {
  background: color-mix(in srgb, var(--panel) calc(var(--btn-alpha) * 100%), transparent);
}

/* --- VEXS Brain (Lote 2): perfil académico --- */
.brain-card { max-width: 620px; }
.brain-lede { margin: 0 0 4px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.brain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.brain-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.brain-field { display: flex; flex-direction: column; gap: 5px; }
.brain-field > span { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.brain-field input, .brain-field textarea, .brain-course input {
  width: 100%; padding: 9px 11px; border-radius: var(--r-md, 10px);
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: var(--fs-sm);
}
.brain-field input:focus, .brain-field textarea:focus, .brain-course input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.brain-field textarea { resize: vertical; }
.brain-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brain-mini {
  border: 1px solid var(--line); background: var(--panel); color: var(--brand-hover);
  padding: 5px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; cursor: pointer;
}
.brain-mini:hover { border-color: var(--brand); }
.brain-courses { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.brain-course { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 6px; align-items: center; }
.bc-del {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.bc-del:hover { color: var(--err); border-color: var(--err); }
.brain-add {
  border: 1px dashed var(--line-strong, var(--line)); background: transparent; color: var(--muted);
  padding: 8px 12px; border-radius: var(--r-md, 10px); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; width: 100%;
}
.brain-add:hover { color: var(--brand-hover); border-color: var(--brand); }
.brain-status { flex: 1; font-size: var(--fs-xs); color: var(--muted); }
@media (max-width: 560px) {
  .brain-grid, .brain-grid-2 { grid-template-columns: 1fr; }
  .brain-course { grid-template-columns: 1fr 1fr auto; }
  .brain-course .bc-style { grid-column: 1 / -1; }
}

/* ============ Mi horario ============ */
.sched-card { width: min(860px, 100%); max-width: 860px; }

/* Pestañas de horarios (máx. 2) */
.sched-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; }
.sched-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-size: var(--fs-xs); font-weight: 700; cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.sched-tab:hover { border-color: var(--brand); color: var(--text); }
.sched-tab.is-active {
  color: var(--brand-hover); border-color: var(--brand);
  background: var(--brand-soft-2);
}
.sched-tab-x { font-size: 15px; line-height: 1; opacity: 0.6; }
.sched-tab-x:hover { opacity: 1; color: var(--err); }
.sched-tab-add { color: var(--faint); border-style: dashed; }

.sched-top { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sched-top select {
  width: 100%; padding: 9px 11px; border-radius: var(--r-md, 10px);
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: var(--fs-sm);
}
.sched-top select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.sched-hint { font-size: var(--fs-xs); color: var(--faint); }

/* Encabezado de columnas + filas de clases */
.sched-rows-head, .sched-row {
  display: grid;
  grid-template-columns: 76px 96px 96px 1.4fr 90px 1.2fr 30px;
  gap: 6px; align-items: center;
}
.sched-rows-head { margin: 8px 0 4px; padding: 0 2px; }
.sched-rows-head span { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.sched-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.sched-row select, .sched-row input {
  width: 100%; padding: 8px 9px; border-radius: var(--r-md, 10px);
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: var(--fs-sm);
}
.sched-row select:focus, .sched-row input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* Cuadro semanal generado — fino y minimalista, teñido con el color del usuario */
.sched-grid-cap { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); margin: 4px 0 8px; letter-spacing: 0.02em; }
.sched-grid-scroll {
  overflow-x: auto; border: 1px solid var(--line);
  border-radius: var(--r-lg, 14px); background: var(--surface);
}
.sched-grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 480px; }
.sched-grid th, .sched-grid td {
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 9px 11px; text-align: left; font-size: var(--fs-sm); vertical-align: top;
}
.sched-grid th:last-child, .sched-grid td:last-child { border-right: none; }
.sched-grid tbody tr:last-child td { border-bottom: none; }
.sched-grid thead th {
  background: transparent; color: var(--muted); font-weight: 600;
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line-strong);
}
/* Columna del día actual: sutil acento del color del usuario */
.sched-grid thead th.sg-today { color: var(--brand-hover); }
.sched-grid .sg-time {
  color: var(--faint); font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums; background: transparent;
}
.sched-grid .sg-empty { background: transparent; }
.sg-class { display: flex; flex-direction: column; gap: 2px; }
.sg-class + .sg-class { margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); }
.sg-class b { color: var(--text); font-weight: 600; }
.sg-class span { font-size: var(--fs-xs); color: var(--faint); }
.sched-empty { color: var(--muted); font-size: var(--fs-sm); text-align: center; padding: 14px 0; }

/* Clase EN CURSO ahora: relleno difuminado con el color de personalización */
.sched-grid td.sg-now {
  position: relative;
  background:
    radial-gradient(120% 120% at 15% 0%, var(--brand-soft-2), transparent 70%),
    var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}
.sched-grid td.sg-now .sg-class b { color: var(--brand-hover); }
.sg-now-tag {
  display: inline-block; margin-bottom: 5px; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--brand-soft-2); color: var(--brand-hover);
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  animation: schedNowPulse 2.4s ease-in-out infinite;
}
@keyframes schedNowPulse { 0%, 100% { opacity: 0.65; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sg-now-tag { animation: none; } }

@media (max-width: 640px) {
  .sched-top { grid-template-columns: 1fr; }
  .sched-rows-head { display: none; }
  .sched-row {
    grid-template-columns: 1fr 1fr 30px;
    gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-md, 10px);
  }
  .sched-row .sr-course, .sched-row .sr-room, .sched-row .sr-extra { grid-column: 1 / 3; }
  .sched-row .bc-del { grid-row: 1; grid-column: 3; }
}

/* ---------------------------------------------------------------------------
   MODO VISTA del horario (JARVIS 2026-09-16). Cuando el horario ya está armado,
   toda la configuración se colapsa y solo queda el cuadro + una barra discreta
   con el botón "Editar". Entrada del cuadro animada y elegante, teñida con el
   color de personalización del usuario (--brand). Bloque ADITIVO y reversible.
   ------------------------------------------------------------------------- */

/* Barra del modo vista: nota a la izquierda, botón Editar a la derecha. */
.sched-viewbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 2px 0 14px; padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: var(--r-lg, 14px);
  background:
    radial-gradient(120% 160% at 0% 0%, var(--brand-soft-2), transparent 60%),
    var(--panel);
  animation: schedBarIn 420ms cubic-bezier(.2,.7,.2,1) both;
}
.sched-viewbar-note {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
}
.sched-viewbar-note::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); flex: 0 0 auto;
  box-shadow: 0 0 0 4px var(--brand-soft);
}
/* Botón Editar: acento de marca, con un leve levantar al pasar el cursor. */
.sched-edit-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  color: var(--brand-hover);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  transition: transform 160ms ease, box-shadow 160ms ease,
              border-color 160ms ease, background 160ms ease;
}
.sched-edit-btn:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: var(--brand-soft-2);
  box-shadow: 0 6px 16px -8px var(--brand-glow);
}
.sched-edit-btn svg { transition: transform 220ms cubic-bezier(.2,.7,.2,1); }
.sched-edit-btn:hover svg { transform: rotate(-12deg) scale(1.08); }

/* Entrada del cuadro: aparece deslizándose con un suave desenfoque que se aclara.
   El contenedor entra completo; las filas hacen un stagger discreto. */
#schedGrid.is-view .sched-grid-scroll { animation: schedGridIn 520ms cubic-bezier(.2,.7,.2,1) both; }
#schedGrid.is-view .sched-grid-cap { animation: schedBarIn 380ms ease both; }
#schedGrid.is-view tbody tr {
  animation: schedRowIn 460ms cubic-bezier(.2,.7,.2,1) both;
}
#schedGrid.is-view tbody tr:nth-child(1) { animation-delay: 60ms; }
#schedGrid.is-view tbody tr:nth-child(2) { animation-delay: 110ms; }
#schedGrid.is-view tbody tr:nth-child(3) { animation-delay: 160ms; }
#schedGrid.is-view tbody tr:nth-child(4) { animation-delay: 210ms; }
#schedGrid.is-view tbody tr:nth-child(5) { animation-delay: 260ms; }
#schedGrid.is-view tbody tr:nth-child(6) { animation-delay: 310ms; }
#schedGrid.is-view tbody tr:nth-child(n+7) { animation-delay: 360ms; }

/* La celda "Ahora" respira suavemente para llamar la atención sin gritar. */
.sched-grid td.sg-now { animation: schedNowGlow 3.6s ease-in-out infinite; }

@keyframes schedBarIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes schedGridIn {
  from { opacity: 0; transform: translateY(10px) scale(.99); filter: blur(3px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes schedRowIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes schedNowGlow {
  0%, 100% { box-shadow: inset 3px 0 0 var(--brand); }
  50%      { box-shadow: inset 3px 0 0 var(--brand), 0 0 22px -6px var(--brand-glow); }
}

@media (prefers-reduced-motion: reduce) {
  .sched-viewbar,
  #schedGrid.is-view .sched-grid-scroll,
  #schedGrid.is-view .sched-grid-cap,
  #schedGrid.is-view tbody tr { animation: none; }
  .sched-grid td.sg-now { animation: none; }
  .sched-edit-btn:hover { transform: none; }
}

/* Botón "Modificar" de un documento generado + su menú de atajos. El PDF ya
   entregado se puede editar (quitar secciones, poner el nombre, etc.) sin
   rehacerlo; cada atajo envía la instrucción al Chat IA. Ver doc-edit.mjs. */
.modify-wrap { margin-top: 8px; }
.modify-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.modify-menu .btn-quick { padding: 6px 10px; font-size: var(--fs-xs, 0.8rem); border-radius: var(--r-sm, 8px); }
.modify-menu .btn-ghost { opacity: 0.72; }
.modify-menu .btn-ghost:hover { opacity: 1; }

/* Editor manual de documentos (overlay modal) */
.doc-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
.doc-editor {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.doc-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
}
.doc-editor-x {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.doc-editor-x:hover { color: var(--text); background: var(--panel); }
.doc-editor-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.doc-editor-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}
.doc-field { display: flex; flex-direction: column; gap: 6px; }
.doc-field label {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.doc-field-input {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: var(--fs-sm);
  font-family: var(--font);
  resize: vertical;
  box-sizing: border-box;
}
.doc-field-input:focus {
  outline: none;
  border-color: var(--line-strong);
  background: var(--input-bg-focus);
}

/* Selector de color del documento: paleta (swatches) + rueda (input color). */
.doc-color-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.doc-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  padding: 0;
  cursor: pointer;
  transition: transform .1s ease, border-color .1s ease;
}
.doc-swatch:hover { transform: scale(1.12); }
.doc-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--input-bg), 0 0 0 4px var(--line-strong);
}
.doc-color-wheel {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--input-bg);
  cursor: pointer;
}

/* ============================================================================
   INICIO v3 — AUDAZ (JARVIS 2026-09-15). skill frontend-design + impeccable
   (bolder.md). Regla aplicada: amplificar el motivo que VEXS YA tiene —la LUZ
   DE MARCA— a fuerza completa en UN punto (la tarjeta principal + un ambiente
   de aurora tras el hero), y mantener el resto disciplinado. Sin primitivas
   nuevas: todo con --brand y tokens existentes, respeta acento/tema del usuario.
   Bloque ADITIVO y reversible: borrar de aquí al final revierte por completo.
   ========================================================================= */

/* --- AMBIENTE: una aurora de marca difusa detrás del inicio. Ancla la vista
   con el motivo propio, sin decoración gratuita. Respira lento. --- */
.home { position: relative; gap: 22px; }
.home::before {
  content: "";
  position: absolute;
  top: -60px; left: 50%; transform: translateX(-50%);
  width: min(760px, 116%); height: 300px;
  background:
    radial-gradient(60% 100% at 50% 0%,
      color-mix(in srgb, var(--brand) 22%, transparent) 0%,
      transparent 70%);
  filter: blur(26px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  animation: auroraBreathe 7s ease-in-out infinite;
}
.home > * { position: relative; z-index: 1; }
@keyframes auroraBreathe {
  0%, 100% { opacity: 0.42; transform: translateX(-50%) scale(1); }
  50%      { opacity: 0.62; transform: translateX(-50%) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) { .home::before { animation: none; } }

/* --- HERO: saludo protagonista con barra de acento que lo ancla --- */
.home-hero--center { padding-top: 20px; }
.home-hero--center h2 {
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.04;
  letter-spacing: -1.4px;
  font-weight: 780;
  background: linear-gradient(180deg, var(--text) 0%, color-mix(in srgb, var(--text) 68%, var(--muted)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
/* barra de acento bajo el saludo: firma de marca, corta y decidida */
.home-hero--center h2::after {
  content: "";
  display: block;
  width: 52px; height: 3px; margin: 14px auto 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 40%, transparent));
  box-shadow: 0 0 18px -2px var(--brand-glow);
}
.home-hero--center .home-lede {
  font-size: var(--fs-md); color: var(--muted);
  letter-spacing: -0.1px; margin-top: 12px;
}

/* --- TARJETA PRINCIPAL como PIEZA PROTAGONISTA ---
   Fondo con lavado de marca, borde-luz presente, halo ambiental. Es el pico
   de la vista: se lee como #1 por estructura, forma y luz, no solo por glow. */
.lead-card.is-primary {
  padding: 24px 22px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--brand) 9%, var(--card)) 0%,
      var(--card) 60%);
  border-color: color-mix(in srgb, var(--brand) 26%, transparent);
}
.lead-card.is-primary .lead-ico {
  width: 58px; height: 58px; border-radius: 16px;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
}
.lead-card.is-primary .lead-ico svg { width: 28px; height: 28px; }
.lead-card.is-primary .lead-title {
  font-size: var(--fs-lg); letter-spacing: -0.5px; font-weight: 780;
}
.lead-card.is-primary .lead-sub { font-size: var(--fs); }
/* etiqueta sutil de "recomendado/lo primero": una chispa de marca en la esquina */
.lead-card.is-primary::after {
  content: "";
  position: absolute; top: 14px; right: 46px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px 2px var(--brand-glow);
  animation: sparkPulse 2.6s ease-in-out infinite;
}
@keyframes sparkPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) { .lead-card.is-primary::after { animation: none; } }

/* --- Íconos con más vida al apuntar --- */
.lead-ico { transition: transform var(--t) var(--ease-out), box-shadow var(--t), background var(--t); }
.lead-card:hover .lead-ico { transform: scale(1.07) rotate(-2deg); }

/* --- Flecha con intención --- */
.lead-arrow { transition: color var(--t), transform var(--t) var(--ease-out); }
.lead-card:hover .lead-arrow,
.lead-card:focus-visible .lead-arrow { transform: translateX(5px); }

/* --- Tarjetas secundarias: deliberadamente tranquilas, para que el pico brille --- */
.lead-cards { gap: 13px; }
.lead-card:not(.is-primary) { background: color-mix(in srgb, var(--card) 92%, var(--bg)); }

/* --- ENTRADA ORQUESTADA: cascada, un solo momento coreografiado --- */
@media (prefers-reduced-motion: no-preference) {
  .home { animation: none; }
  .home > .home-hero,
  .home > .lead-cards > .lead-card,
  .home > .more-wrap,
  .home > .home-ask {
    animation: leadRise 600ms var(--ease-out) both;
  }
  .home > .home-hero { animation-delay: 40ms; }
  .home > .lead-cards > .lead-card:nth-child(1) { animation-delay: 120ms; }
  .home > .lead-cards > .lead-card:nth-child(2) { animation-delay: 180ms; }
  .home > .lead-cards > .lead-card:nth-child(3) { animation-delay: 235ms; }
  .home > .more-wrap { animation-delay: 285ms; }
  .home > .home-ask { animation-delay: 330ms; }
}
@keyframes leadRise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* --- Botón "Escribe lo que necesitas": invita más --- */
.home-ask { transition: border-color var(--t), background var(--t), box-shadow var(--t), transform var(--t-fast); }
.home-ask:hover {
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
  box-shadow: 0 0 44px -14px color-mix(in srgb, var(--brand) 44%, transparent);
}

/* ============================================================================
   INICIO v4 — INTERACCIÓN de las tarjetas (JARVIS 2026-09-15). Atrevido y
   elegante. Solo CSS, aprovecha las clases que el JS ya pone (.is-sel/.has-sel).
   Reversible: borrar de aquí al final. Sin tocar HTML/JS.
   ========================================================================= */

/* --- Curva de RESORTE para el movimiento de las tarjetas: fluido, con vida.
   Sobrescribe la transición base solo en transform, dejando el resto igual. --- */
.lead-card {
  transition:
    transform 440ms cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color var(--t),
    box-shadow var(--t),
    background var(--t);
  will-change: transform;
  overflow: hidden; /* para contener el barrido de luz y el ripple */
}

/* --- HOVER cinético: elevación + leve inclinación viva --- */
.lead-card:hover {
  transform: translateY(-4px) scale(1.012);
}
.lead-card.is-primary:hover {
  transform: translateY(-5px) scale(1.015);
}

/* --- Barrido de luz (shimmer) que cruza la tarjeta al pasar el cursor.
   Un pseudo-elemento diagonal que viaja de izquierda a derecha. Elegante,
   no estridente: usa la marca a baja opacidad. --- */
.lead-card::before {
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 90%; height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    color-mix(in srgb, var(--brand) 12%, transparent) 50%,
    transparent 100%);
  transform: skewX(-18deg);
  transition: left 720ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 0;
}
.lead-card:hover::before { left: 130%; }
/* el contenido va sobre el barrido; .lead-text además ancla el ripple */
.lead-ico, .lead-arrow { position: relative; z-index: 1; }
.lead-text { position: relative; z-index: 1; }

/* --- PRESS: hundimiento físico con curva natural, acuse táctil claro --- */
.lead-card:active {
  transform: translateY(-1px) scale(0.975);
  transition: transform 90ms cubic-bezier(0.4, 0, 1, 1);
}

/* --- SELECCIÓN (.is-sel): el momento estelar. Un RIPPLE de marca emana desde
   la tarjeta elegida + un pulso de confirmación. Atrevido pero de un solo golpe.
   Se apoya en el ::after que ya usa la primaria para la chispa; aquí definimos
   un ripple con box-shadow animado sobre la propia tarjeta. --- */
.lead-card.is-sel {
  animation: cardConfirm 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes cardConfirm {
  0%   { transform: translateY(-2px) scale(0.985); }
  40%  { transform: translateY(-4px) scale(1.03); }
  100% { transform: translateY(-2px) scale(1); }
}
/* onda expansiva: un halo que crece y se desvanece al elegir. Va en un
   pseudo-elemento propio (.lead-text::after está libre) para no chocar con el
   shimmer de hover (.lead-card::before) ni la chispa de la primaria
   (.lead-card.is-primary::after). */
.lead-card.is-sel::before { left: -120%; } /* al elegir, corta el shimmer de hover */
.lead-card.is-sel .lead-text::after {
  content: "";
  position: absolute;
  left: -18px; top: 50%;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 46%, transparent) 0%, transparent 65%);
  transform: translate(-50%, -50%) scale(0.4);
  pointer-events: none;
  animation: rippleOut 560ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes rippleOut {
  0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0.4); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(9); }
}

/* --- El ícono acompaña la selección con un pequeño salto de energía --- */
.lead-card.is-sel .lead-ico {
  animation: icoPop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes icoPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.18) rotate(-3deg); }
  100% { transform: scale(1); }
}

/* --- La flecha de la tarjeta elegida se lanza hacia adelante, señal de "vamos" --- */
.lead-card.is-sel .lead-arrow {
  animation: arrowGo 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  color: var(--brand);
}
@keyframes arrowGo {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(8px); }
  100% { transform: translateX(4px); }
}

/* --- Cuando hay una elegida, las NO elegidas se retiran con elegancia:
   bajan opacidad y se encogen apenas, cediendo el protagonismo. --- */
#homeView.has-sel .lead-card:not(.is-sel) {
  opacity: 0.5;
  transform: scale(0.98);
  filter: saturate(0.85);
  transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out), filter 360ms var(--ease-out);
}

/* --- Respeto a accesibilidad: sin movimiento agresivo si el usuario lo pide --- */
@media (prefers-reduced-motion: reduce) {
  .lead-card, .lead-card:hover, .lead-card:active,
  .lead-card.is-sel, .lead-card.is-sel .lead-ico, .lead-card.is-sel .lead-arrow {
    animation: none !important;
    transition: border-color var(--t), box-shadow var(--t), background var(--t) !important;
  }
  .lead-card::before { display: none; }
  #homeView.has-sel .lead-card:not(.is-sel) { opacity: 0.6; transform: none; }
}

/* ============================================================
   BARRAS LATERALES v5 — MOVIMIENTO (JARVIS 2026-09-15)
   Bloque aditivo y reversible. CSS puro, sin tocar HTML/JS.
   Amplifica el motivo de marca (luz verde) en ambos rieles.
   Para revertir: borrar desde este encabezado hasta el final.
   ============================================================ */

/* ---------- RIEL IZQUIERDO (navegación) ---------- */

/* Entrada en cascada al cargar el shell (también en escritorio). */
@keyframes navRise {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.side-nav .nav-item {
  animation: navRise 520ms var(--ease-out) both;
  position: relative;
  overflow: hidden;
}
.side-nav .nav-item:nth-child(1) { animation-delay: 40ms; }
.side-nav .nav-item:nth-child(2) { animation-delay: 95ms; }
.side-nav .nav-item:nth-child(3) { animation-delay: 150ms; }
.side-nav .nav-item:nth-child(4) { animation-delay: 205ms; }
.side-nav .nav-item:nth-child(5) { animation-delay: 260ms; }
.side-nav .nav-item:nth-child(6) { animation-delay: 315ms; }

/* Hover kinético: el ítem respira, se desliza y su ícono cobra vida. */
.side-nav .nav-item {
  transition:
    background var(--t-fast), color var(--t-fast), border-color var(--t-fast),
    transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out);
}
.side-nav .nav-item:hover {
  transform: translateX(3px);
  box-shadow: -1px 0 0 0 var(--brand-glow) inset, 0 4px 16px -10px var(--brand-glow);
}
.side-nav .nav-item svg {
  transition: transform 300ms var(--ease-out), color var(--t-fast);
}
.side-nav .nav-item:hover svg { transform: translateX(2px) scale(1.08); color: var(--brand-hover); }

/* Barrido de luz al pasar el cursor (usa el motivo de marca). */
.side-nav .nav-item::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 20%,
              var(--brand-soft-2) 50%, transparent 80%);
  transform: translateX(-130%);
  transition: transform 620ms var(--ease-out);
}
.side-nav .nav-item:hover::after { transform: translateX(130%); }

/* Indicador de acento deslizante en el ítem ACTIVO: barra vertical de marca. */
.side-nav .nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 3px; height: 0; border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--brand), var(--brand-strong));
  box-shadow: 0 0 10px var(--brand-glow);
  transform: translateY(-50%);
  animation: navAccentGrow 420ms var(--ease-out) forwards;
}
@keyframes navAccentGrow {
  from { height: 0; opacity: 0; }
  to   { height: 62%; opacity: 1; }
}
.side-nav .nav-item.active svg {
  animation: navIcoPop 480ms var(--ease-out);
}
@keyframes navIcoPop {
  0% { transform: scale(0.8); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Avatar con destello sutil al aparecer. */
.side-user .avatar {
  transition: transform 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
}
.side-user .avatar:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px var(--brand-soft-2), 0 6px 18px -8px var(--brand-glow);
}

/* ---------- RIEL DERECHO (paneles / cursos) ---------- */

/* Entrada escalonada de paneles en escritorio. */
@keyframes panelRise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.rail .panel {
  animation: panelRise 560ms var(--ease-out) both;
  position: relative;
  overflow: hidden;
  transition:
    border-color 280ms var(--ease-out), box-shadow 280ms var(--ease-out),
    transform 280ms var(--ease-out);
}
.rail .panel:nth-of-type(1) { animation-delay: 120ms; }
.rail .panel:nth-of-type(2) { animation-delay: 210ms; }
.rail .panel:nth-of-type(3) { animation-delay: 300ms; }
.rail .panel:nth-of-type(4) { animation-delay: 390ms; }

/* Hover de panel: se eleva con borde-luz de marca. */
.rail .panel:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  box-shadow: 0 14px 34px -18px var(--brand-glow), var(--shadow-sm);
}

/* Barrido de acento superior al hacer hover (aparece desde el borde). */
.rail .panel::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent,
              var(--brand) 40%, var(--brand-strong) 60%, transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 480ms var(--ease-out);
}
.rail .panel:hover::before { transform: scaleX(1); }

/* Filas de tarea: micro-deslizamiento al pasar el cursor. */
.rail .pitem {
  transition: background var(--t-fast), transform 220ms var(--ease-out);
}
.rail .pitem:hover { transform: translateX(3px); }
.rail .pitem:hover .dot {
  box-shadow: 0 0 8px var(--brand-glow);
}

/* Links de panel con subrayado que crece desde el centro. */
.rail .panel-link { position: relative; }
.rail .panel-link::after {
  content: ""; position: absolute; left: 50%; right: 50%; bottom: 0; height: 2px;
  background: var(--brand); border-radius: 2px;
  transition: left 240ms var(--ease-out), right 240ms var(--ease-out);
}
.rail .panel-link:hover::after { left: 8%; right: 8%; }

/* Caret con rebote al plegar/desplegar. */
.rail .panel-caret { transition: transform 380ms var(--ease-out), color var(--t-fast); }

/* ---------- Accesibilidad: sin movimiento si el usuario lo pide ---------- */
@media (prefers-reduced-motion: reduce) {
  .side-nav .nav-item, .rail .panel { animation: none !important; }
  .side-nav .nav-item:hover, .rail .panel:hover,
  .rail .pitem:hover, .side-user .avatar:hover { transform: none !important; }
  .side-nav .nav-item::after, .rail .panel::before,
  .side-nav .nav-item.active::before { display: none; }
}

/* ============================================================
   ICONOS TEMÁTICOS v6 — VIDA POR SIGNIFICADO (JARVIS 2026-09-15)
   Bloque aditivo y reversible. CSS puro, cero cambios de HTML/JS.
   Cada icono anima según lo que representa; se engancha por el
   data-action de la tarjeta. Disparo en hover salvo el bombillo,
   que además late suave de forma permanente (es el protagonista).
   Para revertir: borrar desde este encabezado hasta el final.
   ============================================================ */

/* La tarjeta ancla el origen de las transformaciones del icono. */
.lead-card .lead-ico svg,
.lead-card .lead-ico { transform-origin: center; }
.lead-ico svg { transition: transform 320ms var(--ease-out), filter 320ms var(--ease-out); }

/* --- resolver-tarea = BOMBILLO: se enciende y apaga --- */
@keyframes bulbGlowSoft {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50%      { filter: drop-shadow(0 0 7px var(--brand-glow)); }
}
@keyframes bulbGlowStrong {
  0%   { filter: drop-shadow(0 0 0 transparent); color: var(--muted); }
  30%  { filter: drop-shadow(0 0 9px var(--brand)); color: var(--brand); }
  55%  { filter: drop-shadow(0 0 2px transparent); color: var(--muted); }
  80%  { filter: drop-shadow(0 0 11px var(--brand)); color: var(--brand); }
  100% { filter: drop-shadow(0 0 6px var(--brand-glow)); color: var(--brand-hover); }
}
/* Latido suave permanente: el bombillo "vive". */
.lead-card[data-action="resolver-tarea"] .lead-ico svg {
  animation: bulbGlowSoft 3.6s ease-in-out infinite;
}
/* Al pasar el cursor: se enciende de golpe (parpadeo→encendido). */
.lead-card[data-action="resolver-tarea"]:hover .lead-ico svg {
  animation: bulbGlowStrong 1500ms var(--ease-out) forwards;
}

/* --- pendientes = RELOJ: la manecilla gira --- */
.lead-card[data-action="pendientes"] .lead-ico svg polyline {
  transform-box: fill-box; transform-origin: center;
  transition: transform 1200ms var(--ease-out);
}
.lead-card[data-action="pendientes"]:hover .lead-ico svg polyline {
  transform: rotate(360deg);
}


/* --- subir-tarea / subir-material = FLECHA ↑: rebota hacia arriba --- */
@keyframes upNudge {
  0%,100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
  50% { transform: translateY(-1px); }
  70% { transform: translateY(-3px); }
  85% { transform: translateY(-1px); }
}
.lead-card[data-action="subir-tarea"]:hover .lead-ico svg,
.lead-card[data-action="subir-material"]:hover .lead-ico svg {
  animation: upNudge 1200ms var(--ease-out);
}

/* --- checks (estado/entregas/cuestionario/crear) = TRAZO que se dibuja --- */
@keyframes checkDraw {
  0% { stroke-dashoffset: 26; }
  100% { stroke-dashoffset: 0; }
}
.lead-card[data-action="estado-tarea"] .lead-ico svg path:first-child,
.lead-card[data-action="ver-entregas"] .lead-ico svg path:first-child,
.lead-card[data-action="crear-cuestionario"] .lead-ico svg path:first-child {
  stroke-dasharray: 26;
}
.lead-card[data-action="estado-tarea"]:hover .lead-ico svg path:first-child,
.lead-card[data-action="ver-entregas"]:hover .lead-ico svg path:first-child,
.lead-card[data-action="crear-cuestionario"]:hover .lead-ico svg path:first-child {
  animation: checkDraw 1100ms var(--ease-out) forwards;
}

/* --- ponte-a-prueba = DIANA: destello --- */
@keyframes starFlash {
  0% { transform: scale(1) rotate(0); filter: drop-shadow(0 0 0 transparent); }
  45% { transform: scale(1.22) rotate(9deg); filter: drop-shadow(0 0 8px var(--brand-glow)); }
  100% { transform: scale(1) rotate(0); filter: drop-shadow(0 0 0 transparent); }
}
.lead-card[data-action="ponte-a-prueba"]:hover .lead-ico svg {
  animation: starFlash 1100ms var(--ease-out);
}

/* --- calificar = LÁPIZ: escribe (vibración corta) --- */
@keyframes penWrite {
  0%,100% { transform: rotate(0) translateX(0); }
  15% { transform: rotate(-6deg) translateX(-1px); }
  35% { transform: rotate(5deg) translateX(1px); }
  55% { transform: rotate(-5deg) translateX(-1px); }
  75% { transform: rotate(4deg) translateX(1px); }
  90% { transform: rotate(-3deg); }
}
.lead-card[data-action="calificar"]:hover .lead-ico svg,
.lead-card[data-action="por-calificar"]:hover .lead-ico svg {
  animation: penWrite 1000ms ease-in-out;
}

/* --- crear-juego = GAMEPAD: latido de botones --- */
@keyframes padPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 6px var(--brand-glow)); }
}
.lead-card[data-action="crear-juego"]:hover .lead-ico svg {
  animation: padPulse 1000ms ease-in-out;
}

/* --- cursos / documentos = LIBRO: se "abre" apenas --- */
@keyframes bookOpen {
  0% { transform: perspective(300px) rotateY(0); }
  50% { transform: perspective(300px) rotateY(-16deg); }
  100% { transform: perspective(300px) rotateY(0); }
}
.lead-card[data-action="cursos"]:hover .lead-ico svg,
.lead-card[data-action="documentos-curso"]:hover .lead-ico svg {
  animation: bookOpen 1200ms var(--ease-out);
}

/* --- ver-tareas / crear-tarea = PORTAPAPELES: leve golpe de atención --- */
@keyframes clipTick {
  0%,100% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-3px) rotate(-3deg); }
  65% { transform: translateY(-1px) rotate(2deg); }
}
.lead-card[data-action="ver-tareas"]:hover .lead-ico svg,
.lead-card[data-action="crear-tarea"]:hover .lead-ico svg {
  animation: clipTick 1000ms var(--ease-out);
}

/* --- credenciales = LLAVE: gira apenas al entrar --- */
@keyframes keyTurn {
  0% { transform: rotate(0); }
  60% { transform: rotate(-18deg); }
  100% { transform: rotate(0); }
}
.lead-card[data-action="credenciales"]:hover .lead-ico svg {
  animation: keyTurn 1100ms var(--ease-out);
}

/* --- zona = REJILLA: destello de celdas --- */
.lead-card[data-action="zona"]:hover .lead-ico svg {
  animation: padPulse 1000ms ease-in-out;
}

/* --- Accesibilidad: sin animación de iconos si el usuario lo pide --- */
@media (prefers-reduced-motion: reduce) {
  .lead-card .lead-ico svg,
  .lead-card:hover .lead-ico svg,
  .lead-card[data-action="resolver-tarea"] .lead-ico svg {
    animation: none !important;
  }
}

/* --- Calificación automática: banner del Inicio --- */
.ag-banner {
  position: relative; text-align: left; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin: 0 0 14px; border-radius: var(--r-lg);
  background: var(--card); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
  box-shadow:
    inset 0 0 44px -10px color-mix(in srgb, var(--brand) 30%, transparent),
    0 8px 24px rgba(0,0,0,0.30);
  transition: transform var(--t-fast), border-color var(--t), box-shadow var(--t);
}
.ag-banner:hover, .ag-banner:focus-visible {
  transform: translateY(-1px); outline: none;
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  box-shadow:
    inset 0 0 56px -6px color-mix(in srgb, var(--brand) 42%, transparent),
    0 12px 30px rgba(0,0,0,0.38);
}
.ag-banner-ico {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}
.ag-banner-ico svg { width: 20px; height: 20px; }
.ag-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.ag-banner-title { font-weight: 650; }
.ag-banner-sub { font-size: 0.86em; color: var(--muted, #9aa4b2); }
.ag-banner-arrow { flex: 0 0 auto; color: var(--muted, #9aa4b2); }
.ag-banner-arrow svg { width: 18px; height: 18px; }
.ag-banner-arrow.is-on { color: var(--brand); }

/* --- Calificación automática: modal --- */
.ag-crit { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.ag-crit-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md, 12px);
  background: var(--card); border: 1px solid var(--line); cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.ag-crit-opt:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand) 45%, transparent);
  box-shadow: inset 0 0 40px -12px color-mix(in srgb, var(--brand) 40%, transparent);
}
.ag-crit-opt input { margin-top: 3px; accent-color: var(--brand); }
.ag-crit-opt small { color: var(--muted, #9aa4b2); }
.ag-preview {
  padding: 12px 14px; border-radius: var(--r-md, 12px);
  background: var(--brand-soft, rgba(34,197,94,0.06));
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
}
.ag-prev-head { font-size: 0.98em; }
.ag-prev-sub { font-size: 0.84em; color: var(--muted, #9aa4b2); margin: 2px 0 8px; }
.ag-prev-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 0.9em; }
