/* =====================================================================
   IGLESIA CASA DE MI GLORIA — "Reyes y Sacerdotes"
   Sistema de diseño compartido por todas las páginas.
   ===================================================================== */

:root {
  --navy-950: #0c1526;
  --navy-900: #101d34;
  --navy-850: #13203a;
  --navy-800: #16233f;
  --navy-700: #223251;
  --navy-600: #2d3f63;

  --gold-300: #ecd08f;
  --gold-500: #cda152;
  --gold-600: #b3893f;

  --cream: #f3ede0;
  --cream-dim: #cbc3b3;
  --muted: #8d95a6;

  --ok: #5fb98a;
  --warn: #d9a441;
  --err: #e0736b;

  --line: rgba(243, 237, 224, 0.12);
  --radius: 4px;

  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Work Sans", system-ui, -apple-system, sans-serif;
  --font-quote: "Cormorant Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy-950);
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; overflow-x: hidden; }

a { color: var(--gold-300); }


/* ---------- Barra superior (páginas internas) ---------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(12, 21, 38, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

/* El emblema tiene fondo transparente: se apoya directo sobre el azul */
.topbar-logo {
  width: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.topbar-logo img { width: 100%; height: auto; }

.topbar-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.topbar-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }

.topbar-user { font-size: 0.82rem; color: var(--cream-dim); }


/* ---------- Botones ------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.9rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-300) 0%, var(--gold-500) 100%);
  color: var(--navy-950);
  border-color: var(--gold-500);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f2ddab 0%, var(--gold-300) 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--cream);
  border-color: rgba(243, 237, 224, 0.35);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--gold-500);
  color: var(--gold-300);
  background: rgba(205, 161, 82, 0.06);
}

.btn-ghost {
  background: transparent;
  color: var(--cream-dim);
  border-color: transparent;
  padding: 0.5rem 0.9rem;
  min-height: 38px;
  font-size: 0.85rem;
}
.btn-ghost:hover:not(:disabled) { color: var(--gold-300); background: rgba(205, 161, 82, 0.08); }

.btn-sm { padding: 0.5rem 1.1rem; min-height: 38px; font-size: 0.85rem; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }


/* ---------- Estructura de página ----------------------------------- */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 5rem;
}

.page-narrow { max-width: 860px; }

/* ---------- Pestañas de vista (Miembros / Mentores) ------------------ */

.vista-tabs {
  display: flex;
  gap: clamp(0.8rem, 2vw, 1.4rem);
  margin-bottom: 2rem;
}

.vista-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.15rem 1.4rem;
  min-height: 64px;
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 1.4vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--cream-dim);
  cursor: pointer;
  text-align: center;
  transition: all 0.18s ease;
}

.vista-tab-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vista-tab:hover {
  border-color: rgba(205, 161, 82, 0.55);
  color: var(--cream);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.vista-tab:active { transform: translateY(0); }

/* La pestaña abierta: dorada y con un realce que la despega del resto */
.vista-tab.activa {
  background: linear-gradient(180deg, rgba(205, 161, 82, 0.16) 0%, rgba(205, 161, 82, 0.06) 100%);
  border-color: var(--gold-500);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(205, 161, 82, 0.35), 0 10px 26px rgba(0, 0, 0, 0.3);
}

.vista-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(205, 161, 82, 0.35);
}

.vista-desc {
  margin: 0 0 2.2rem;
  color: var(--cream-dim);
  line-height: 1.6;
  max-width: 68ch;
}

@media (max-width: 560px) {
  .vista-tab { padding: 0.95rem 0.9rem; min-height: 58px; gap: 0.5rem; }
}


.page-head { margin-bottom: 2.5rem; }

.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin: 0 0 0.6rem;
  color: #fff;
}

.page-head p { margin: 0; color: var(--cream-dim); line-height: 1.6; max-width: 62ch; }

/* Encabezado del formulario: título centrado y párrafo justificado */
.encabezado-centrado { text-align: center; }

.encabezado-centrado p {
  text-align: justify;
  text-align-last: center;   /* la última línea queda centrada, no estirada */
  hyphens: auto;
  margin-left: auto;
  margin-right: auto;
}

/*
   En pantallas angostas el texto justificado queda mal: al haber pocas
   palabras por línea, el navegador parte palabras con guiones y estira
   los espacios. Ahí se centra sin justificar, que se lee mejor.
*/
@media (max-width: 640px) {
  .encabezado-centrado p {
    text-align: center;
    text-align-last: center;
    hyphens: manual;
  }
}


