/* ============================================================
   Fides - Hoja de estilos (sistema de diseño "Trust & Authority")
   Sin dependencias externas: fuentes auto-hospedadas en /assets/fonts.
   Paleta oficial de la cooperativa: Verde Oscuro + Amarillo Oro
   (el oro y sus tonos se reservan para acentos secundarios).
   Tokens semánticos; los tonos suaves se derivan con color-mix.
   ============================================================ */

/* ---------- Tipografías (auto-hospedadas, subset latino) ---------- */
@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/lexend-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/source-sans-3-italic-latin.woff2") format("woff2");
}

:root {
  /* Colores oficiales */
  --brand: #14532d;                                            /* Verde oscuro */
  --gold: #d4a017;                                             /* Amarillo oro */
  --gold-dark: #a16207;
  --gold-soft: #fbf3dd;
  --gold-soft: color-mix(in srgb, var(--gold) 12%, #ffffff);
  /* Derivados del verde institucional */
  --brand-dark: #0e3b20;
  --brand-dark: color-mix(in srgb, var(--brand) 78%, #000000);
  --brand-soft: #edf3ee;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, #ffffff);
  --brand-ring: rgba(20, 83, 45, .25);
  --brand-ring: color-mix(in srgb, var(--brand) 30%, transparent);
  /* El oro como acento secundario */
  --secondary: var(--gold);
  --accent: #16a34a;                                           /* Verde de acción (CTA) */
  --accent-dark: #15803d;
  /* Consejos: verde oscuro, oro oscuro y verde medio */
  --admin: #14532d;
  --vigilancia: #a16207;
  --credito: #2e7d46;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --bg: #fafafa;
  --surface: #ffffff;
  --footer-bg: #ffffff;
  --text: #18181b;
  --heading: var(--brand-dark);
  --muted: #71717a;
  --border: #e8e8ec;
  --radius: 12px;
  /* Escala de elevación consistente */
  --shadow: 0 8px 24px rgba(0, 0, 0, .07);       /* capas flotantes */
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .04);   /* micro-elevación en hover */
  /* Tipografía */
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--brand); }
h1, h2, h3 { font-family: var(--font-display); color: var(--heading); line-height: 1.2; letter-spacing: -.015em; }
h1 { font-weight: 700; }
h2, h3 { font-weight: 600; }

/* Foco visible para navegación por teclado (WCAG 2.4.7) */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Respeta la preferencia de menos movimiento del sistema */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Iconos SVG inline (helper icon()): heredan color y alinean con el texto */
.icon-svg {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -.2em;
  flex-shrink: 0;
}

/* ---------- Estructura ---------- */
.container { max-width: 880px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; }
.container-wide { max-width: 1100px; }

/* Contenido público centrado vertical y horizontalmente entre header y footer */
main.container {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* Tarjeta angosta centrada, para formularios cortos (asistencia, códigos, perfil) */
.card-narrow {
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.text-center { text-align: center; }
.text-center .form-actions { justify-content: center; }

/* Nombre de la cooperativa en la pantalla de acceso del admin */
.site-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; color: var(--brand); }

/* Modal de declaración de cursos (checkbox hack: sin JS, compatible con CSP estricta) */
.modal-dismiss-checkbox { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 999;
}
.modal-card {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1000; max-width: 480px; width: calc(100% - 2rem);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem); /* iOS Safari: la barra de direcciones dinámica hace que 100vh sobreestime el alto visible */
  overflow-y: auto; box-shadow: var(--shadow);
}
.modal-dismiss-checkbox:checked ~ .modal-backdrop,
.modal-dismiss-checkbox:checked ~ .modal-card { display: none; }

.checkbox-row {
  display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem;
  font-weight: 500; cursor: pointer;
}
.checkbox-row input { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); flex-shrink: 0; }

/* Pie al final de la página (antes era fijo y tapaba formularios). El body
   es flex en columna, así que en páginas cortas igual queda abajo. */
