/* ── Loading overlay ───────────────────────────────────────────── */
#divLoading > div { text-align: center; }
#loadingText {
  margin: 14px auto 0;
  padding: 8px 20px;
  max-width: 320px;
  color: var(--brand-deep, #507700);
  font-size: 14px;
  background: var(--brand-mist, #F4F8EA);
  border: 1.5px solid var(--brand-soft, #E8F2D2);
  border-radius: 24px;
}
#loadingText:empty { display: none; }

/* ── Barra de modo soporte técnico ─────────────────────────────── */
.preview-admin-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  height: 40px;
  background: #c0392b;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.preview-admin-bar-icon { font-size: 16px; opacity: .9; }
.preview-admin-bar-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-admin-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.preview-admin-btn {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.preview-admin-btn:hover { background: rgba(255,255,255,.3); color: #fff; }
.preview-admin-btn-exit { background: rgba(0,0,0,.2); }
.preview-admin-btn-exit:hover { background: rgba(0,0,0,.35); }
.app.has-preview-bar { padding-top: 40px; }

/* ============================================================
   demokratian — app-v2.css
   Área privada — REDISEÑO basado en feedback:
   · Sidebar oscura por defecto (admin + usuario en un mismo árbol)
   · Banner de cabecera configurable
   · Vote cards con espacio para imagen
   · Empty states diseñados
   · Estados con más color (no todo verde)
   · Tweakable: tema claro/oscuro y paleta de acento
   ============================================================ */

:root {
  /* ── Brand (acento) ────────────────────────────────────── */
  --brand:      #9ACA3C;
  --brand-deep: #385500; /* antes #7BA82E (2,68:1). Mismo tono que --green, saturación máxima: 5,03:1 sobre --paper y ≥4,5:1 sobre --green-soft, --green-mist y --paper-warm */
  --brand-soft: #E8F2D2;
  --brand-mist: #F4F8EA;

  /* ── Neutrales ─────────────────────────────────────────── */
  --ink:        #15181A;
  --ink-2:      #1F2426;
  --ink-3:      color-mix(in srgb, var(--ink-2) 95%, #fff);
  --ink-soft:   #2E322E;
  --slate:      #4F4F4F;
  --slate-soft: #4F4F4B; /* antes #9A9A95 (2,70:1) y #6B6B66 (5,1:1): ahora 7:1, AAA */
  --line:       #E5E5DF;
  --line-soft:  #EFEFE9;
  --paper:      #FAFAF7;
  --paper-warm: #F5F4EE;
  --paper-deep: #ECEAE0;
  --white:      #FFFFFF;

  /* ── Estados con más identidad de color ────────────────── */
  --st-open:        var(--brand-deep);   /* puede votar — verde */
  --st-open-bg:     var(--brand-soft);
  --st-open-tint:   var(--brand-mist);

  --st-voted:       #17457F;   /* ya votado — azul confianza */
  --st-voted-bg:    #DDE9F8;
  --st-voted-tint:  #EEF3FB;

  --st-locked:      #4D463D;   /* en serie — slate cálido */
  --st-locked-bg:   #ECE7DC;
  --st-locked-tint: #F4F1E7;

  --st-closed:      #6B3F00;   /* cerrada — ámbar */
  --st-closed-bg:   #F7E8CC;
  --st-closed-tint: #FBF3E2;

  --st-results:     #1A1D1A;   /* resultados — tinta */
  --st-results-bg:  #E5E5DF;

  --st-success:     #1F5C25;
  --st-danger:      #8F2626;
  --st-danger-bg:   #FBE3E3;

  /* ── Tipografía ────────────────────────────────────────── */
  --font-display: "Instrument Serif", "Georgia", "Times New Roman", serif;
  --font-body:    "Geist", "Inter", system-ui, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, monospace;

  /* ── Shell ─────────────────────────────────────────────── */
  --sb-w:      264px;
  --sb-w-mini: 72px;
  --tb-h:      56px;
  --banner-h:  170px;

  /* ── Bootstrap overrides ───────────────────────────────── */
  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper-warm);
  --bs-border-color: var(--line);
  --bs-border-radius: 10px;
}

/* ============================================================
   BASE
   ============================================================ */
html, body { height: 100%; }
html { scrollbar-gutter: stable; } /* evita el salto de layout al aparecer el scroll */
body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--paper-warm);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand-deep); text-decoration: none; }
a:hover { color: var(--ink); }
::selection { background: var(--brand-soft); color: var(--ink); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  grid-template-rows: var(--tb-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.app.is-mini { grid-template-columns: var(--sb-w-mini) 1fr; }

/* ============================================================
   SIDEBAR (DARK por defecto)
   ============================================================ */
.sb {
  grid-area: sidebar;
  background:
    linear-gradient(180deg, var(--ink-2) 0%, var(--ink) 100%);
  color: rgba(255,255,255,0.78);
  border-right: 1px solid var(--ink-3);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* Brand block */
.sb-brand {
  height: var(--tb-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sb-brand-logo {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--brand);
  display: grid; place-items: center;
  color: var(--ink);
  flex-shrink: 0;
  overflow: hidden;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  line-height: 1;
}
.sb-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.sb-brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--paper);
}
.sb-brand-name em { font-style: italic; color: var(--brand); }
.is-mini .sb-brand-name { display: none; }
.is-mini .sb-brand { padding: 0; justify-content: center; }

/* User block */
.sb-user {
  padding: 16px 18px 18px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sb-user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  display: grid; place-items: center;
  letter-spacing: 0.02em;
  position: relative;
}
.sb-user-avatar::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  background: var(--brand);
  border: 2px solid var(--ink-2);
  border-radius: 50%;
}
.sb-user-meta { min-width: 0; }
.sb-user-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--paper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-role {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--brand);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-cog {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.55);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 13px;
  transition: background .12s, color .12s, border-color .12s;
}
.sb-user-cog:hover {
  color: var(--paper);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
}
.is-mini .sb-user { grid-template-columns: 1fr; justify-items: center; padding: 16px 0; }
.is-mini .sb-user-meta, .is-mini .sb-user-cog { display: none; }

/* Scroll area */
.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.sb-section + .sb-section { margin-top: 16px; }

/* (copiado del panel de administración: aquí faltaba y el plan heredaba el verde de los enlaces) */
/* Plan contratado (bajo el bloque de usuario, solo admins de subdominio) */
.sb-plan {
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sb-plan-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  background: rgba(255,255,255,0.03);
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
a.sb-plan-pill:hover, a.sb-plan-pill.is-active {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border-color: color-mix(in srgb, var(--brand) 35%, transparent);
}
.sb-plan-pill i {
  font-size: 13px;
  color: var(--brand);
  flex-shrink: 0;
}
.sb-plan-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.62);
}
.sb-plan-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--paper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-mini .sb-plan { display: none; }
.sb[data-theme="light"] .sb-plan { border-bottom: 1px solid var(--line-soft); }
.sb[data-theme="light"] .sb-plan-pill {
  background: var(--paper-warm);
  border-color: var(--line);
}
.sb[data-theme="light"] a.sb-plan-pill:hover,
.sb[data-theme="light"] a.sb-plan-pill.is-active {
  background: var(--brand-mist);
  border-color: var(--brand-deep);
}
.sb[data-theme="light"] .sb-plan-pill i { color: var(--brand-deep); }
.sb[data-theme="light"] .sb-plan-label { color: var(--slate); }
.sb[data-theme="light"] .sb-plan-name { color: var(--ink); }

.sb-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6); /* 0.35 daba 3,2:1 */
  padding: 10px 14px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-section-label::before {
  content: "";
  width: 14px; height: 1px;
  background: rgba(255,255,255,0.15);
}
.sb-section.is-admin .sb-section-label {
  color: var(--brand);
}
.sb-section.is-admin .sb-section-label::before {
  background: var(--brand);
  opacity: 0.5;
}
.is-mini .sb-section-label { padding: 10px 0 6px; justify-content: center; }
.is-mini .sb-section-label span { display: none; }

/* Links */
.sb-link {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 7px;
  color: rgba(255,255,255,0.75);
  font-size: 13.5px;
  font-weight: 450;
  white-space: nowrap;
  transition: background .12s, color .12s;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}
.sb-link i { font-size: 16px; line-height: 1; color: rgba(255,255,255,0.45); }
.sb-link:hover { background: rgba(255,255,255,0.04); color: var(--paper); }
.sb-link:hover i { color: rgba(255,255,255,0.8); }
.sb-link.is-active {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--paper);
  position: relative;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 20%, transparent);
}
.sb-link.is-active i { color: var(--brand); }
.sb-link.is-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}
.sb-link .pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--brand);
  color: var(--ink);
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  line-height: 1.3;
}
.sb-link .chev {
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  transition: transform .18s ease;
}
.sb-link[aria-expanded="true"] .chev { transform: rotate(90deg); }
/* Padre de grupo con ítem activo: rayita verde sutil */
.sb-link.has-active {
  color: var(--paper);
  position: relative;
}
.sb-link.has-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: color-mix(in srgb, var(--brand) 50%, transparent);
  border-radius: 0 2px 2px 0;
}
.sb-link.has-active i:not(.chev) { color: color-mix(in srgb, var(--brand) 70%, transparent); }