/* ---------- Tarjetas / secciones del formulario -------------------- */

.card {
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card + .card { margin-top: 1.5rem; }

.card-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1.4rem;
  background: var(--navy-800);
  border-bottom: 1px solid var(--line);
}

.card-num {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--navy-950);
  font-size: 0.8rem;
  font-weight: 700;
}

.card-head h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-300);
}

.card-body { padding: 1.6rem 1.4rem; }


/* ---------- Campos de formulario ----------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }

.field { display: flex; flex-direction: column; gap: 0.45rem; min-width: 0; }

.field-full { grid-column: 1 / -1; }

label, .label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: 0.01em;
}

.req { color: var(--gold-500); }

.hint { font-size: 0.75rem; font-weight: 400; color: var(--muted); }

input[type="text"],
input[type="date"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--navy-950);
  color: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(205, 161, 82, 0.15);
}

input::placeholder, textarea::placeholder { color: #5b6479; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23cda152' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 11px;
  padding-right: 2.4rem;
  cursor: pointer;
}

select option { background: var(--navy-900); color: var(--cream); }

/* Fecha: el icono nativo es oscuro sobre fondo oscuro */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(72%) sepia(30%) saturate(700%) hue-rotate(3deg);
  cursor: pointer;
}


/* ---------- Opciones (radio / checkbox) ---------------------------- */

.options { display: grid; gap: 0.6rem; }
.options-2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.opt {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  background: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.45;
  min-height: 44px;
  transition: all 0.15s ease;
}

.opt:hover { border-color: rgba(205, 161, 82, 0.5); background: var(--navy-800); }

.opt input { flex: none; margin: 2px 0 0; width: 17px; height: 17px; accent-color: var(--gold-500); cursor: pointer; }

.opt:has(input:checked) {
  border-color: var(--gold-500);
  background: rgba(205, 161, 82, 0.1);
  color: #fff;
}

.opt:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }

.counter { font-size: 0.75rem; color: var(--muted); margin-top: 0.55rem; }
.counter.full { color: var(--gold-500); }


/* ---------- Avisos -------------------------------------------------- */

.alert {
  display: flex;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.55;
  border: 1px solid;
}

.alert-err  { background: rgba(224, 115, 107, 0.1); border-color: rgba(224, 115, 107, 0.45); color: #f0b3ae; }
.alert-ok   { background: rgba(95, 185, 138, 0.1);  border-color: rgba(95, 185, 138, 0.45);  color: #a6dcc0; }
.alert-warn { background: rgba(217, 164, 65, 0.1);  border-color: rgba(217, 164, 65, 0.45);  color: #e6c78a; }

.hidden { display: none !important; }

/* Cuando entra un mentor, el <body> lleva la clase .rol-mentor y todo lo
   exclusivo del administrador desaparece — incluso lo que se vuelve a
   dibujar después, como las filas de la tabla. */
body.rol-mentor .solo-admin { display: none !important; }

/* Etiqueta de cuenta creada para pruebas: es la única que se puede eliminar */
.tag-prueba {
  margin-left: 0.4rem;
  color: var(--warn);
  border-color: rgba(217, 164, 65, 0.45);
  background: rgba(217, 164, 65, 0.12);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}

.sin-asignar { color: #4a5468; font-style: italic; }


/* ---------- Ventana modal centrada ---------------------------------- */

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.98);
  width: min(440px, calc(100vw - 2.5rem));
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding: clamp(1.5rem, 4vw, 2rem);
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin: 0 0 0.4rem;
  color: #fff;
}

.modal-sub {
  margin: 0 0 1.5rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}

.modal-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1.8rem;
  flex-wrap: wrap;
}

/* El overlay del modal debe quedar por encima de la ficha lateral */
#overlayClave { z-index: 65; }


/* ---------- Menú desplegable de la barra superior -------------------- */

.menu-wrap { position: relative; }

/* Icono de tres líneas dibujado con CSS, sin imágenes */
.menu-icono {
  width: 14px;
  height: 10px;
  flex: none;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  position: relative;
}
.menu-icono::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  border-top: 2px solid currentColor;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  padding: 0.4rem;
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
  z-index: 60;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.menu-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

.menu-item {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease;
}

.menu-item:hover { background: rgba(205, 161, 82, 0.1); color: var(--gold-300); }

.menu-peligro { color: var(--cream-dim); }
.menu-peligro:hover { background: rgba(224, 115, 107, 0.12); color: #f0b3ae; }

.menu-sep { height: 1px; margin: 0.35rem 0.3rem; background: var(--line); }

/* Quién entró, dentro del menú */
.menu-usuario {
  padding: 0.6rem 0.85rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold-300);
  line-height: 1.3;
}


/* ---------- Buscador de fichas al crear un rol ---------------------- */

.resultados {
  margin-top: 0.5rem;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-900);
}