.site-footer {
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 1rem;
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
}
.site-footer a {
  color: var(--brand);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

/* ---------- Tarjetas: borde fino en vez de sombra ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title { font-family: var(--font-display); color: var(--heading); font-size: 1.2rem; font-weight: 600; margin: 0 0 1rem; letter-spacing: -.01em; }

/* ---------- Tarjetas como acordeón (<details>/<summary> nativos) ---------- */
/* Nunca más de la mitad del contenedor (ni más de 640px); todos los
   acordeones de una misma sección comparten este mismo ancho. */
details.card.accordion { padding: 0; overflow: hidden; max-width: min(640px, 50%); }
@media (max-width: 900px) {
  details.card.accordion { max-width: 100%; }
}
.accordion-summary {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: 1rem 1.25rem; margin: 0; cursor: pointer; list-style: none; user-select: none;
}
.accordion-summary::-webkit-details-marker,
.accordion-summary::marker { display: none; content: ''; }
.accordion-summary:hover { background: var(--brand-soft); }
.accordion-summary .card-title { margin: 0; font-size: 1rem; }
.accordion-chevron { flex-shrink: 0; color: var(--muted); transition: transform .15s ease; }
details.accordion[open] > .accordion-summary { border-bottom: 1px solid var(--border); }
details.accordion[open] > .accordion-summary .accordion-chevron { transform: rotate(180deg); }
.accordion-body { padding: 1.25rem; }
/* Acordeones a todo el ancho (Mi Perfil) con el estado visible en el encabezado */
details.card.accordion.accordion-full { max-width: 100%; }
.accordion-summary .card-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: .45rem; }
.accordion-status {
  flex-shrink: 1; min-width: 0; max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block;
}

/* ---------- Mi Perfil: resumen y pendientes ---------- */
.profile-meta { margin: -.5rem 0 1rem; color: var(--muted); font-size: .9rem; }
.profile-meta strong { color: var(--brand); letter-spacing: .05em; }
.profile-subtitle { font-family: var(--font-display); font-size: .95rem; color: var(--heading); margin: 0 0 .6rem; }
.pending-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.pending-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.pending-item.is-primary { border-color: var(--gold); background: var(--gold-soft); }
.pending-icon { flex-shrink: 0; color: var(--brand); display: flex; }
.pending-text { flex: 1; min-width: 0; font-size: .92rem; }
.pending-item .btn { flex-shrink: 0; }
.pending-done { display: flex; align-items: center; gap: .5rem; margin: 0; color: #166534; font-weight: 600; }

/* Listas de tarjetas (en lugar de tablas en pantallas pequeñas) */
.item-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.item-card { border: 1px solid var(--border); border-radius: 10px; padding: .8rem .9rem; background: var(--surface); }
.item-card.is-actionable { border-color: var(--gold); }
.item-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.item-card-meta { margin: .35rem 0 0; font-size: .82rem; color: var(--muted); }
.item-card form { margin-top: .6rem; }

/* Número de paso en formularios guiados ("1 Consejo", "2 Socio") */
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.3rem; height: 1.3rem; margin-right: .35rem; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: .75rem; font-weight: 700;
}
@media (max-width: 480px) {
  .pending-item { flex-wrap: wrap; }
  .pending-item .btn { width: 100%; }
}