.sb-sublinks {
  list-style: none;
  margin: 2px 0 4px;
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}
.sb-link[aria-expanded="true"] + .sb-sublinks { max-height: 500px; }
.sb-sublinks .sb-link {
  padding-left: 44px;
  font-size: 13px;
  color: rgba(255,255,255,0.62);
  position: relative;
}
.sb-sublinks .sb-link::before {
  content: "";
  position: absolute;
  left: 24px; top: 50%;
  width: 6px; height: 1px;
  background: rgba(255,255,255,0.2);
}
.sb-sublinks .sb-link:hover { color: var(--paper); background: rgba(255,255,255,0.03); }
.sb-sublinks .sb-link.is-active {
  color: var(--brand);
  background: transparent;
  box-shadow: none;
}
.sb-sublinks .sb-link.is-active::before { background: var(--brand); width: 10px; }
.sb-sublinks .sb-link.is-active::after { display: none; }

.is-mini .sb-link {
  grid-template-columns: 1fr;
  justify-content: center;
  justify-items: center;
  padding: 11px 8px;
}
.is-mini .sb-link span,
.is-mini .sb-link .pill,
.is-mini .sb-link .chev { display: none; }
.is-mini .sb-sublinks { display: none; }

/* Foot */
/* Aviso de privacidad de la zona autenticada. Es literal: aqui no se carga
   analitica de terceros, solo la cookie de sesion (y las de vista previa o 2FA
   si el propio usuario las activa). */
.sb-privacy {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 10.5px;
  line-height: 1.45;
  color: rgba(255,255,255,0.62); /* 0.40 daba 3,7:1 */
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}
.is-mini .sb-privacy { justify-content: center; padding: 12px 0; }
.is-mini .sb-privacy span { display: none; }

.sb-foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.45);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sb-foot .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 6px var(--brand);
}
.is-mini .sb-foot { justify-content: center; padding: 14px 0; }
.is-mini .sb-foot span { display: none; }

/* ============================================================
   SIDEBAR — variante CLARA (data-theme="light")
   ============================================================ */
.sb[data-theme="light"] {
  background: var(--white);
  color: var(--ink-soft);
  border-right: 1px solid var(--line);
}
.sb[data-theme="light"] .sb-brand { border-bottom: 1px solid var(--line-soft); }
.sb[data-theme="light"] .sb-brand-name { color: var(--ink); }
.sb[data-theme="light"] .sb-brand-name em { color: var(--brand-deep); }

.sb[data-theme="light"] .sb-user { border-bottom: 1px solid var(--line-soft); }
.sb[data-theme="light"] .sb-user-name { color: var(--ink); }
.sb[data-theme="light"] .sb-user-role { color: var(--brand-deep); }
.sb[data-theme="light"] .sb-user-avatar::after { border-color: var(--white); }
.sb[data-theme="light"] .sb-user-cog {
  color: var(--slate);
  border-color: var(--line);
}
.sb[data-theme="light"] .sb-user-cog:hover {
  color: var(--ink);
  background: var(--paper-warm);
  border-color: var(--ink);
}

.sb[data-theme="light"] .sb-nav { scrollbar-color: var(--line) transparent; }
.sb[data-theme="light"] .sb-nav::-webkit-scrollbar-thumb { background: var(--line); }

.sb[data-theme="light"] .sb-section-label {
  color: var(--slate-soft);
}
.sb[data-theme="light"] .sb-section-label::before { background: var(--line); }
.sb[data-theme="light"] .sb-section.is-admin .sb-section-label { color: var(--brand-deep); }
.sb[data-theme="light"] .sb-section.is-admin .sb-section-label::before { background: var(--brand); }

.sb[data-theme="light"] .sb-link { color: var(--ink-soft); }
.sb[data-theme="light"] .sb-link i { color: var(--slate); }
.sb[data-theme="light"] .sb-link .chev { color: var(--slate); }
.sb[data-theme="light"] .sb-link:hover { background: var(--paper-warm); color: var(--ink); }
.sb[data-theme="light"] .sb-link:hover i { color: var(--ink); }
.sb[data-theme="light"] .sb-link.is-active {
  background: var(--brand-mist);
  color: var(--brand-deep);
  box-shadow: inset 0 0 0 1px var(--brand-soft);
}
.sb[data-theme="light"] .sb-link.is-active i { color: var(--brand-deep); }
.sb[data-theme="light"] .sb-link.is-active::before { background: var(--brand); }

.sb[data-theme="light"] .sb-sublinks .sb-link { color: var(--slate); }
.sb[data-theme="light"] .sb-sublinks .sb-link::before { background: var(--line); }
.sb[data-theme="light"] .sb-sublinks .sb-link:hover { color: var(--ink); background: var(--paper-warm); }
.sb[data-theme="light"] .sb-sublinks .sb-link.is-active { color: var(--brand-deep); }
.sb[data-theme="light"] .sb-sublinks .sb-link.is-active::before { background: var(--brand); }

.sb[data-theme="light"] .sb-privacy {
  border-top: 1px solid var(--line-soft);
  color: var(--slate);
}

.sb[data-theme="light"] .sb-foot {
  border-top: 1px solid var(--line-soft);
  color: var(--slate);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.tb {
  grid-area: topbar;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 24px 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.tb-toggle {
  background: transparent;
  border: 1px solid transparent;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--slate);
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 18px;
  transition: background .12s, color .12s;
}
.tb-toggle:hover { background: var(--paper-warm); color: var(--ink); }
.tb-crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--slate);
  min-width: 0;
}
.tb-crumbs a { color: var(--slate); }
.tb-crumbs a:hover { color: var(--ink); }
.tb-crumbs .sep { opacity: 1; } /* 0.4 daba 1,7:1 */
.tb-crumbs .current { color: var(--ink); font-weight: 500; }
.tb-actions { display: flex; align-items: center; gap: 4px; }
/* Contador de mensajes sin leer (topbar .tb-action y sidebar .sb-link) */
.tb-count, .sb-count {
  display: inline-block;
  min-width: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--danger, #dc3545); color: #fff;
  font-size: 10px; font-weight: 600; line-height: 18px; text-align: center;
}
.tb-action .tb-count { position: absolute; top: 2px; right: 2px; }
.sb-link .sb-count { margin-left: auto; }
.tb-action {
  background: transparent;
  border: 1px solid transparent;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--slate);
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 15px;
  position: relative;
  transition: background .12s, color .12s;
}
.tb-action:hover { background: var(--paper-warm); color: var(--ink); }
.tb-action .badge-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--white);
}
.tb-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s;
  font-size: 13px;
  margin-left: 4px;
}
.tb-user:hover { background: var(--paper-warm); }
.tb-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--ink);
  font-weight: 600;
  font-size: 11.5px;
  display: grid; place-items: center;
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
  grid-area: main;
  min-width: 0;
  position: relative;
}

/* ── BANNER (cabecera con imagen, customizable) ─────────── */
.banner {
  height: var(--banner-h);
  position: relative;
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}
.banner-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}
/* Patrón generado por defecto cuando la organización no ha subido foto */
.banner-image.is-default {
  background:
    radial-gradient(ellipse at 80% 30%, color-mix(in srgb, var(--brand) 35%, transparent) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 70%, color-mix(in srgb, var(--brand) 18%, transparent) 0%, transparent 60%),
    linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 60%, var(--ink-3) 100%);
}
.banner-image.is-default::before {
  /* trama de puntos sutil */
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1.5px);
  background-size: 18px 18px;
  mix-blend-mode: overlay;
}
.banner-image.is-default::after {
  /* "marca de agua" tipográfica */
  content: attr(data-site);
  position: absolute;
  right: -20px; bottom: -30px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 200px;
  color: rgba(255,255,255,0.04);
  letter-spacing: -0.04em;
  white-space: nowrap;
  line-height: 1;
}
.banner-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, color-mix(in srgb, var(--ink) 50%, #000) 0%, transparent) 0%, color-mix(in srgb, color-mix(in srgb, var(--ink) 50%, #000) 50%, transparent) 100%),
    linear-gradient(90deg, color-mix(in srgb, color-mix(in srgb, var(--ink) 50%, #000) 55%, transparent) 0%, color-mix(in srgb, color-mix(in srgb, var(--ink) 50%, #000) 15%, transparent) 60%, transparent 100%);
  z-index: 1;
}
.banner-content {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 0 40px;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 28px;
}

.banner-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.banner-eyebrow::before {
  content: "";
  width: 22px; height: 1.5px;
  background: var(--brand);
}
.banner-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 3.4vw, 44px);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
  color: var(--paper);
}
.banner-title em { font-style: italic; color: var(--brand); }
.banner-deck {
  margin-top: 8px;
  font-size: 15px;
  color: rgba(255,255,255,0.78);
  max-width: 64ch;
}

/* Banner OFF */
.app.no-banner .banner { display: none; }
.app.no-banner .main-inner { padding-top: 36px; }
.app.no-banner .page-head { display: block; }
.app:not(.no-banner) .page-head { display: none; }

/* ── Main inner ─────────────────────────────────────────── */
.main-inner {
  padding: 28px 40px 64px;
  max-width: 1280px;
  margin: 0 auto;
}

/* Page head (sólo cuando banner está OFF) */
.page-head { margin-bottom: 32px; }
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-deep);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.page-eyebrow::before {
  content: "";
  width: 22px; height: 1.5px;
  background: var(--brand);
}
.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 3vw, 40px);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}
.page-title em { font-style: italic; color: var(--brand-deep); }

/* Page greet — saludo personalizado SIEMPRE bajo el banner */
.page-greet {
  margin-bottom: 28px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line-soft);
}
.page-greet .page-eyebrow { margin-bottom: 10px; }
.page-greet-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 2.8vw, 38px);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0 0 8px;
  color: var(--ink);
}
.page-greet-title em { font-style: italic; color: var(--brand-deep); }
.page-greet-deck {
  margin: 0;
  color: var(--slate);
  font-size: 15px;
  line-height: 1.5;
}
.page-greet-deck strong { color: var(--ink); font-weight: 600; }
.app.no-banner .page-greet { padding-top: 4px; }

