/* Capa sobre `base.css` (la hoja aprobada del prototipo): movimiento y los
   componentes que el prototipo no tenía — documentos y panel de la comisión.

   Criterio del movimiento: acompaña, no decora. Cada animación acá existe para
   contestar una pregunta del que la mira ("¿cargó?", "¿se guardó?", "¿de dónde
   salió esto?"). Nada se mueve porque quede lindo, y nada se mueve más de 240 ms:
   arriba de eso el sistema deja de sentirse rápido y empieza a sentirse ocupado. */

/* ---------- base de movimiento ---------- */
:root {
  --ease: cubic-bezier(.22,.61,.36,1);      /* frena suave, arranca decidido */
  --rapido: 140ms;
  --normal: 220ms;
  --sombra-1: 0 1px 2px rgba(24,28,31,.06), 0 1px 3px rgba(24,28,31,.04);
  --sombra-2: 0 4px 14px rgba(24,28,31,.10), 0 1px 3px rgba(24,28,31,.06);
  --sombra-3: 0 18px 44px rgba(44,2,48,.18);
}

@media (prefers-reduced-motion: reduce) {
  /* Quien pidió menos movimiento recibe la MISMA información, quieta. */
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes latir { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes brillo { to { background-position-x: -180%; } }
@keyframes girar { to { transform: rotate(360deg); } }

.entra { animation: entrar var(--normal) var(--ease) both; }
/* Escalonado: la lista se arma de arriba a abajo, como si se leyera sola.
   Sólo los primeros 8 — más allá el ojo ya no lo registra y sólo agrega espera. */
.entra:nth-child(1) { animation-delay: 0ms }
.entra:nth-child(2) { animation-delay: 28ms }
.entra:nth-child(3) { animation-delay: 56ms }
.entra:nth-child(4) { animation-delay: 84ms }
.entra:nth-child(5) { animation-delay: 112ms }
.entra:nth-child(6) { animation-delay: 140ms }
.entra:nth-child(7) { animation-delay: 168ms }
.entra:nth-child(8) { animation-delay: 196ms }

/* ---------- estados de carga ---------- */
.skeleton {
  background: linear-gradient(100deg, var(--pill) 30%, #f7f9fb 50%, var(--pill) 70%);
  background-size: 220% 100%;
  animation: brillo 1.1s linear infinite;
  border-radius: 8px;
  height: 14px;
}
.skeleton + .skeleton { margin-top: 10px; }
.skeleton.ancho-70 { width: 70% } .skeleton.ancho-40 { width: 40% }
.spinner {
  width: 15px; height: 15px; border-radius: 50%; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: girar .6s linear infinite; vertical-align: -2px;
}

/* ---------- botones ---------- */
.btn {
  border: 1px solid transparent; border-radius: 999px; padding: 9px 18px;
  font-size: 13px; font-weight: 600; background: var(--green); color: #fff;
  transition: transform var(--rapido) var(--ease), box-shadow var(--rapido) var(--ease),
              background var(--rapido) var(--ease), opacity var(--rapido);
  box-shadow: var(--sombra-1);
}
.btn:hover { background: var(--green-mid); box-shadow: var(--sombra-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); box-shadow: var(--sombra-1); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.fantasma { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.fantasma:hover { background: var(--hover); }
.btn.peligro { background: var(--danger); }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;   /* el teclado también navega */
}

.campo {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  font: inherit; background: #fff; color: var(--ink);
  transition: border-color var(--rapido), box-shadow var(--rapido);
}
.campo:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--tint); }
.campo::placeholder { color: var(--faint); }
label.etiqueta { display: block; font-size: 12px; font-weight: 600; color: var(--muted);
                 margin: 0 0 6px; letter-spacing: .01em; }
.fila-campos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- avisos ---------- */
.aviso {
  border: 1px solid var(--line); border-left: 3px solid var(--green); background: var(--tint);
  border-radius: 10px; padding: 12px 14px; font-size: 13px; animation: entrar var(--normal) var(--ease) both;
}
.aviso.malo { border-left-color: var(--danger); background: #fdf1ee; }
.aviso.bien { border-left-color: #2f7d4f; background: #eef7f1; }

/* La memoria del foro: lo más importante que muestra esta pantalla. Aparece
   mientras se escribe, así que entra desde arriba y no empuja el resto de golpe. */
#memoriaViva { display: grid; gap: 8px; margin-top: 12px; }
.memoria-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; text-align: left; width: 100%;
  transition: border-color var(--rapido), box-shadow var(--rapido), transform var(--rapido);
  animation: entrar var(--normal) var(--ease) both;
}
.memoria-item, .memoria-item:visited { text-decoration: none; color: var(--ink); }
.memoria-item:hover { border-color: var(--gold); box-shadow: var(--sombra-2); transform: translateY(-1px); }
.memoria-item strong { display: block; }
.memoria-badge {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px; background: var(--tint); color: var(--green-mid);
}
.memoria-badge.concluido { background: #eef7f1; color: #2f7d4f; }
.memoria-conclusion { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.memoria-parecido { margin-left: auto; flex: none; font-size: 11px; color: var(--faint); }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 80; }
.toast {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 12px; padding: 12px 16px; box-shadow: var(--sombra-3); font-size: 13px;
  max-width: 380px; animation: subir var(--normal) var(--ease) both;
}
.toast.malo { border-left-color: var(--danger); }
.toast.saliendo { animation: aparecer var(--rapido) var(--ease) reverse both; }

/* ---------- tablas del panel ---------- */
.tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tabla th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); padding: 0 14px 10px; font-weight: 600;
}
.tabla td { padding: 12px 14px; border-top: 1px solid var(--line); background: #fff; }
.tabla tr:hover td { background: var(--hover); }
.tabla tr td:first-child { border-left: 1px solid var(--line); border-radius: 10px 0 0 10px; }
.tabla tr td:last-child { border-right: 1px solid var(--line); border-radius: 0 10px 10px 0; }

.etiqueta-estado {
  display: inline-block; white-space: nowrap;   /* "sin entrar" partido en dos líneas se lee como dos etiquetas */
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--pill); color: var(--muted); margin: 2px 2px 2px 0;
}
.etiqueta-estado.activo { background: #eef7f1; color: #2f7d4f; }
.etiqueta-estado.baja { background: #fdf1ee; color: var(--danger); }
.etiqueta-estado.alta { background: #fdf1ee; color: var(--danger); }
.etiqueta-estado.media { background: #fdf6e8; color: #8a6420; }
.etiqueta-estado.pendiente { background: var(--tint); color: var(--green-mid); }

/* ---------- zona de carga de documentos ---------- */
.soltar {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 20px;
  text-align: center; color: var(--muted); background: #fff;
  transition: border-color var(--normal) var(--ease), background var(--normal), transform var(--rapido);
}
.soltar.encima { border-color: var(--green); background: var(--tint); transform: scale(1.006); }
.soltar strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.progreso { height: 3px; background: var(--pill); border-radius: 3px; overflow: hidden; margin-top: 14px; }
.progreso > i { display: block; height: 100%; width: 30%; background: var(--green); border-radius: 3px;
                animation: brillo 1.1s linear infinite;
                background-image: linear-gradient(90deg, var(--green), var(--gold), var(--green));
                background-size: 220% 100%; }

.doc-fila { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: #fff;
            border: 1px solid var(--line); border-radius: 12px;
            transition: box-shadow var(--rapido), transform var(--rapido), border-color var(--rapido);
            animation: entrar var(--normal) var(--ease) both; }
.topic-row, .topic-row:visited { text-decoration: none; color: var(--ink); }
.doc-fila:hover { box-shadow: var(--sombra-2); transform: translateY(-1px); border-color: var(--gold-soft); }
.doc-icono { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
             background: var(--tint); color: var(--green); font-size: 15px; font-weight: 700; }
.doc-meta { color: var(--faint); font-size: 12px; }

/* ---------- vistas ---------- */
.view.active { animation: entrar var(--normal) var(--ease) both; }
.titulo-vista { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.bajada { color: var(--muted); font-size: 13px; margin-top: 2px; }
.encabezado-vista { display: flex; align-items: flex-end; justify-content: space-between;
                    gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tarjeta { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
           padding: 20px; box-shadow: var(--sombra-1); }
.pila { display: grid; gap: 12px; }
.vacio { text-align: center; color: var(--muted); padding: 44px 20px; }
.vacio .emoji { font-size: 30px; display: block; margin-bottom: 8px; opacity: .8; }

/* ---------- asistente ---------- */
/* Dos columnas: la conversación y, al lado, la prueba. Que la respuesta y su
   fuente se vean juntas es el punto — un socio decide con esto. */
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .chat-wrap { grid-template-columns: 1fr; } }
.chat-fuente { position: sticky; top: 78px; }

.burbuja { animation: entrar var(--normal) var(--ease) both; }
.burbuja.mia { background: var(--tint); border-color: var(--gold-soft); margin-left: 12%; }
.burbuja.suya { border-left: 3px solid var(--green); }
.burbuja.error { border-left-color: var(--danger); }
.respuesta p + p { margin-top: 10px; }

/* La cita es el elemento más importante de la pantalla: chica, pero clickeable
   y evidente. Sin esto el asistente es una opinión más. */
.cita {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  margin: 0 2px; border: 1px solid var(--gold); border-radius: 999px; background: #fff;
  color: var(--green-mid); font-size: 11px; font-weight: 700; vertical-align: 1px;
  transition: background var(--rapido), transform var(--rapido), box-shadow var(--rapido);
}
.cita:hover { background: var(--gold); color: #fff; transform: translateY(-1px); box-shadow: var(--sombra-1); }

.fuentes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px;
           padding-top: 12px; border-top: 1px solid var(--line); }
.chip-cita {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
  transition: border-color var(--rapido), box-shadow var(--rapido), transform var(--rapido);
}
.chip-cita:hover { border-color: var(--gold); box-shadow: var(--sombra-1); transform: translateY(-1px); }

.frag-inline {
  margin: 12px 0; padding: 12px 14px; background: var(--bg); border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0; font-size: 13px; color: var(--ink); line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   COLUMNA DERECHA Y MICRO-INTERACCIONES
   El mouse tiene que sentir que la interfaz responde. Cada regla de acá es una
   respuesta a un gesto: paso por arriba (¿esto se puede tocar?), aprieto (¿me
   registró?), me muevo con el teclado (¿dónde estoy parado?). Nada dura más de
   200 ms — el movimiento que se nota es movimiento que estorba.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ---------- rail ---------- */
.rail-card { padding: 16px; }
.rail-head { font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
             color: var(--faint); font-weight: 700; margin-bottom: 10px; }
.rail-nota { font-size: 12px; color: var(--muted); margin: -4px 0 12px; line-height: 1.5; }
.rail-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; margin: 0 -10px;
  border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 13px;
  transition: background var(--rapido) var(--ease), transform var(--rapido) var(--ease);
}
.rail-item:hover { background: var(--hover); transform: translateX(2px); }
.rail-item strong { display: block; font-weight: 600; line-height: 1.4; }
.rail-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 3px;
            display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
            overflow: hidden; }
.rail-fecha { display: block; color: var(--faint); font-size: 11px; margin-top: 4px; }
.rail-check { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid;
              place-items: center; background: #eef7f1; color: #2f7d4f; font-size: 11px;
              font-weight: 700; }
.rail-pill { flex: none; min-width: 24px; height: 20px; padding: 0 7px; border-radius: 999px;
             display: grid; place-items: center; background: var(--pill); color: var(--muted);
             font-size: 11px; font-weight: 700; }
@media (max-width: 1180px) { .rail { display: none; } }   /* antes que apretar el contenido */

/* ---------- volver ---------- */
.volver {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  text-decoration: none; background: transparent; border: 1px solid transparent;
  transition: background var(--rapido), color var(--rapido), border-color var(--rapido);
}
.volver:hover { background: #fff; border-color: var(--line); color: var(--ink); }
.volver .flecha { transition: transform var(--normal) var(--ease); }
.volver:hover .flecha { transform: translateX(-3px); }   /* el gesto de volver, dibujado */

/* ---------- hilo ---------- */
.hilo { padding: 4px 20px; }
.post .avatar { display: grid; place-items: center; border-radius: 50%; font-weight: 700;
                flex: none; letter-spacing: .02em; }
.post { transition: background var(--rapido); margin: 0 -20px; padding-left: 20px;
        padding-right: 20px; }
.post:hover { background: #fbfcfd; }

/* ---------- navegación: dónde estoy y qué se puede tocar ---------- */
.nav a { position: relative; transition: background var(--rapido) var(--ease),
                                          color var(--rapido), padding-left var(--rapido) var(--ease); }
.nav a::before {
  content: ""; position: absolute; left: 4px; top: 50%; width: 3px; height: 0;
  background: var(--green); border-radius: 2px; transform: translateY(-50%);
  transition: height var(--normal) var(--ease);
}
.nav a:hover { padding-left: 18px; }
.nav a.active::before { height: 18px; }                  /* la barrita crece, no aparece */

/* ---------- filas y tarjetas: el hover levanta, no parpadea ---------- */
.topic-row {
  position: relative; overflow: hidden;
  transition: border-color var(--rapido) var(--ease), box-shadow var(--rapido) var(--ease),
              transform var(--rapido) var(--ease);
}
.topic-row::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gold); transform: scaleY(0); transform-origin: center;
  transition: transform var(--normal) var(--ease);
}
.topic-row:hover { transform: translateY(-1px); box-shadow: var(--sombra-2);
                   border-color: var(--gold-soft); }
.topic-row:hover::after { transform: scaleY(1); }
.tarjeta { transition: box-shadow var(--normal) var(--ease); }

/* ---------- pills, chips y badges ---------- */
.pill, .badge { transition: background var(--rapido), color var(--rapido),
                            transform var(--rapido) var(--ease); }
.topic-row:hover .pill { background: var(--tint); color: var(--green-mid); transform: scale(1.04); }
.doc-icono { transition: transform var(--normal) var(--ease), background var(--rapido); }
.doc-fila:hover .doc-icono { transform: rotate(-4deg) scale(1.06); background: var(--gold-soft); }

/* ---------- formularios: el foco se ve antes de escribir ---------- */
.tarjeta:focus-within { box-shadow: var(--sombra-2); }
label.etiqueta { transition: color var(--rapido); }
div:focus-within > label.etiqueta { color: var(--green-mid); }

/* ---------- tabs ---------- */
.tab { transition: background var(--rapido) var(--ease), color var(--rapido),
                   transform var(--rapido) var(--ease); }
.tab:hover:not(.active) { background: var(--hover); transform: translateY(-1px); }

/* ---------- tablas del panel ---------- */
.tabla tr { transition: transform var(--rapido) var(--ease); }
.tabla tr:hover { transform: translateX(2px); }
.tabla td { transition: background var(--rapido); }

/* ---------- buscador ---------- */
.h-search input { transition: box-shadow var(--normal) var(--ease), background var(--rapido),
                              border-color var(--rapido); }
.h-search input:focus { box-shadow: 0 0 0 3px var(--tint), var(--sombra-1); }

/* ---------- el resto ---------- */
html { scroll-behavior: smooth; }
a, button, .topic-row, .doc-fila, .memoria-item, .rail-item { cursor: pointer; }
.side-user { transition: background var(--rapido), border-color var(--rapido); border-radius: 999px; }
.side-user:hover { background: var(--hover); }

/* Las filas del foro como tarjetas parejas: en la hoja del prototipo eran filas
   planas separadas por una línea, y con el hover elevado quedaba una sola tarjeta
   flotando entre renglones sueltos. Ahora todas se ven igual y el mouse sólo
   levanta la que estás mirando. */
.topic-row {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink);
}
.topic-row:last-child { border-bottom: 1px solid var(--line); }
.topic-row:hover { background: var(--card); }
.topic-row > div { flex: 1; min-width: 0; }
.topic-row .conclusion {
  margin-top: 10px; padding: 10px 14px; background: #fbf7ec; border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0; color: var(--ink); font-size: 13px; line-height: 1.55;
}
.topic-row strong { font-size: 15.5px; letter-spacing: -.01em; }
.topic-row .pill { align-self: center; }

/* ---------- tablero de uso ---------- */
.metricas { display: grid; gap: 12px; margin-top: 14px;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.metrica {
  display: flex; flex-direction: column; gap: 2px; padding: 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  transition: transform var(--rapido) var(--ease), box-shadow var(--rapido) var(--ease),
              border-color var(--rapido);
}
.metrica:hover { transform: translateY(-2px); box-shadow: var(--sombra-2);
                 border-color: var(--gold-soft); }
.metrica-valor { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--ink);
                 line-height: 1.1; }
.metrica-etiqueta { font-size: 12px; font-weight: 600; color: var(--muted); }
.metrica-nota { font-size: 11px; color: var(--faint); margin-top: 2px; line-height: 1.4; }
.faltantes { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.faltantes li { font-size: 13px; color: var(--ink); line-height: 1.5; }

/* La cola de trabajo de la Cámara: cada consulta sin respuesta con su botón. */
.faltantes li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.faltantes li .btn { padding: 4px 12px; font-size: 11.5px; margin-left: auto; }

/* ---------- directorio ---------- */
.contacto-vias { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.contacto-vias .chip-cita { text-decoration: none; }


/* ── Diálogo (cambio de contraseña) ────────────────────────────────────────
   <dialog> nativo: el navegador ya trae el backdrop, el foco atrapado y el
   Escape. Acá sólo va la piel. */
.dlg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  width: min(420px, calc(100vw - 32px));
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(24, 28, 31, .18);
}
.dlg::backdrop { background: rgba(24, 28, 31, .38); backdrop-filter: blur(2px); }
.dlg[open] { animation: dlg-entra .18s ease-out; }
@keyframes dlg-entra {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.dlg h3 { font-size: 17px; }
.dlg-pie { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
button.side-user { cursor: pointer; border: 0; background: none; font: inherit; }
button.side-user:hover { color: var(--green); }
@media (prefers-reduced-motion: reduce) { .dlg[open] { animation: none; } }