.card-header {
  color: #fff; border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  padding: 1.15rem 1.5rem; margin: -1.5rem -1.5rem 1.25rem;
}
.card-header h2 { color: #fff; margin: 0 0 .2rem; font-size: 1.15rem; }
.card-header p { margin: 0; opacity: .85; font-size: .85rem; }

/* Colores de consejo planos (sin degradados) */
.council-administracion { background: var(--admin); }
.council-vigilancia { background: var(--vigilancia); }
.council-credito { background: var(--credito); }

/* ---------- Botones ----------
   Jerarquía: ORO (.btn-success, acción estrella) > verde sólido (.btn,
   primario estándar) > fantasma (.btn-secondary) > rojo (.btn-danger).
   Estados completos: hover (elevación), active (presionado más oscuro),
   focus-visible (anillo) y disabled. Altura mínima táctil de 44px. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  cursor: pointer; text-decoration: none; user-select: none;
  font-size: .8rem; font-weight: 600; font-family: var(--font-display);
  min-height: 2.25rem;
  padding: .3rem .75rem; border-radius: 8px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
/* En pantallas táctiles todos los botones recuperan el mínimo de 44px (WCAG) */
@media (pointer: coarse) {
  .btn { min-height: 2.75rem; }
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: var(--shadow-soft); }
.btn:active {
  background: var(--brand-dark);
  background: color-mix(in srgb, var(--brand) 82%, #000000);
  border-color: var(--brand-dark);
  border-color: color-mix(in srgb, var(--brand) 82%, #000000);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }

/* Acción estrella: oro oficial con texto verde muy oscuro (el blanco sobre
   este oro da 2.3:1 y no cumple WCAG AA; el verde oscuro da más de 6:1) */
.btn-success { background: var(--gold); border-color: var(--gold); color: var(--brand-dark); }
.btn-success:hover {
  background: var(--gold-dark);
  background: color-mix(in srgb, var(--gold) 88%, #000000);
  border-color: var(--gold-dark);
  border-color: color-mix(in srgb, var(--gold) 88%, #000000);
  color: var(--brand-dark);
}
.btn-success:active {
  background: var(--gold-dark);
  background: color-mix(in srgb, var(--gold) 78%, #000000);
  border-color: var(--gold-dark);
  border-color: color-mix(in srgb, var(--gold) 78%, #000000);
}
.btn-success:focus-visible {
  box-shadow: 0 0 0 3px rgba(212, 160, 23, .45);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 45%, transparent);
}

.btn-danger { background: transparent; border-color: #f3c6c6; color: var(--err); }
.btn-danger:hover { background: var(--err-soft); border-color: var(--err); box-shadow: none; }
.btn-danger:active { background: #fbdada; }
.btn-danger:focus-visible {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 30%, transparent);
}

.btn-secondary { background: transparent; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--gold-soft); border-color: var(--gold); color: var(--brand-dark); box-shadow: none; }
.btn-secondary:active {
  background: var(--gold-soft);
  background: color-mix(in srgb, var(--gold) 22%, #ffffff);
}

.btn-block { display: flex; width: 100%; }
.btn[disabled] {
  background: var(--border); border-color: var(--border); color: var(--muted);
  cursor: not-allowed; box-shadow: none;
}

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .85rem; margin: 1rem 0 .35rem; }
input, select, textarea {
  /* 1rem (16px): por debajo de eso, iOS Safari hace zoom automático al enfocar el campo */
  width: 100%; padding: .6rem .75rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
input[disabled], select[disabled] { background: var(--bg); color: var(--muted); }
.hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.code-block {
  display: block; background: var(--bg); border: 1px solid var(--border);
  padding: 1rem; border-radius: 10px; overflow-x: auto; white-space: pre;
  font-family: ui-monospace, monospace; font-size: .85rem; margin: .75rem 0;
}
.import-errors { max-height: 260px; overflow-y: auto; margin: 0; padding-left: 1.25rem; }
.import-errors li { color: #991b1b; font-size: .88rem; margin-bottom: .35rem; }
.import-errors.is-info li { color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { margin-top: 1.5rem; display: flex; gap: .75rem; flex-wrap: wrap; }

/* Fuerza los botones a una sola fila incluso en pantallas angostas: cada
   uno se achica en vez de pasar a una línea nueva. */
.form-actions-nowrap { flex-wrap: nowrap; justify-content: center; }
.form-actions-nowrap > .btn { flex: 1 1 0; min-width: 0; padding-left: .5rem; padding-right: .5rem; }

/* Buscador de miembros con autocompletado */
.member-search { position: relative; }
.member-search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  margin: 0; padding: .25rem; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto;
}
.member-search-results li {
  padding: .5rem .75rem; border-radius: 8px; font-size: .9rem; cursor: pointer;
}
.member-search-results li:hover,
.member-search-results li.is-active { background: var(--brand-soft); color: var(--brand); }
.member-search-results .member-search-empty { color: var(--muted); cursor: default; }
/* Socio que no puede ser propuesto: atenuado, con ícono y motivo, sin selección */
.member-search-results li.is-blocked { display: flex; align-items: flex-start; gap: .6rem; color: var(--muted); cursor: not-allowed; }
.member-search-results li.is-blocked:hover { background: none; color: var(--muted); }
.member-search-results li.is-blocked .icon-svg { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin-top: .15rem; vertical-align: 0; }
.member-search-results .member-block-text { display: block; font-size: .82rem; }
/* Socio apto (buscadores del panel): visto bueno delante del nombre */
.member-search-results li.is-ok { display: flex; align-items: flex-start; gap: .6rem; }
.member-search-results li.is-ok .icon-svg { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin-top: .15rem; vertical-align: 0; color: var(--ok); }
.member-search-results .member-search-empty:hover { background: none; color: var(--muted); }

.code-input {
  font-size: 1.6rem; letter-spacing: .5em; text-align: center;
  text-transform: uppercase; font-family: ui-monospace, monospace;
}

/* ---------- Alertas y badges ---------- */
.alert { border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; font-size: .9rem; border: 1px solid; text-align: center; }
.alert-success { background: var(--ok-soft); border-color: #bbf7d0; color: #166534; }
.alert-error { background: var(--err-soft); border-color: #fecaca; color: #991b1b; }
.alert-warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.bulk-mail-progress { margin: 1rem 0 0; }
.bulk-mail-progress ul { text-align: left; margin: .5rem 0 0; padding-left: 1.2rem; font-size: .8rem; }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
  padding: .18rem .6rem; border-radius: 999px;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; flex-shrink: 0; }
.badge-ok { background: var(--ok-soft); color: #166534; border-color: #d1f2dd; }
.badge-ok::before { background: var(--ok); }
.badge-warn { background: var(--warn-soft); color: #92400e; border-color: #fbe6bb; }
.badge-warn::before { background: var(--warn); }
.badge-err { background: var(--err-soft); color: #991b1b; border-color: #fbdada; }
.badge-err::before { background: var(--err); }
.badge-muted { background: var(--bg); color: var(--muted); border-color: var(--border); }
.badge-muted::before { background: var(--muted); }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }
.badge-brand::before { background: var(--brand); }
.badge-gold {
  background: var(--gold-soft); color: var(--gold-dark);
  border-color: #ecd28f;
  border-color: color-mix(in srgb, var(--gold) 35%, #ffffff);
}
.badge-gold::before { background: var(--gold); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: .6rem .75rem; border-bottom: 1px solid var(--border);
  font-weight: 600;
}
table.data td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; text-align: left; }
table.data tr:last-child td, table.data tr:last-child th { border-bottom: 0; }
table.data tr:hover td { background: var(--brand-soft); }
/* Cifras tabulares: evitan saltos de ancho en columnas numéricas */
table.data td.num, .stat .value { font-variant-numeric: tabular-nums; }

/* ---------- Estadísticas: el número es el protagonista ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }

/* Tarjetas lado a lado (gráficos del dashboard, tarjetas de Configuración) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: start; }
.card-grid > .card { margin-bottom: 0; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  border-bottom: 3px solid var(--secondary);
}
.stat .value { font-family: var(--font-display); color: var(--heading); font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat .label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: .15rem; }

/* ---------- Votación ---------- */
.candidate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.candidate {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; background: var(--surface); display: block;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.candidate:hover { border-color: var(--brand); box-shadow: var(--shadow-soft); }
.candidate:has(input:checked) {
  border: 2px solid var(--brand); background: var(--brand-soft);
  padding: calc(1rem - 1px);
}
.candidate input { position: absolute; opacity: 0; }
/* Foco por teclado visible sobre la tarjeta del candidato */
.candidate:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.candidate .head { display: flex; align-items: center; gap: .75rem; cursor: pointer; }
.candidate .num {
  flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}
.candidate img, .candidate .avatar {
  width: 3.25rem; height: 3.25rem; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.candidate .avatar {
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 1.3rem; font-weight: 700; font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center;
}
.candidate .bio {
  font-size: .82rem; color: var(--muted); margin: .6rem 0 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  line-clamp: 3; overflow: hidden;
}

/* Recordatorio de a quién se está votando, junto al botón de confirmar */
.selected-candidate {
  text-align: center; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border-radius: 10px;
  padding: .6rem 1rem; margin: 1rem 0 0;
}

/* ---------- Resultados ---------- */
.results-page { width: 100%; }
/* Sección no habilitada: bloque atenuado en gris, sin interacción */
.block-disabled {
  filter: grayscale(1);
  opacity: .5;
  pointer-events: none;
  user-select: none;
}
.chart-box { position: relative; height: 300px; margin: 1rem 0 1.25rem; }
.results-table th.num, .results-table td.num { text-align: right; white-space: nowrap; }
.results-table td.pos { width: 2.5rem; text-align: center; font-weight: 700; color: var(--muted); }
.results-table .badge { margin-left: .4rem; }
@media (max-width: 600px) {
  .chart-box { height: 220px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat .value { font-size: 1.5rem; }
}

.progress { position: relative; background: var(--border); border-radius: 999px; height: 1.35rem; overflow: hidden; }
.progress .bar {
  height: 100%; border-radius: 999px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: flex-end;
  color: #fff; font-size: .7rem; font-weight: 700; padding-right: .5rem;
  min-width: 1.5rem;
}

.council-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1rem 0; }
.council-step {
  text-align: center; padding: .7rem .4rem; border-radius: 10px;
  border: 1px solid var(--border); font-size: .8rem; background: var(--surface);
}
.council-step.done { border-color: var(--ok); background: var(--ok-soft); color: #166534; }
.council-step.current { border-color: var(--brand); background: var(--brand-soft); font-weight: 700; }
.council-step.pending { color: var(--muted); }
@media (max-width: 480px) {
  /* Nombres de consejo largos ("Consejo de Administración") no caben cómodos en 3 columnas en teléfonos angostos */
  .council-steps { grid-template-columns: 1fr; }
}

.code-display {
  font-size: 2rem; letter-spacing: .4em; font-weight: 800; text-align: center;
  font-family: ui-monospace, monospace; color: var(--brand-dark);
  background: var(--gold-soft); border: 1px dashed var(--gold-dark);
  border-radius: 12px; padding: 1rem; margin: 1rem 0;
}

/* Insignia circular de estado (pantallas de confirmación) */
.status-icon {
  width: 3.5rem; height: 3.5rem; margin: 0 auto .75rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.status-icon .icon-svg { width: 1.75rem; height: 1.75rem; }
.status-icon-ok { background: var(--ok-soft); color: var(--ok); }
.status-icon-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Organigrama ---------- */
.org-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.org-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem 1rem; text-align: center;
}
.org-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-display); font-size: 1.3rem; margin: 0 auto .75rem;
}
.org-avatar-free { background: var(--bg); color: var(--muted); border: 1px dashed var(--border); }
.org-card h3 { margin: .2rem 0; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
.org-holder { margin: .25rem 0 .6rem; color: var(--muted); font-size: .9rem; }

/* ---------- Panel admin: sidebar claro ---------- */
.admin-layout { display: flex; flex: 1; }
.admin-sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--surface); color: var(--text);
  border-right: 1px solid var(--border);
  padding: 1.25rem .75rem; display: flex; flex-direction: column; gap: .15rem;
}
.admin-sidebar .brand {
  color: var(--brand); font-family: var(--font-display); font-weight: 700; padding: 0 .5rem 1rem;
  font-size: 1.05rem; letter-spacing: -.01em;
}
.admin-sidebar nav a {
  display: flex; align-items: center; gap: .6rem;
  color: var(--muted); text-decoration: none;
  padding: .5rem .75rem; font-size: .9rem; font-weight: 600;
  border-radius: 10px; margin-bottom: .1rem;
  transition: background .15s, color .15s;
}
.admin-sidebar nav a .icon-svg { width: 1.1rem; height: 1.1rem; }
.admin-sidebar nav a:hover { background: var(--bg); color: var(--text); }
.admin-sidebar nav a.active { background: var(--brand-soft); color: var(--brand); }
.admin-main { flex: 1; padding: 1.5rem 1.5rem 2.5rem; max-width: calc(100% - 230px); }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.25rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.admin-topbar-user { display: flex; align-items: center; gap: .6rem; font-size: .9rem; font-weight: 600; }
.admin-topbar-user form { margin: 0; }
.admin-topbar-user button {
  display: inline-flex; align-items: center; gap: .4rem;
  width: auto; background: none; border: 1px solid var(--err); color: var(--err);
  border-radius: 8px; padding: .35rem .8rem; cursor: pointer; font-size: .8rem;
  font-family: inherit; transition: background .15s;
}
.admin-topbar-user button:hover { background: var(--err-soft); }
.admin-main .page-title { margin: 0 0 .25rem; font-size: 1.5rem; letter-spacing: -.02em; }
.admin-main .page-subtitle { color: var(--muted); margin: 0 0 1.25rem; font-size: .9rem; }
@media (max-width: 760px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-main { max-width: 100%; }
}

.tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a {
  padding: .5rem .9rem; text-decoration: none; color: var(--muted);
  font-weight: 600; font-size: .88rem; border-radius: 10px 10px 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); background: none; }

/* Tabs de consejos en Resultados: solo CSS (radios ocultos, sin JS, CSP-safe) */
.council-tabbar { justify-content: center; }
.council-tabs > input { position: absolute; opacity: 0; pointer-events: none; }
.tabs label {
  padding: .5rem .9rem; color: var(--muted); cursor: pointer;
  font-weight: 600; font-size: .88rem; border-radius: 10px 10px 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabs label:hover { color: var(--text); }
.council-panel { display: none; }
#tab-administracion:checked ~ #panel-administracion,
#tab-vigilancia:checked ~ #panel-vigilancia,
#tab-credito:checked ~ #panel-credito { display: block; }
#tab-administracion:checked ~ .council-tabbar label[for="tab-administracion"],
#tab-vigilancia:checked ~ .council-tabbar label[for="tab-vigilancia"],
#tab-credito:checked ~ .council-tabbar label[for="tab-credito"] {
  color: var(--brand); border-bottom-color: var(--brand);
}

.actions-inline { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.actions-inline form { display: contents; }
.search-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.search-row > div { flex: 1; min-width: 220px; }
.search-row label { margin-top: 0; }
.search-row .form-actions { margin: 0; }
/* Variante centrada (selector de año en Resultados) */
.search-row-center { justify-content: center; }
.search-row-center > div { flex: 0 1 auto; }

/* Nueva asignación manual: 4 campos + 2 botones en una sola línea, así que
   cada campo se achica a lo que realmente necesita en vez del min-width: 220px genérico. */
.assignment-row .field-position,
.assignment-row .field-member,
.assignment-row .field-date { flex: 1 1 160px; min-width: 140px; }
.assignment-row .form-actions { flex: 0 0 auto; }

/* ---------- Portada ---------- */
.hero { text-align: center; padding: 2.25rem 1.5rem; }
.hero h1 { margin: 0 0 .35rem; }
.hero-subtitle { color: var(--muted); margin: 0 0 1.35rem; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.home-grid .card { position: relative; margin: 0; text-align: center; transition: border-color .15s, box-shadow .15s; }
.home-grid .card:hover { border-color: var(--brand); box-shadow: var(--shadow-soft); }
/* Icono destacado de cada acceso de la portada */
.home-grid .icon {
  width: 3rem; height: 3rem; margin: 0 auto .5rem; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.home-grid .icon .icon-svg { width: 1.5rem; height: 1.5rem; }
.home-grid .icon-accent { background: var(--ok-soft); color: var(--accent-dark); }
.home-grid .icon-gold { background: var(--gold-soft); color: var(--gold-dark); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem; }
.toggle-row label { margin: 0; }
.toggle-row input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--brand); }

.pagination { display: flex; gap: .4rem; margin-top: 1rem; }
.pagination a, .pagination span {
  padding: .3rem .7rem; border-radius: 8px; text-decoration: none;
  border: 1px solid var(--border); font-size: .85rem;
}
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Acta de distribución de cargos ---------- */
.acta-document { max-width: 780px; margin: 0 auto; line-height: 1.6; }
.acta-header { text-align: center; margin-bottom: 1.5rem; }
.acta-header img { max-height: 70px; margin-bottom: .5rem; }
.acta-header h1 { font-size: 1.15rem; letter-spacing: .02em; margin: .5rem 0 .25rem; }
.acta-header p { margin: 0; color: var(--muted); font-weight: 600; }
.acta-council-title {
  margin: 1.75rem 0 .5rem; padding-bottom: .3rem; text-align: center;
  border-bottom: 2px solid var(--brand); color: var(--brand-dark);
}
.acta-table { border: 1px solid var(--border); }
/* Especificidad "table.data.acta-table" a propósito: table.data th (más
   específico que .acta-table th solo) ya fija color/tipografía y ganaría
   el conflicto si no se iguala aquí. */
table.data.acta-table th {
  background: var(--brand);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 80%);
  color: #fff; text-transform: none; font-size: .8rem; letter-spacing: normal;
  border: 1px solid var(--brand-dark);
  /* Sin esto, la mayoría de navegadores quita los colores de fondo al imprimir/guardar como PDF */
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.acta-table td, .acta-table th { vertical-align: middle; border: 1px solid var(--border); }
.acta-table td:nth-child(3), .acta-table td:nth-child(5) { min-width: 110px; height: 2.5rem; }
.acta-signatures {
  display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center;
  margin-top: 3.5rem; text-align: center;
}
.acta-signature { flex: 1 1 220px; max-width: 260px; }
.acta-signature-line { border-top: 1px solid var(--text); margin-bottom: .4rem; height: 2.5rem; }
.acta-signature p { margin: 0; font-size: .88rem; }
.acta-signature p:first-of-type { font-weight: 700; }

@media print {
  .admin-sidebar, .admin-topbar, .site-footer, #acta-toolbar, .alert { display: none !important; }
  .admin-main { max-width: 100%; padding: 0; }
  .acta-document { border: none; box-shadow: none; padding: 0; max-width: 100%; }
  /* --border es un gris muy claro: casi no se ve al imprimir/guardar como PDF */
  .acta-table, .acta-table td, .acta-table th { border-color: #000 !important; }
}

/* ---------- Acceso del panel (login, recuperar y restablecer contraseña) ----------
   Mismo lenguaje que las pantallas de ingreso de los socios: una caja
   centrada vertical y horizontalmente, textos centrados y controles de 52px. */
.auth-page { background: #f5f7f5; color: #10241a; font-size: 17px; }
.auth {
  flex: 1; width: 100%; max-width: 420px; margin: 0 auto;
  padding: 2rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: center; text-align: center;
}
.auth-brand {
  align-self: center; margin-bottom: 1.5rem; text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--brand);
}
.auth-brand img { height: 40px; width: auto; display: block; }
.auth .alert { margin-bottom: 1rem; }
.auth-card {
  background: var(--surface); border: 1px solid #e1e7e2; border-radius: 20px;
  padding: 2rem 1.5rem 1.5rem;
}
.auth-mark {
  width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.auth-mark .icon-svg { width: 28px; height: 28px; vertical-align: 0; }
.auth-card h1 { margin: 0 0 .35rem; font-size: 1.45rem; font-weight: 600; color: #10241a; letter-spacing: -.02em; }
.auth-lead { margin: 0 0 1.5rem; color: #56635c; font-size: .98rem; line-height: 1.45; }
.auth-card form { text-align: left; }
.auth-card label { margin: 1.1rem 0 .45rem; font-size: .92rem; color: #10241a; }
.auth-card label:first-of-type { margin-top: 0; }
.auth-card input {
  min-height: 52px; padding: .75rem .95rem; font-size: 1.05rem;
  border: 1.5px solid #c9d3cc; border-radius: 14px;
}
.auth-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.auth-card .btn {
  min-height: 52px; margin-top: 1.5rem; border-radius: 14px; font-size: 1rem;
  transition: background .2s, transform .12s;
}
.auth-card .btn:active { transform: scale(.98); }
.auth-links { margin: 1.25rem 0 0; font-size: .95rem; }
.auth-back { margin: 1.25rem 0 0; font-size: .92rem; }
.auth-links a, .auth-back a { color: var(--brand); font-weight: 600; text-underline-offset: 3px; }
.auth-back a { color: #56635c; font-weight: 400; }