/* ── Section heads ──────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin: 36px 0 16px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.section-head .meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--slate);
  letter-spacing: 0.02em;
}

/* ============================================================
   CARDS base
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
}

/* ============================================================
   STAT TILES
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}
@media (max-width: 820px) { .stats-row { grid-template-columns: 1fr; } }
.stat-tile {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.stat-tile::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--st-color, var(--brand));
  opacity: 0.7;
}
.stat-tile-icon {
  width: 40px; height: 40px;
  border-radius: 9px;
  background: var(--st-bg, var(--brand-mist));
  color: var(--st-color, var(--brand-deep));
  display: grid; place-items: center;
  font-size: 17px;
}
.stat-tile-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 2px;
}
.stat-tile-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.stat-tile-value small {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--slate);
  margin-left: 4px;
}

/* ============================================================
   STATUS PILLS — con más variedad de color
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.3;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-open    { background: var(--st-open-bg);    color: var(--st-open);    }
.pill-voted   { background: var(--st-voted-bg);   color: var(--st-voted);   }
.pill-locked  { background: var(--st-locked-bg);  color: var(--st-locked);  }
.pill-closed  { background: var(--st-closed-bg);  color: var(--st-closed);  }
.pill-results { background: var(--st-results-bg); color: var(--st-results); }
.pill-danger  { background: var(--st-danger-bg);  color: var(--st-danger);  }
.pill-live .dot { animation: live-pulse 1.4s ease-in-out infinite; }
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.tag-mono {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.tag-mono.tag-step {
  border-color: var(--brand-soft);
  background: var(--brand-mist);
  color: var(--brand-deep);
}

/* ============================================================
   VOTE-TYPE — tag con popover explicativo al hover/focus
   ============================================================ */
.vote-type {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 8px 3px 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  cursor: help;
  line-height: 1.4;
  font-weight: 400;
  transition: border-color .12s, color .12s;
}
.vote-type:hover, .vote-type:focus-visible {
  border-color: var(--ink-3);
  color: var(--ink);
  outline: none;
}
.vote-type:hover .vt-icon, .vote-type:focus-visible .vt-icon { color: var(--brand-deep); }
.vt-icon {
  font-size: 11px;
  color: var(--slate-soft);
  transition: color .12s;
}
.vote-type-popover {
  position: absolute;
  left: -1px;
  top: calc(100% + 12px);
  width: 280px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 18px 40px -16px rgba(20,30,18,0.22), 0 4px 12px -6px rgba(20,30,18,0.1);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
  text-transform: none;
  letter-spacing: 0;
  pointer-events: none;
  text-align: left;
  font-family: var(--font-body);
}
.vote-type:hover .vote-type-popover,
.vote-type:focus-visible .vote-type-popover,
.vote-type.is-open .vote-type-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.vt-pop-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand-deep);
  margin-bottom: 8px;
}
.vt-pop-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
  font-weight: 400;
}
.vote-type-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 14px;
  width: 11px; height: 11px;
  background: var(--white);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  transform: rotate(45deg);
}
/* si está cerca del borde derecho de la card, abrir hacia la izquierda */
.vote-type.popover-left .vote-type-popover {
  left: auto;
  right: -1px;
}
.vote-type.popover-left .vote-type-popover::before {
  left: auto;
  right: 14px;
}

/* ============================================================
   SEARCH / FILTER BAR
   ============================================================ */
.filterbar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-bottom: 18px;
  align-items: end;
}
@media (max-width: 1080px) {
  .filterbar { grid-template-columns: 1fr 1fr; }
  .filterbar .fb-search { grid-column: 1 / -1; }
}
.fb-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fb-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  padding-left: 2px;
}
.fb-input, .fb-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  padding: 8px 12px;
  width: 100%;
  min-width: 0;
}
.fb-input:focus, .fb-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-mist);
}
.fb-search {
  position: relative;
}
.fb-search .fb-input { padding-left: 36px; }
.fb-search i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  font-size: 14px;
  pointer-events: none;
}
.fb-actions {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 36px;
}

/* filter chips */
.fb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 12.5px;
  align-items: center;
}
.fb-chips-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
  margin-right: 4px;
}
.fb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: var(--brand-mist);
  border: 1px solid var(--brand-soft);
  border-radius: 999px;
  font-size: 12px;
  color: var(--brand-deep);
}
.fb-chip button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  opacity: 0.6;
  font-size: 13px;
}
.fb-chip button:hover { opacity: 1; background: rgba(255,255,255,0.5); }
.fb-chip-clear {
  font-size: 12px;
  color: var(--slate);
  border: none;
  background: transparent;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 4px;
}
.fb-chip-clear:hover { color: var(--ink); }

/* results counter / sort row */
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--slate);
}
.results-bar strong { color: var(--ink); font-weight: 600; }
.results-bar .sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.results-bar .sort select {
  border: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.results-bar .sort select:hover { background: var(--paper-warm); }

/* pagination */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--slate);
  letter-spacing: 0.02em;
}
.pagination-bar .pages {
  display: inline-flex; gap: 4px;
}
.pagination-bar .pages button {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  font: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .12s;
}
.pagination-bar .pages button:hover { border-color: var(--ink); color: var(--ink); }
.pagination-bar .pages button.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.pagination-bar .pages button.dots {
  border-color: transparent;
  background: transparent;
  cursor: default;
}


/* ============================================================
   COMPOSE FORM (contactar / notificar problema)
   ============================================================ */
.compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1080px) {
  .compose-layout { grid-template-columns: 1fr; }
}

.compose-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 32px 24px;
  min-width: 0;
}
.compose-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 22px;
}
.compose-card-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0;
}
.compose-card-head .meta {
  font-size: 12.5px;
  color: var(--slate);
}
.compose-card-head .meta b {
  color: var(--state-danger, var(--st-danger));
  font-weight: 600;
}

.compose-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.compose-row { display: grid; gap: 6px; }
.compose-row.split {
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 540px) { .compose-row.split { grid-template-columns: 1fr; } }
.compose-row label {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
}
.compose-row label .req { color: var(--st-danger); margin-left: 2px; }
.compose-row input[type="text"],
.compose-row input[type="email"],
.compose-row select,
.compose-row textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  padding: 10px 14px;
  width: 100%;
}
.compose-row textarea {
  min-height: 160px;
  resize: vertical;
  font-family: var(--font-body);
  line-height: 1.55;
}
.compose-row input:focus,
.compose-row select:focus,
.compose-row textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-mist);
}
.compose-row .helper {
  font-size: 12px;
  color: var(--slate);
  line-height: 1.45;
}
.compose-row .helper b { color: var(--ink); font-weight: 500; }

/* Sender info chip — readonly */
.sender-card {
  background: var(--brand-mist);
  border: 1px solid var(--brand-soft);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 14px;
  align-items: center;
}
.sender-card-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  display: grid; place-items: center;
}
.sender-card-info { min-width: 0; }
.sender-card-info strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.005em;
}
.sender-card-info .em {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.sender-card-note {
  font-size: 11.5px;
  color: var(--slate);
  text-align: right;
  max-width: 140px;
  line-height: 1.4;
}

/* Attachments */
.attach-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.attach-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--slate);
  font-size: 13.5px;
  cursor: pointer;
  width: fit-content;
  transition: all .12s;
}
.attach-add:hover { border-color: var(--brand); background: var(--brand-mist); color: var(--brand-deep); }
.attach-item {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 13px;
}
.attach-item-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--brand-mist);
  color: var(--brand-deep);
  display: grid; place-items: center;
}
.attach-item-name { color: var(--ink); font-weight: 500; }
.attach-item-size { font-family: var(--font-mono); font-size: 11px; color: var(--slate); }
.attach-item-remove {
  background: transparent; border: none; cursor: pointer;
  color: var(--slate); width: 24px; height: 24px;
  border-radius: 5px;
}
.attach-item-remove:hover { background: var(--st-danger-bg); color: var(--st-danger); }

.compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

/* Aside info column */
.compose-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.info-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.info-card .info-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-deep);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.info-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.005em;
  margin: 0 0 8px;
  color: var(--ink);
}
.info-card p {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 4px;
  line-height: 1.55;
}
.info-card .info-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  align-items: start;
  color: var(--ink-soft);
}
.info-card .info-row i {
  color: var(--brand-deep);
  font-size: 14px;
  margin-top: 2px;
}
.info-card .info-row + .info-row { border-top: 1px solid var(--line-soft); }
.info-card .info-row b { color: var(--ink); font-weight: 600; }


/* ============================================================
   GROUP CARD EXTENDED (todos los grupos)
   ============================================================ */