.resultado {
  display: block;
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(243, 237, 224, 0.06);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.resultado:last-child { border-bottom: none; }
.resultado:hover { background: rgba(205, 161, 82, 0.1); color: var(--gold-300); }
.resultado small { display: block; color: var(--muted); font-size: 0.76rem; margin-top: 2px; }

.ficha-elegida {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: rgba(205, 161, 82, 0.1);
  border: 1px solid rgba(205, 161, 82, 0.4);
  border-radius: var(--radius);
}

.ficha-elegida .nombre { font-weight: 600; color: #fff; font-size: 0.92rem; }
.ficha-elegida .detalle { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.quitar-ficha {
  margin-left: auto;
  flex: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--cream-dim);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1;
}
.quitar-ficha:hover { border-color: var(--gold-500); color: var(--gold-300); }


/* ---------- Lista de accesos (mentores) ----------------------------- */

.acceso {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.acceso + .acceso { margin-top: 0.7rem; }

.acceso.inactivo { opacity: 0.55; }

.acceso-datos { flex: 1 1 190px; min-width: 0; }

.acceso-nombre { font-weight: 600; color: #fff; font-size: 0.95rem; }

.acceso-usuario {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.acceso-acciones { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Fila de un mentor sin acceso: se atenúa pero sigue legible */
tbody tr.fila-inactiva { opacity: 0.55; }
tbody tr.fila-inactiva:hover { opacity: 0.8; }

/* En la tabla de mentores las filas no se abren al hacer clic */
#tablaMentores tr { cursor: default; }

.enlace-ficha {
  display: block;
  margin-top: 3px;
  padding: 0;
  background: none;
  border: none;
  color: var(--gold-500);
  font-family: var(--font-body);
  font-size: 0.76rem;
  cursor: pointer;
}
.enlace-ficha:hover { color: var(--gold-300); text-decoration: underline; }

.tag-rol-admin         { color: var(--gold-300); border-color: rgba(205, 161, 82, 0.45); background: rgba(205, 161, 82, 0.12); }
.tag-rol-mentor        { color: #8fc7f0; border-color: rgba(143, 199, 240, 0.4); background: rgba(143, 199, 240, 0.1); }
.tag-rol-desarrollador { color: #b7a3e8; border-color: rgba(183, 163, 232, 0.4); background: rgba(183, 163, 232, 0.1); }
.tag-rol-lider         { color: #7fd3b5; border-color: rgba(127, 211, 181, 0.4); background: rgba(127, 211, 181, 0.1); }


/* ---------- Trampa anti-bot (invisible para personas) -------------- */

.trampa {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}


/* ---------- Barra de acciones fija del formulario ------------------ */

/*
   Barra de envío. Queda al final del formulario, no flotando: mientras
   la persona llena los campos no tiene nada que enviar todavía, y verla
   seguir el scroll todo el rato distrae.
*/
.formbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding: 1rem clamp(1rem, 3vw, 1.4rem);
  background: rgba(16, 29, 52, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.formbar .note { font-size: 0.8rem; color: var(--muted); flex: 1; min-width: 180px; }

/*
   Variante fija: se usa dentro del panel lateral de edición, donde el
   formulario es largo y tiene su propio scroll. Ahí sí conviene tener
   siempre a la vista los botones de guardar y cancelar.
*/
.formbar-fija { position: sticky; bottom: 0; }


/* ---------- Panel: filtros y tabla --------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.toolbar .field { flex: 1 1 190px; }
.toolbar .field-search { flex: 2 1 320px; }

/* Buscador con selector de campo pegado al costado */
.busqueda { display: flex; }

.busqueda select {
  flex: none;
  width: auto;
  min-width: 118px;
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: none;
  background-color: var(--navy-800);
  color: var(--gold-300);
  font-size: 0.85rem;
  font-weight: 600;
}

.busqueda input {
  flex: 1;
  min-width: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.busqueda select:focus, .busqueda input:focus { position: relative; z-index: 1; }

.stats { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 1.5rem; }

.stat {
  flex: 1 1 150px;
  padding: 1rem 1.2rem;
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold-500);
  border-radius: var(--radius);
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--navy-850);
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

thead th {
  position: sticky;
  top: 0;
  background: var(--navy-800);
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-300);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid rgba(243, 237, 224, 0.06); vertical-align: middle; }

tbody tr { cursor: pointer; transition: background 0.13s ease; }
tbody tr:hover { background: rgba(205, 161, 82, 0.07); }
tbody tr:last-child td { border-bottom: none; }

.cell-name { font-weight: 600; color: #fff; white-space: nowrap; }

/* Señala que ese caballero además tiene acceso al sistema */
.etiqueta-doble { margin-left: 0.5rem; font-size: 0.65rem; letter-spacing: 0.06em; }
.cell-dim { color: var(--muted); }

.empty { padding: 3.5rem 1.5rem; text-align: center; color: var(--muted); }


/* ---------- Etiquetas de estado y zona ------------------------------ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border: 1px solid;
}

.tag-nuevo    { color: #8fc7f0; border-color: rgba(143, 199, 240, 0.4); background: rgba(143, 199, 240, 0.1); }
.tag-activo   { color: #a6dcc0; border-color: rgba(166, 220, 192, 0.4); background: rgba(166, 220, 192, 0.1); }
.tag-inactivo { color: var(--muted); border-color: rgba(141, 149, 166, 0.35); background: rgba(141, 149, 166, 0.1); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot-roja     { background: #d9534f; }
.dot-azul     { background: #4a86c7; }
.dot-amarilla { background: #d9b441; }
.dot-naranja  { background: #d98341; }
.dot-verde    { background: #5fb98a; }
.dot-none     { background: #4a5468; }

.zona-cell { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }


/* ---------- Ficha (panel lateral deslizante) ------------------------ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 11, 20, 0.72);
  backdrop-filter: blur(3px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(680px, 100%);
  background: var(--navy-900);
  border-left: 1px solid var(--line);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.45);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.3rem clamp(1rem, 3vw, 1.8rem);
  border-bottom: 1px solid var(--line);
  background: var(--navy-850);
}

.drawer-head h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #fff;
  line-height: 1.3;
}

.drawer-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.drawer-close {
  margin-left: auto;
  flex: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--cream-dim);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.drawer-close:hover { border-color: var(--gold-500); color: var(--gold-300); }

.drawer-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); background: var(--navy-850); }

.drawer-tab {
  flex: 1;
  padding: 0.85rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
}
.drawer-tab:hover { color: var(--cream); }
.drawer-tab.active { color: var(--gold-300); border-bottom-color: var(--gold-500); background: rgba(205, 161, 82, 0.06); }

.drawer-body { flex: 1; overflow-y: auto; padding: 1.4rem clamp(1rem, 3vw, 1.8rem) 2rem; }


/* ---------- Ficha: barra de acciones -------------------------------- */

.ficha-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.btn-peligro { color: var(--err); }
.btn-peligro:hover:not(:disabled) { color: #f0b3ae; background: rgba(224, 115, 107, 0.1); }


/* ---------- Ficha: datos ------------------------------------------- */

.datagroup + .datagroup { margin-top: 1.8rem; }

.datagroup h3 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.datalist { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem 1.5rem; }

.dataitem { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.dataitem.full { grid-column: 1 / -1; }

.dataitem dt { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.dataitem dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--cream);
  line-height: 1.55;
  word-break: break-word;
}

.dataitem dd.vacio { color: #4a5468; font-style: italic; }

/* Conserva los saltos de línea que la persona escribió (motivación, dirección) */
.dataitem dd.multilinea { white-space: pre-wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
  padding: 0.28rem 0.7rem;
  background: rgba(205, 161, 82, 0.12);
  border: 1px solid rgba(205, 161, 82, 0.35);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--gold-300);
}


/* ---------- Ficha: bitácora de observaciones ------------------------ */

.obs-form { margin-bottom: 1.8rem; }

.timeline { position: relative; padding-left: 1.5rem; }

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}

.obs { position: relative; padding-bottom: 1.5rem; }
.obs:last-child { padding-bottom: 0; }

.obs::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold-500);
  border: 2px solid var(--navy-900);
}

.obs-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.obs-autor { font-size: 0.85rem; font-weight: 600; color: #fff; }
.obs-fecha { font-size: 0.75rem; color: var(--muted); }

/* Anotaciones generadas por el sistema al corregirse una ficha */
.obs-etiqueta {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.12rem 0.5rem;
}

.obs-auto::before { background: var(--muted); }
.obs-auto .obs-texto { border-style: dashed; color: var(--muted); font-size: 0.88rem; }

.obs-texto {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--cream-dim);
  white-space: pre-wrap;
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
}


/* ---------- Login --------------------------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--navy-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.8rem, 5vw, 2.6rem);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.login-logo {
  width: 92px;
  margin: 0 auto 1.6rem;
  display: flex;
  justify-content: center;
  line-height: 0;
}

.login-logo img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 22px rgba(205, 161, 82, 0.25));
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  margin: 0 0 0.4rem;
  color: #fff;
}

.login-card .sub {
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin: 0 0 2rem;
}

.login-form { display: flex; flex-direction: column; gap: 1.1rem; }

/* Campo de contraseña con botón para mostrarla u ocultarla */
.campo-clave { position: relative; display: flex; }

.campo-clave input { padding-right: 5.2rem; }

.ojo {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  padding: 0.35rem 0.6rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ojo:hover { border-color: var(--gold-500); color: var(--gold-300); }

.ojo[aria-pressed="true"] {
  border-color: var(--gold-500);
  color: var(--gold-300);
  background: rgba(205, 161, 82, 0.1);
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--gold-300); }


/* ---------- Estado de carga ---------------------------------------- */

.loading { padding: 3.5rem 1.5rem; text-align: center; color: var(--muted); font-size: 0.9rem; }

.spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 0.9rem;
  border: 2px solid var(--line);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* Selector de estado dentro de la cabecera de la ficha */
.selector-estado {
  width: auto;
  min-height: 32px;
  padding: 0.25rem 1.8rem 0.25rem 0.6rem;
  font-size: 0.78rem;
  background-position: right 0.55rem center;
}


/* ---------- Responsive ---------------------------------------------- */

@media (max-width: 640px) {
  .formbar { flex-direction: column; align-items: stretch; }
  .formbar .btn { width: 100%; }
  .topbar-sub { display: none; }
  .drawer { width: 100%; }

  /*
     En la barra superior compiten el logo, el titulo, el nombre de quien
     entro y el menu. En pantalla angosta el titulo se cortaba a la mitad
     ("Reyes y Sace..."), asi que aqui se achica y se deja pasar a dos
     lineas en vez de recortarse.
  */
  .topbar { gap: 0.65rem; padding-left: 0.8rem; padding-right: 0.8rem; }

  .topbar-title {
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .topbar-user { font-size: 0.72rem; }
  .topbar-logo { width: 30px; }

  /*
     Lo mismo en las pestanas: mejor que "Miembros inscritos" pase a dos
     lineas a que quede cortado.
  */
  .vista-tab {
    font-size: 0.82rem;
    padding: 0.85rem 0.6rem;
    letter-spacing: 0.03em;
  }

  .vista-tab-txt {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
  }
}

/* Pantallas muy angostas: el nombre de quien entro cede el espacio */
@media (max-width: 400px) {
  .topbar-user { display: none; }
}

/*
   En pantallas táctiles todo lo que se toca sube a 44px de alto, que es
   el mínimo recomendado para el dedo. En escritorio se dejan compactos
   porque ahí se apunta con el mouse.
*/
@media (max-width: 768px) {
  .btn-sm,
  .btn-ghost { min-height: 44px; }

  .menu-item { padding-top: 0.95rem; padding-bottom: 0.95rem; }

  .drawer-close { width: 44px; height: 44px; font-size: 1.35rem; }

  .selector-estado { min-height: 44px; font-size: 0.85rem; }

  .ojo { padding: 0.55rem 0.7rem; font-size: 0.78rem; }
  .campo-clave input { padding-right: 5.6rem; }

  .modal-acciones .btn { flex: 1 1 auto; min-height: 44px; }

  /* Los filtros del panel ocupan el ancho completo, uno debajo de otro */
  .toolbar .field { flex: 1 1 100%; }
  .toolbar .btn { width: 100%; }

  /* Las acciones de cada mentor no se aprietan unas contra otras */
  .acceso-acciones { gap: 0.5rem; }
  .acceso-acciones .btn { flex: 1 1 auto; }
}

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