.group-card-x {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 120px 1fr;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.group-card-x:hover {
  border-color: var(--ink-3);
  transform: translateY(-1px);
  box-shadow: 0 22px 40px -28px rgba(20,30,18,0.22);
}
.group-card-x-thumb {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: var(--paper-warm);
  display: grid; place-items: center;
  position: relative;
}
.group-card-x-thumb .monogram {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 64px;
  color: var(--gp-c, rgba(255,255,255,0.85));
  text-shadow: 0 2px 8px rgba(0,0,0,0.12);
  line-height: 1;
}
.group-card-x-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.group-card-x-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.group-card-x-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}
.group-card-x-pills {
  display: flex;
  gap: 6px;
  align-items: center;
}
.group-card-x-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--slate);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.group-card-x-desc p, .group-card-desc p { margin: 0; }
.group-card-x-desc img, .group-card-desc img { max-width: 100%; height: auto; }
.group-card-x-stats {
  display: flex;
  gap: 22px;
  margin-top: 4px;
}
.group-card-x-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}
.group-card-x-stat i { color: var(--slate); font-size: 14px; }
.group-card-x-stat b { color: var(--ink); font-weight: 600; }
.group-card-x-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px dashed var(--line);
}
.group-card-x-belongs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--brand-deep);
  background: var(--brand-mist);
  padding: 4px 10px;
  border-radius: 999px;
}
@media (max-width: 600px) {
  .group-card-x { grid-template-columns: 1fr; }
  .group-card-x-thumb { aspect-ratio: 4/1; }
}

/* Pill variants for access type */
.pill-access-admin {
  background: var(--st-locked-bg);
  color: var(--st-locked);
}
.pill-access-open {
  background: var(--st-open-bg);
  color: var(--st-open);
}
.pill-access-closed {
  background: var(--st-danger-bg);
  color: var(--st-danger);
}

/* ============================================================
   GROUP HERO (detalle de grupo)
   ============================================================ */
.group-hero {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .group-hero { grid-template-columns: 1fr; }
  .group-hero-thumb { aspect-ratio: 4/1; max-height: 120px; }
  .group-hero-actions { flex-direction: row !important; flex-wrap: wrap; }
}
.group-hero-thumb {
  border-radius: 12px;
  display: grid; place-items: center;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  min-height: 160px;
}
.group-hero-thumb .monogram {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 96px;
  color: var(--gp-c, rgba(255,255,255,0.92));
  text-shadow: 0 4px 16px rgba(0,0,0,0.15);
  line-height: 1;
}
.group-hero-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.group-hero-eyebrow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.group-hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 3vw, 36px);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}
.group-hero-title em { font-style: italic; color: var(--brand-deep); }
.group-hero-desc {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 64ch;
}
.group-hero-desc p { margin: 0; }
.group-hero-desc img { max-width: 100%; height: auto; }
.group-hero-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  justify-content: flex-end;
}

/* ============================================================
   TABS (genérico)
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: none;
  padding: 12px 18px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: color .12s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px;
  bottom: -1px;
  height: 2.5px;
  background: var(--brand);
  border-radius: 2px 2px 0 0;
}
.tab .count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--paper-warm);
  color: var(--slate);
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.tab.active .count {
  background: var(--brand);
  color: var(--ink);
}
.tab-pane { display: block; }
.tab-pane[hidden] { display: none; }

/* ============================================================
   MEMBER GRID (tab Miembros)
   ============================================================ */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.member-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  transition: border-color .12s;
}
.member-card:hover { border-color: var(--ink-3); }
.member-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-mist) 0%, var(--brand-soft) 100%);
  color: var(--brand-deep);
  font-weight: 600;
  font-size: 14px;
  display: grid; place-items: center;
  position: relative;
}
.member-avatar.is-admin {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 100%);
  color: var(--brand);
}
.member-avatar.is-self::after {
  content: "tú";
  position: absolute;
  bottom: -4px; right: -8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  background: var(--brand);
  color: var(--ink);
  padding: 1px 5px;
  border-radius: 999px;
  border: 2px solid var(--white);
  letter-spacing: 0.04em;
}
.member-info { min-width: 0; }
.member-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  margin-top: 2px;
}
.member-meta.is-admin { color: var(--brand-deep); }
.member-action {
  background: transparent;
  border: 1px solid transparent;
  width: 30px; height: 30px;
  border-radius: 7px;
  color: var(--slate);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .12s;
}
.member-action:hover { background: var(--paper-warm); color: var(--ink); border-color: var(--line); }

/* Info panel (tab Información) */
.info-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
}
@media (max-width: 900px) { .info-panel { grid-template-columns: 1fr; } }
.info-panel .prose {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 32px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.info-panel .prose h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 20px 0 10px;
  color: var(--ink);
}
.info-panel .prose h3:first-child { margin-top: 0; }
.info-panel .prose p { margin: 0 0 12px; }
.info-panel .prose ul { padding-left: 18px; margin: 0 0 12px; }
.info-panel .prose ul li { margin-bottom: 4px; }


/* ============================================================
   GRUPO CARD
   ============================================================ */
.group-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 160px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.group-card:hover {
  border-color: var(--ink-3);
  transform: translateY(-1px);
  box-shadow: 0 22px 40px -28px rgba(20,30,18,0.22);
}
.group-card-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.group-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.group-card-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}
.group-card-stats {
  display: flex;
  gap: 18px;
  padding: 8px 0;
}
.group-card-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.group-card-stat .v {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
}
.group-card-stat .l {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
}
.group-card-stat.has-pending .v { color: var(--brand-deep); }
.group-card-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--slate);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.group-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 6px;
}
.group-card-thumb {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: var(--paper-warm);
}
.group-card-thumb .monogram {
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 64px;
  line-height: 1;
  color: var(--gp-c, rgba(255,255,255,0.85));
}
@media (max-width: 540px) {
  .group-card { grid-template-columns: 1fr; }
  .group-card-thumb { display: none; }
}

/* ── Paleta de grupos (6 entradas, asignadas por hash del nombre) ── */
.gp-0 { --gp-c: var(--brand-deep); background: linear-gradient(135deg, var(--brand-mist), var(--paper-warm)); }
.gp-1 { --gp-c: #B83A4C; background: linear-gradient(135deg, #f4dbe0, var(--paper-warm)); }
.gp-2 { --gp-c: #1E5BA8; background: linear-gradient(135deg, #dde4f4, var(--paper-warm)); }
.gp-3 { --gp-c: #9A5C1A; background: linear-gradient(135deg, #f4edd4, var(--paper-warm)); }
.gp-4 { --gp-c: #5B4AA8; background: linear-gradient(135deg, #e2dff4, var(--paper-warm)); }
.gp-5 { --gp-c: #1A7A72; background: linear-gradient(135deg, #d4f0ee, var(--paper-warm)); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  background: var(--white);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 48px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--paper-warm);
  display: grid; place-items: center;
  color: var(--slate);
  font-size: 28px;
  margin-bottom: 6px;
}
.empty h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0;
}
.empty p {
  font-size: 14.5px;
  color: var(--slate);
  max-width: 48ch;
  margin: 0 0 6px;
  line-height: 1.55;
}
.empty-actions { display: inline-flex; gap: 8px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  padding: 9px 18px;
  letter-spacing: -0.005em;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-width: 1.5px;
  white-space: nowrap;
  line-height: 1.3;
}
.btn:focus, .btn:focus-visible { box-shadow: 0 0 0 3px var(--brand-mist); outline: none; }

.btn-app-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn-app-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--white); }

.btn-app-accent {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--ink);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 50%, transparent);
}
.btn-app-accent:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--white); }

.btn-app-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-app-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--white); }

.btn-app-link {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
  padding-left: 8px; padding-right: 8px;
}
.btn-app-link:hover { color: var(--brand-deep); background: var(--brand-mist); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }

/* ============================================================
   PROFILE — main page
   ============================================================ */
.profile-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 880px) { .profile-layout { grid-template-columns: 1fr; } }

.profile-side {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  z-index: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: calc(var(--tb-h) + 24px);
}
.profile-side-link {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 450;
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  transition: background .12s, color .12s;
}
.profile-side-link i { color: var(--slate); font-size: 15px; }
.profile-side-link:hover { background: var(--paper-warm); color: var(--ink); }
.profile-side-link:hover i { color: var(--ink); }
.profile-side-link.active {
  background: var(--brand-mist);
  color: var(--brand-deep);
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--brand);
}
.profile-side-link.active i { color: var(--brand-deep); }

.profile-pane {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 320px;
}
.profile-pane[hidden] { display: none; }
.profile-pane-head {
  padding: 22px 28px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.profile-pane-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.profile-pane-head h2 em { font-style: italic; color: var(--brand-deep); }
.profile-pane-body { padding: 22px 28px 28px; }

/* Profile identity hero */
.profile-hero {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 28px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 20px;
  align-items: center;
}
@media (max-width: 600px) { .profile-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; } }
.profile-hero-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-mist) 0%, var(--brand-soft) 100%);
  color: var(--brand-deep);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 36px;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 1px var(--line);
  background-size: cover;
  background-position: center;
}
.profile-hero-info { min-width: 0; }
.profile-hero-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
  color: var(--ink);
}
.profile-hero-role {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-deep);
}
.profile-hero-meta {
  font-size: 13px;
  color: var(--slate);
  margin-top: 6px;
}
.profile-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Data table */
.profile-data {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
}
.profile-data-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  border-bottom: 1px solid var(--line-soft);
}
.profile-data-row:last-child { border-bottom: none; }
.profile-data-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--slate);
  padding: 14px 18px;
  background: var(--paper);
  border-right: 1px solid var(--line-soft);
}
.profile-data-value {
  font-size: 14px;
  color: var(--ink);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.profile-data-value.is-mono { font-family: var(--font-mono); }
.profile-data-value .verified {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--st-open-bg);
  color: var(--st-open);
}
@media (max-width: 600px) {
  .profile-data-row { grid-template-columns: 1fr; }
  .profile-data-label { border-right: none; border-bottom: 1px solid var(--line-soft); }
}

/* 2FA: códigos de respaldo */
.twofa-backup-code { letter-spacing: 2px; }

/* 2FA: selección de método (perfil.php). Mismo problema y mismo arreglo que
   .method-btn en el asistente de login: el azul por defecto de Bootstrap para
   .list-group-item.active no encaja con la marca y deja el icono invisible. */
.profile-method-btn.active,
.profile-method-btn.active:hover,
.profile-method-btn.active:focus {
  background: var(--brand-mist);
  border-color: var(--brand);
  color: var(--ink);
}

/* Image uploader */
.profile-image-uploader {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: center;
}
@media (max-width: 600px) { .profile-image-uploader { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.profile-image-preview {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--paper-warm);
  border: 3px solid var(--white);
  box-shadow: 0 0 0 1px var(--line);
  background-size: cover;
  background-position: center;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 52px;
  color: var(--brand-deep);
}
.profile-image-actions {
  display: flex;
  gap: 8px;
  flex-direction: column;
  align-items: flex-start;
}
@media (max-width: 600px) { .profile-image-actions { align-items: center; } }
.profile-image-actions .helper {
  font-size: 12.5px;
  color: var(--slate);
  margin-top: 4px;
  max-width: 38ch;
  line-height: 1.45;
}

/* ============================================================
   CROP IMAGE (profile photo uploader)
   ============================================================ */
.image_area  { position: relative; display: inline-block; }
.caja_crop   { position: relative; display: inline-block; cursor: pointer; }

img.image-crop { display: block; max-width: 100%; }

/* Preview box inside crop modal */
.preview {
  overflow: hidden;
  width: 160px;
  height: 160px;
  margin: 10px auto;
  border: 2px solid var(--line);
  border-radius: 50%;
}

/* Hover overlay over the circular photo */
.overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background-color: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  height: 0;
  transition: height .35s ease;
  width: 100%;
  border-radius: 0 0 50% 50%;
}
.caja_crop:hover .overlay,
.image_area:hover .overlay { height: 50%; cursor: pointer; }

.text_crop {
  color: #fff;
  font-size: 12px;
  font-family: var(--font-mono);
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
}

/* Circular user photo */
.img-circle {
  border-radius: 50%;
  width: 160px;
  height: 160px;
  object-fit: cover;
  background-size: cover;
  background-position: center;
  display: block;
}

/* Foto de perfil: círculo editable con insignia de cámara */
.profile-photo-pick {
  position: relative;
  display: block;
  width: 140px; height: 140px;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
}
.profile-photo-circle {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: grid; place-items: center;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 1px var(--line);
  transition: filter .2s;
}
.profile-photo-initials {
  background: linear-gradient(135deg, var(--brand-mist) 0%, var(--brand-soft) 100%);
  color: var(--brand-deep);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 52px;
}
.profile-photo-pick:hover .profile-photo-circle { filter: brightness(.9); }
.profile-photo-badge {
  position: absolute;
  right: 4px; bottom: 4px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  border: 3px solid var(--white);
  display: grid; place-items: center;
  font-size: 14px;
  transition: background .15s;
}
.profile-photo-pick:hover .profile-photo-badge { background: var(--brand-deep); }
.profile-photo-btn { cursor: pointer; margin-top: 4px; }

/* ============================================================
   MODAL (generic)
   ============================================================ */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 22, 0.5);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
}
.modal-back.is-open { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(20,30,18,0.4);
  transform: translateY(8px);
  transition: transform .18s;
}
.modal-back.is-open .modal-card { transform: translateY(0); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--ink);
  color: var(--paper);
}
.modal-head h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--paper);
}
.modal-head h3 em { font-style: italic; color: var(--brand); }
.modal-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  width: 30px; height: 30px;
  border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--paper); }
.modal-body { padding: 22px 24px; }
.modal-body .req-note {
  background: var(--brand-mist);
  border: 1px solid var(--brand-soft);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.modal-body .req-note b { color: var(--st-danger); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
}
.modal-field { display: grid; gap: 6px; margin-bottom: 14px; }
.modal-field label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
}
.modal-field label .req { color: var(--st-danger); margin-left: 2px; }
.modal-field input[type="text"],
.modal-field input[type="email"],
.modal-field input[type="password"],
.modal-field input[type="tel"],
.modal-field select,
.modal-field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  width: 100%;
}
.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-mist);
}
.modal-field input[readonly], .modal-field input:disabled {
  background: var(--paper-warm);
  color: var(--ink-soft);
}
.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 540px) { .modal-row { grid-template-columns: 1fr; } }

.modal-field-split {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}
@media (max-width: 600px) { .modal-field-split { grid-template-columns: 1fr; } }
.modal-field-helper {
  font-size: 12px;
  color: var(--brand-deep);
  line-height: 1.4;
}

/* password input with eye */
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 42px; padding-left: 36px; font-family: var(--font-mono); }
.pwd-wrap .pwd-lock {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  font-size: 14px;
}
.pwd-wrap .pwd-eye {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--slate);
  width: 32px; height: 32px;
  border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
}
.pwd-wrap .pwd-eye:hover { background: var(--paper-warm); color: var(--ink); }

/* pwd-wrap dentro de modal-field: sobrescribe el padding genérico para que
   quede espacio para los iconos lock (izq.) y eye (der.).
   Se incluye type="text" porque el toggle del ojo cambia el tipo del input. */
.modal-field .pwd-wrap input[type="email"],
.modal-field .pwd-wrap input[type="password"],
.modal-field .pwd-wrap input[type="tel"],
.modal-field .pwd-wrap input[type="text"] { padding: 10px 40px; }

/* Barra de fortaleza de contraseña */
.pwd-strength {
  margin-top: 8px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.pwd-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width .25s, background-color .25s;
}

/* Lista de requisitos de contraseña */
.pwd-reqs {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
}
.pwd-reqs li {
  font-size: 12px;
  color: var(--slate);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .15s;
}
.pwd-reqs li i { font-size: 11px; }
.pwd-req-ok { color: var(--st-success) !important; }

/* Mensaje de coincidencia de contraseñas */
.pwd-match-msg { font-size: 12px; margin-top: 6px; }
.pwd-match-msg.ok { color: var(--st-success); }
.pwd-match-msg.err { color: var(--st-danger); }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sb {
    position: fixed;
    z-index: 50;
    height: 100vh;
    width: var(--sb-w);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 30px 0 60px -20px rgba(20,30,18,0.4);
  }
  .app.is-mobile-open .sb { transform: translateX(0); }
  .main-inner { padding: 24px 20px 48px; }
  .banner-content { padding: 0 20px 24px; }
}

/* ============================================================
   TOPBAR EN MÓVIL
   Cabecera en una sola línea: el breadcrumb trunca con puntos
   suspensivos (el texto completo queda en el title) y se ocultan
   los textos del idioma y del nombre de usuario, dejando el globo
   con el código corto (ES) y el avatar con las iniciales.
   ============================================================ */
.tb-lang-short { display: none; }

@media (max-width: 768px) {
  .tb { gap: 8px; padding: 0 10px; }
  .tb-crumbs { gap: 4px; font-size: 12px; overflow: hidden; }
  .tb-crumbs .current {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tb-actions { flex: 0 0 auto; gap: 2px; }
  .tb-user { margin-left: 0; padding: 2px; }
  .tb-user-name  { display: none; }
  .tb-lang-long  { display: none; }
  .tb-lang-short { display: inline; }
}


/* Backdrop para cerrar el sidebar en mobile al clicar fuera */
.sb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40; /* entre el contenido (10) y el sidebar (50) */
  background: rgba(0, 0, 0, 0.45);
  animation: sbFadeIn .2s ease forwards;
}
@keyframes sbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ============================================================
   Modal "Ver datos del grupo" — tabla de datos
   ============================================================ */

.grupo-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.grupo-modal-table tr    { border: 1px solid var(--line); }
.grupo-modal-table th {
  width: 200px;
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper-warm);
  vertical-align: top;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.grupo-modal-table td {
  padding: 12px 16px;
  color: var(--ink-soft, var(--slate));
  line-height: 1.6;
  vertical-align: top;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  background: var(--white);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 48px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--paper-warm);
  display: grid; place-items: center;
  color: var(--slate);
  font-size: 28px;
  margin-bottom: 6px;
}
.empty h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0;
}
.empty p {
  font-size: 14.5px;
  color: var(--slate);
  max-width: 48ch;
  margin: 0 0 6px;
  line-height: 1.55;
}
.empty-actions { display: inline-flex; gap: 8px; }

/* ============================================================
   VOTACIÓN CARD v2 — imagen embebida dentro del resumen
   ============================================================ */
.vote-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
/* Solo se eleva al pasar el ratón la que tiene acción principal; las demás no parecen pulsables */
.vote-card[data-state="open"]:hover,
.vote-card[data-state="results"]:hover {
  border-color: var(--ink-3);
  transform: translateY(-1px);
  box-shadow: 0 22px 40px -28px rgba(20,30,18,0.22);
}
.vote-card-accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  border-radius: 13px 0 0 13px;
  background: var(--st-color, var(--brand));
}
.vote-card[data-state="open"]    { --st-color: var(--brand); --st-tint: var(--st-open-tint); }
.vote-card[data-state="voted"]   { --st-color: var(--st-voted); --st-tint: var(--st-voted-tint); }
.vote-card[data-state="locked"]  { --st-color: var(--st-locked); --st-tint: var(--st-locked-tint); }
.vote-card[data-state="closed"]  { --st-color: var(--st-closed); --st-tint: var(--st-closed-tint); }
.vote-card[data-state="results"] { --st-color: var(--ink); --st-tint: var(--paper-warm); }

.vote-card-body {
  padding: 22px 26px 18px 32px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Imagen embebida en el resumen — flota a la derecha por defecto.
   Decision 2026-10-02: manda el TAMAÑO DEL AUTOR (el width que escriben las
   manijas del editor) y la imagen conserva su proporcion natural; la ficha
   solo pone un TOPE con max-width para que una imagen enorme no rompa la
   tarjeta. height auto !important mata cualquier height suelto y garantiza
   la proporcion. */
.vote-desc-img {
  float: right;
  max-width: clamp(160px, 36%, 280px);
  height: auto !important;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin: 4px 0 10px 22px;
  background-color: var(--paper-warm);
  display: block;
  shape-outside: margin-box;
}
.vote-desc-img.is-left {
  float: left;
  margin: 4px 22px 10px 0;
}
/* El autor eligio lado/centrado en el editor (clases Bootstrap en el <img>):
   la ficha respeta el LADO; el recorte 16:10 y el clamp siguen mandando. */
.vote-desc-img.float-start {
  float: left;
  margin: 4px 22px 10px 0;
}
.vote-desc-img.d-block.mx-auto {
  float: none;
  margin: 4px auto 10px;
}
/* placeholder cuando la imagen es un fondo decorativo */
.vote-desc-img.is-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16/10; /* el placeholder es un div: sin proporcion se quedaria sin alto */
  color: rgba(255,255,255,0.55);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 40px;
}

.vote-card-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.vote-card-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 23px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--ink);
}
.vote-card-desc {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 20px 16px;
  max-width: 90ch;
  overflow: hidden; /* clearfix para el float de la imagen */
}
.vote-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 12.5px;
  color: var(--slate);
  margin-bottom: 16px;
}
.vote-card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.vote-card-meta i { font-size: 13px; color: var(--slate-soft); }
.vote-card-meta strong {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.vote-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px dashed var(--line);
  flex-wrap: wrap;
  justify-content: flex-end;
  clear: both; /* importante: separar del float de la imagen */
}
.vote-card-foot .grow { flex: 1; min-width: 0; }

/* paso x/y como "serie chip" */
.series-chip {
  display: inline-grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 10px;
  background: var(--brand-mist);
  border: 1px solid var(--brand-soft);
  border-radius: 8px;
  font-size: 12px;
  color: var(--brand-deep);
}
.series-chip-step {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--brand);
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.series-chip-step b { font-weight: 700; }
.series-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.series-chip-text strong { color: var(--ink); font-weight: 600; font-size: 12.5px; }
.series-chip-text span { font-size: 11px; opacity: 0.85; }

/* Mini resultados ya inline */
.vote-mini-results {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 380px;
  margin-bottom: 14px;
}
.vote-mini-row {
  display: grid;
  grid-template-columns: 100px 1fr 44px;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.vote-mini-bar {
  height: 6px;
  background: var(--line-soft);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.vote-mini-bar i {
  position: absolute;
  inset: 0;
  background: var(--bar-c, var(--brand));
  border-radius: 3px;
  transform-origin: left;
}
.vote-mini-row .pct {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: right;
  color: var(--ink);
  font-weight: 500;
}

@media (max-width: 640px) {
  .vote-desc-img {
    float: none;
    width: 100%;
    margin: 0 0 12px 0;
  }
  .vote-desc-img.is-left { float: none; margin: 0 0 12px 0; }
}

/* Las reglas .vote-success-hash* se movieron a voting.css: la cabecera del voto por
   enlace (header_voto_token.php) carga voting.css pero NO este app.css, asi que ahi el
   codigo de verificacion salia sin estilo. */

/* ── Animación de transición al previsualizar papeleta ───────────── */
@keyframes ballotFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}
@keyframes ballotFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ballot-area-exiting {
  animation: ballotFadeOut .2s ease-in forwards;
  pointer-events: none;
}
.ballot-preview {
  animation: ballotFadeIn .22s ease-out both;
}

/* ══════════════════════════════════════════════════════════════
   RESULTADOS DE RECUENTO — ensena.php
   ══════════════════════════════════════════════════════════════ */

/* ── vote-detail header (resultados) ────────────────────────── */
.vote-detail {
  display: flex;
  flex-direction: row;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
}
.vote-detail-accent {
  width: 5px;
  flex-shrink: 0;
  background: var(--st-color, var(--ink));
}
.vote-detail-body { flex: 1; min-width: 0; padding: 22px 28px 24px 34px; }
.vote-detail-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.vote-detail-title {
  font-family: var(--font-display, inherit);
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 12px;
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.vote-detail-desc {
  color: var(--ink-soft, var(--slate));
  font-size: 15px;
  margin: 0 0 6px;
  line-height: 1.6;
}

/* ── KPIs ────────────────────────────────────────────────────── */
.results-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .results-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .results-kpis { grid-template-columns: 1fr; } }
.kpi {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: var(--kpi-c, var(--brand));
  opacity: .85;
}
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--kpi-bg, var(--brand-mist, #e8f0fe));
  color: var(--kpi-c, var(--brand-deep, var(--brand)));
  display: grid;
  place-items: center;
  font-size: 19px;
  flex-shrink: 0;
}
.kpi-label {
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 3px;
  line-height: 1.3;
}
.kpi-value {
  font-family: var(--font-display, inherit);
  font-size: 24px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.kpi-value small { font-family: var(--font-body, inherit); font-size: 12px; font-weight: 400; color: var(--slate); margin-left: 4px; }
.kpi-sub { font-size: 11.5px; color: var(--slate); margin-top: 3px; line-height: 1.35; }

/* ── Extra data collapsible ─────────────────────────────────── */
.results-extra-data {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.results-extra-data summary {
  padding: 10px 16px;
  cursor: pointer;
  font-size: .85rem;
  color: var(--slate);
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.results-extra-data summary::-webkit-details-marker { display: none; }
.results-extra-data[open] summary { border-bottom: 1px solid var(--line); }
.results-extra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 14px 16px;
}
.results-extra-item { display: flex; flex-direction: column; gap: 2px; }
.results-extra-text { padding: 12px 16px; font-size: .88rem; color: var(--ink, #1a1d1a); line-height: 1.55; }
.results-extra-label { font-size: .7rem; color: var(--slate); text-transform: uppercase; letter-spacing: .04em; }
.results-extra-value { font-size: .88rem; color: var(--ink); font-weight: 500; }

/* ── Action bar ─────────────────────────────────────────────── */
.results-action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

/* ── Results layout grid ────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 768px) { .results-grid { grid-template-columns: 1fr; } }

/* ── Results panel ──────────────────────────────────────────── */
.results-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.results-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.results-panel-head h3 {
  font-size: .95rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.results-panel-head span {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--slate);
}
.results-panel-body { padding: 12px 16px 16px; }

/* ── Option items ───────────────────────────────────────────── */
.option-item {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  margin-bottom: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: all .2s;
  min-height: 140px;
}
.option-item:last-child { margin-bottom: 0; }
.option-item:hover {
  border-color: var(--slate);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.option-item.is-winner {
  border-color: var(--st-open);
  background: linear-gradient(135deg, var(--st-open-bg) 0%, var(--paper) 100%);
}
.option-item.is-eliminated { opacity: .6; }
.option-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 16px;
  font-size: .7rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.option-divider::before, .option-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.option-label {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: #9A9A95; /* gris de fondo; --slate-soft se oscureció para texto */
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}
/* Lista de votos: la caja muestra el id real de la opción, que puede tener 8 cifras. */
.option-label--id { width: auto; min-width: 56px; padding: 0 10px; font-size: 14px; }
.option-item.is-winner .option-label { background: var(--st-open); color: #fff; }
.option-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.option-title { font-size: 16px; font-weight: 600; color: var(--ink); margin: 0; }
.option-rank { color: var(--slate); font-family: var(--font-mono, monospace); margin-right: 4px; }
.option-desc { font-size: 14px; color: var(--slate); margin: 0; line-height: 1.5; }
.option-votes { display: flex; flex-direction: column; gap: 4px; text-align: right; min-width: 80px; }
.option-count { font-size: 20px; font-weight: 600; color: var(--ink); font-family: var(--font-mono, monospace); line-height: 1; }
.option-pct { font-size: 13px; color: var(--slate); font-family: var(--font-mono, monospace); }
.option-winner-badge {
  padding: 6px 16px;
  background: var(--st-open);
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  align-self: center;
}
/* Empate en el corte: ni ganadora ni eliminada */
.option-winner-badge.is-tied { background: #E0A84A; color: #1A1D1A; }
@media (max-width: 600px) {
  .option-item { grid-template-columns: 44px 1fr; gap: 12px; padding: 14px 16px; }
  .option-votes, .option-winner-badge { grid-column: 2; }
  .option-label { width: 44px; height: 44px; font-size: 15px; }
  .option-label--id { width: auto; min-width: 44px; padding: 0 8px; font-size: 12px; }
}

/* ── SVG Donut ──────────────────────────────────────────────── */
.results-donut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px;
}
.donut {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}
.donut svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut-center .v { font-size: 1.3rem; font-weight: 700; color: var(--ink); line-height: 1; }
.donut-center .l { font-size: .65rem; color: var(--slate); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; }
.legend { width: 100%; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: .8rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
}
.legend-row:last-child { border-bottom: none; }
.legend-row .sw {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c, #999);
  flex-shrink: 0;
}
.legend-row span:nth-child(2) { flex: 1; }
.legend-row .v { font-weight: 600; font-size: .8rem; }

/* ── Stacked horizontal bars ────────────────────────────────── */
.stacked-bars { padding: 4px 0; }
.stacked-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 100px;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  cursor: default;
}
.stacked-bar-row:hover { background: var(--paper-warm); }
.stacked-bar-label { font-size: .82rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stacked-bar-container {
  height: 16px;
  background: var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
}
.stacked-bar {
  height: 100%;
  border-radius: 6px;
  transition: width .6s ease;
  min-width: 4px;
}
.stacked-bar-meta { font-size: .78rem; color: var(--slate); text-align: right; font-family: var(--font-mono); white-space: nowrap; }

/* ── Cryptographic integrity panel ──────────────────────────── */
.results-integrity {
  border: 1.5px solid var(--st-open);
  border-radius: 12px;
  padding: 16px 20px;
  background: var(--st-open-tint, #F4F8EA);
  margin-top: 24px;
  margin-bottom: 16px;
}
.results-integrity.has-warnings {
  border-color: var(--st-danger);
  background: var(--st-danger-bg);
}
.results-integrity.pending {
  border-color: var(--line);
  background: var(--paper-warm);
}
.results-integrity-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--ink);
}
.results-integrity-head i { color: var(--st-open); font-size: 1.1rem; }
.results-integrity.has-warnings .results-integrity-head i { color: var(--st-danger); }
.results-integrity-data {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 16px;
  font-size: .82rem;
  margin: 0;
}
.results-integrity-data dt { color: var(--slate); font-weight: 500; }
.results-integrity-data dd { margin: 0; }
.results-integrity-data code {
  font-size: .78rem;
  background: rgba(255,255,255,.7);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  word-break: break-all;
}

/* ── Quorum status block ─────────────────────────────────────── */
.results-quorum-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.results-quorum-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
}
.results-quorum-item.quorum-ok {
  background: var(--st-open-tint, #F0FAF0);
  border: 1px solid var(--st-open, #4CAF50);
  color: var(--ink);
}
.results-quorum-item.quorum-ok i { color: var(--st-open, #4CAF50); }
.results-quorum-item.quorum-fail {
  background: #FFF8E1;
  border: 1px solid #F59E0B;
  color: var(--ink);
}
.results-quorum-item.quorum-fail i { color: #F59E0B; }

/* ── Section divider for sexos ──────────────────────────────── */
.results-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  padding: 16px 0 8px;
  border-bottom: 2px solid var(--brand);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── KPI: colores por tipo (reemplaza inline style) ────────── */
.kpi-censo    { --kpi-c: var(--st-voted);  --kpi-bg: var(--st-voted-bg); }
.kpi-emitidos { --kpi-c: var(--st-open);   --kpi-bg: var(--st-open-bg); }
.kpi-blanco   { --kpi-c: var(--st-closed); --kpi-bg: var(--st-closed-bg); }
.kpi-nulo     { --kpi-c: var(--st-danger); --kpi-bg: var(--st-danger-bg); }

/* ─── Imagen de opción ───────────────────────────────────────── */
.option-img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }

/* ─── Panel body variantes para gráficos ────────────────────── */
.results-panel-body--donut { padding: 12px 8px; }
.results-panel-body--bars  { padding: 12px 16px 8px; }

/* ─── Integridad: textos auxiliares ─────────────────────────── */
.results-integrity-match   { font-size: .75rem; }
.results-integrity-pending { font-size: .82rem; color: var(--slate); margin: 0; }

/* ─── Bare result view (iframe target) ─────────────────────── */
body.bare-result { background: var(--bg-base, #f5f7fa); }

/* ── VUT: system info bar ───────────────────────────────────── */
.system-bar {
  background: var(--st-voted-tint);
  border: 1px solid var(--st-voted-bg);
  color: var(--st-voted);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 13px;
  align-items: center;
}
.system-bar i { color: var(--st-voted); }
.system-bar strong { color: var(--ink); font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.system-bar .sep { opacity: 0.4; }

/* ── VUT: rounds table ──────────────────────────────────────── */
.rounds-table-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 24px;
}
.rounds-table-wrap > .results-panel-head { border-bottom: 1px solid var(--line-soft); }
.rounds-table-scroll { overflow-x: auto; }
.rounds-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 600px; }
.rounds-table thead th {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: right;
  white-space: nowrap;
}
.rounds-table thead th:first-child { text-align: left; }
.rounds-table thead th.is-eliminated { background: var(--st-danger-bg); color: var(--st-danger); }
.rounds-table thead th.is-winner     { background: var(--st-open-bg);   color: var(--st-open); }
.rounds-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink);
  font-size: 13px;
}
.rounds-table tbody td:first-child { text-align: left; font-family: var(--font-body); font-weight: 500; }
.rounds-table tbody tr.is-info { background: var(--paper-warm); }
.rounds-table tbody tr.is-info td { padding: 8px 16px; font-size: 12px; color: var(--ink-soft); font-family: var(--font-body); }
.rounds-table tbody tr.is-info td:first-child { text-align: left; }
.rounds-table td.is-leader    { background: var(--brand-mist); color: var(--brand-deep); font-weight: 600; }
.rounds-table td.is-eliminated { background: var(--st-danger-bg); color: var(--st-danger); }
.rounds-table tfoot td { padding: 12px 16px; text-align: right; font-size: 12.5px; }
.rounds-table tfoot td:first-child { text-align: left; font-weight: 500; }
.rounds-table tfoot .badge-final {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.rounds-table tfoot .badge-final.is-elegido   { background: var(--st-open);   color: var(--white); }
.rounds-table tfoot .badge-final.is-descartado { background: #9A9A95; color: var(--ink); }
.round-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
}
.round-tag.is-eliminado { background: var(--st-danger); color: var(--white); }
.round-tag.is-elegido   { background: var(--st-open);   color: var(--white); }
.rounds-foot-note { padding: 12px 24px; font-size: 12.5px; color: var(--slate); background: var(--paper); border-top: 1px solid var(--line-soft); }
.rounds-foot-note b { color: var(--ink); }

/* ─── Opciones en dos columnas (auditoría) ──────────────────── */
.options-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 16px 16px;
}
.options-gender-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    padding: 0 16px 16px;
}
.options-gender-col { display: flex; flex-direction: column; gap: 8px; }
.options-gender-head {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--slate);
    padding: 10px 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
@media (max-width: 600px) {
    .options-two-col,
    .options-gender-cols { grid-template-columns: 1fr; }
}

/* ─── Lista de votos / auditoría (ensenaLista) ──────────────── */
.hash-help {
    font-size: 13px;
    color: var(--slate);
    background: var(--paper-warm);
    border-left: 3px solid var(--brand);
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin: 16px 0;
    line-height: 1.6;
}
.hash-help b { color: var(--ink); }

.hash-list { margin-top: 16px; margin-bottom: 24px; }

.hash-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 16px 8px;
}
.hash-list-head h3 { margin: 0; font-size: 15px; }

.hash-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    min-width: 260px;
}
.hash-search-wrap i { color: var(--slate); font-size: 14px; }
.hash-search-wrap input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--ink);
    width: 100%;
}
.hash-search-wrap input::placeholder { color: var(--slate); }

.hash-row-head {
    display: grid;
    grid-template-columns: 1fr 160px 120px 80px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--slate);
    border-bottom: 1px solid var(--border);
    background: var(--paper-warm);
    border-radius: 8px 8px 0 0;
}
.hash-rows { font-family: var(--font-mono); font-size: 12px; }
.hash-row {
    display: grid;
    grid-template-columns: 1fr 160px 120px 80px;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}
.hash-row:nth-child(even) { background: var(--paper-warm); }
.hash-row .h { word-break: break-all; color: var(--ink); opacity: .65; font-size: 11.5px; }
.hash-row .v { color: var(--ink); font-weight: 600; word-break: break-all; }
.hash-row .t { color: var(--slate); font-size: 11.5px; }
.hash-row .ok { color: var(--green-deep); display: flex; align-items: center; gap: 4px; }
.hash-row .ok.is-error { color: var(--danger); }

/* ─── Modal resultados ──────────────────────────────────────── */
#modalResultado .modal-dialog {
  max-width: 94vw;
  width: 94vw;
  margin: 3vh auto;
}
#modalResultado .modal-content {
  height: 94vh;
  border-radius: 12px;
  overflow: hidden;
}
#modalResultado .modal-body {
  padding: 0;
  overflow: hidden;
}
#iframeResultado {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Admin Preview Mode banner ─────────────────────────────── */
.preview-mode-banner {
  background: #fff3cd;
  border-bottom: 2px solid #ffc107;
  color: #664d03;
  padding: 10px 20px;
  font-size: 0.875rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 1100;
}
.preview-mode-banner .preview-exit-link {
  color: #664d03;
  font-weight: 600;
  margin-left: 8px;
  text-decoration: underline;
}

/* ── Utilidades ─────────────────────────────────────────── */
.text-st-danger  { color: var(--st-danger) !important; }
.text-st-success { color: var(--st-success) !important; }
.text-brand-deep { color: var(--brand-deep) !important; }
.text-slate      { color: var(--slate) !important; }
.text-ink        { color: var(--ink) !important; }
.cursor-pointer  { cursor: pointer; }
.sr-offscreen    { position: absolute; left: -9999px; top: -9999px; }
.meta-mono       { font-family: var(--font-mono); font-size: 11px; color: var(--slate); }
.icon-xs         { font-size: 10px !important; }
.icon-sm         { font-size: 11px !important; }

/* Modal de primeros pasos (dashboard) */
.onboarding-img { max-height: 260px; }
.onboarding-content { background-color: #fff3cd; border-color: #ffe69c; }
.onboarding-crumb { background: #2c3e50; border-left: 4px solid #8bc34a; }

/* Tabla de usuarios: un identificador o un correo largo y sin espacios ensanchaba la tabla
   mas que su contenedor y dejaba fuera la columna de Acciones (lapiz, ver, bloquear...). */
#tableUsuarios td, #tableUsuarios th { overflow-wrap: anywhere; }

/* Pie de la barra: «Ver sitio público» y «Cerrar sesión» (antes en estilos en línea) */
.sb-link--muted { color: rgba(255,255,255,0.65); }
.sb-link--salir { color: #FF9C9C; }
.sb[data-theme="light"] .sb-link--muted { color: var(--slate); }
.sb[data-theme="light"] .sb-link--salir { color: #B42318; }


/* Enlace «Ir al contenido principal»: visible solo al recibir el foco por teclado */
.skip-link {
  position: absolute; top: -100px; left: 0;
  padding: 8px 16px; z-index: 9999; font-weight: 600;
  background: #1f2a1f; color: #fff;
  border-radius: 0 0 4px 0; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 0; color: #fff; }
#main-content:focus { outline: none; }

/* Lista de votos: desplegable con la papeleta en nombres (la cadena real queda en la fila) */
.hash-row .hash-detail { grid-column: 1 / -1; font-family: var(--font-body, inherit); font-size: 12.5px; }
.hash-row .hash-detail summary { cursor: pointer; color: var(--green-deep, #507700); font-weight: 500; width: fit-content; }
.hash-row .hash-detail[open] summary { margin-bottom: 6px; }
.hash-row .hash-detail-grupo { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--slate); margin: 6px 0 2px; }
.hash-row .hash-papeleta { list-style: none; margin: 0; padding: 8px 12px; background: var(--green-mist, #F4F8EA); border: 1px dashed var(--green, #9ACA3C); border-radius: 10px; }
.hash-row .hash-papeleta li { display: flex; align-items: baseline; gap: 10px; padding: 2px 0; }
.hash-row .hash-papeleta .opc-id { font-family: var(--font-mono, monospace); font-size: 11.5px; color: var(--slate); min-width: 3.2em; }
.hash-row .hash-papeleta .opc-nombre { flex: 1; color: var(--ink); }
.hash-row .hash-papeleta .opc-valor { font-family: var(--font-mono, monospace); font-size: 11.5px; color: var(--green-deep, #507700); white-space: nowrap; }

/* Grupos plegables del menú de administración de subdominios (Votaciones, Censo, Sitio) */
.sb-group-head { font-weight: 500; margin-top: 6px; }
.sb-group-head > i:first-child { color: var(--brand); }
.sb-group-body {
  display: none;
  margin: 2px 0 6px 18px;
  padding-left: 4px;
  border-left: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
}
.sb-link[aria-expanded="true"] + .sb-group-body { display: block; }
.is-mini .sb-group-body { display: none; }
.sb-link--cta {
  border: 1px solid color-mix(in srgb, var(--brand) 55%, transparent);
  color: var(--brand);
  margin: 4px 0;
}

/* Móvil: el aviso del tipo de votación, aunque invisible, ocupaba sitio a la derecha y
   ensanchaba la página (scroll horizontal). Cerrado no ocupa; abierto cabe en la pantalla. */
@media (max-width: 600px) {
  .vote-type-popover { display: none; width: min(280px, calc(100vw - 48px)); }
  .vote-type:hover .vote-type-popover,
  .vote-type:focus-visible .vote-type-popover,
  .vote-type.is-open .vote-type-popover { display: block; }
}

/* Tarjetas de tipo de votación (asistente de creación) */
.tarjeta-tipo { cursor: pointer; }
.tarjeta-tipo:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tarjeta-tipo.active { border-color: var(--brand) !important; box-shadow: 0 0 0 1px var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

/* ── Papeleta accesible: foco visible ──────────────────────────────────────
   El anillo de los botones era --brand-mist (#F4F8EA) sobre fondo claro: contraste 1,02:1,
   invisible para quien navega con teclado. WCAG 2.4.7 / 1.4.11 piden 3:1 como mínimo. */
.btn:focus-visible,
.btn-blanco:focus-visible,
.ballot-pos-btn:focus-visible,
.ballot-option-info:focus-visible,
.enc-info-btn:focus-visible,
.rank-chip:focus-visible,
.sel-avail-add:focus-visible,
.sel-basket-remove:focus-visible,
.bti-up:focus-visible,
.bti-down:focus-visible,
.bti-remove:focus-visible {
  outline: 3px solid var(--brand-deep, #507700);
  outline-offset: 2px;
  box-shadow: none;
}
.ballot-option:has(input:focus-visible),
.ballot-rank-row:has(input:focus-visible),
.ballot-check:has(input:focus-visible),
.enc-lista-item:has(input:focus-visible) {
  outline: 3px solid var(--brand-deep, #507700);
  outline-offset: 2px;
}

/* Reflow a 320 px (WCAG 1.4.10): el contador de opciones no debe forzar scroll horizontal */
.main-inner .options-counter { flex-wrap: wrap; }
.main-inner .options-counter .oc-label { min-width: 0; flex: 1 1 140px; }

/* Accesibilidad: un enlace dentro de un texto no puede distinguirse solo por el color (1.4.1) */
.meta a.text-brand-deep { text-decoration: underline; text-underline-offset: 2px; }

/* Accesibilidad AAA (2.3.3 y 2.4.12): movimiento reducido para todo y barra fija que no tape el foco */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
html { scroll-padding-top: 88px; }

/* Reflow en móvil: el .row con margen negativo de Bootstrap dejaba 2 px de desborde horizontal en todo el panel.
   clip no crea contenedor de scroll, así que no rompe los elementos sticky. */
main.main { overflow-x: clip; }

/* ── Validar mi teléfono / Cambiar mi correo (Usuarios/verificarTelefono, verificarCorreo) ──
   Mismas clases que el sitio 0 (demokratianBackSite/app.css), que aquí no se cargaba: sin
   esto el selector de país salía como un botón nativo y los avisos como texto plano. */
.phone-form-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 24px;
  max-width: 800px;
}
@media (max-width: 540px) { .phone-form-card { padding: 18px 16px; } }
.phone-form-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #FFF8E6;
  border: 1px solid #F5D87A;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: #7A5B00;
  margin-bottom: 22px;
  line-height: 1.5;
}
.phone-form-warn > i { flex-shrink: 0; margin-top: 3px; font-size: 15px; }
.phone-form-warn.is-ok { background: var(--brand-mist); border-color: var(--brand-soft); color: var(--brand-deep); }
/* Aviso de protección de datos: informativo, no una advertencia */
.phone-form-warn.is-info { background: var(--paper); border-color: var(--line); color: var(--ink-soft); font-size: 13px; }
.phone-form-warn.is-info > i { color: var(--brand-deep); }
.phone-form-warn.is-info strong { font-weight: 600; color: var(--ink); }

/* Selector de país + número */
.phone-input-group {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  position: relative;
}
.phone-input-group:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-mist);
}
.phone-input-group .country-select { display: flex; }
.phone-country-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  background: var(--paper-warm);
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 7px 0 0 7px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  color: var(--ink);
  font-family: var(--font-body);
}
.phone-country-btn:hover { background: var(--paper-deep); }
.phone-country-btn:focus-visible { outline: 2px solid var(--brand-deep); outline-offset: -2px; }
.phone-country-btn .bi-chevron-down { font-size: 10px; opacity: .6; margin-left: 2px; }
/* Prefijo de la repetición: copia el país elegido arriba, no se elige dos veces */
.phone-country-btn.is-static { cursor: default; font-family: var(--font-mono); color: var(--slate); }
.phone-country-btn.is-static:hover { background: var(--paper-warm); }
.compose-row input.phone-tel-input,
.phone-tel-input {
  flex: 1;
  width: 0; /* con auto, el ancho intrínseco del input desbordaba la tarjeta en móvil */
  border: none;
  border-radius: 0 7px 7px 0;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  box-shadow: none;
  min-width: 0;
  font-family: var(--font-body);
}
.compose-row .phone-tel-input:focus { box-shadow: none; }
.phone-tel-input:disabled { background: var(--paper-warm); color: var(--ink-soft); border-radius: 7px; }

/* Desplegable de países (partial country_phone_list.php) */
.country-select .dropdown-menu {
  min-width: 260px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  font-size: 13.5px;
}
.country-list { max-height: 260px; overflow-y: auto; }
.country-list .dropdown-header {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--slate);
  padding: 8px 10px 4px;
}
.country-list .dropdown-item { border-radius: 6px; padding: 6px 10px; color: var(--ink); }
.country-list .dropdown-item:hover,
.country-list .dropdown-item:focus { background: var(--brand-mist); color: var(--ink); }
.country-list-nota {
  margin: 0;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.4;
  color: var(--slate);
  white-space: normal;
  max-width: 280px;
}

.compose-form > .helper { font-size: 12px; color: var(--slate); line-height: 1.45; margin-top: -8px; }
/* Confirmación de envío del código */
.phone-form-status {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--brand-mist);
  border: 1px solid var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13.5px;
}
/* Paso 2: el código, separado del paso 1 */
.compose-form + .compose-form { margin-top: 26px; }
.compose-row input.phone-code-input {
  max-width: 220px;
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: .35em;
  text-align: center;
}
