/* ═══════════════════════════════════════════════════════════════════════════
   Corazón Exprés — CSS Unificado
   Responsive · Mobile-first · Sin dependencias externas
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── Custom Properties ────────────────────────────────────────────────────── */
:root {
  /* Colores de marca */
  --c-brand: #d6000b;
  /* rose-700 — corazón */
  --c-brand-dark: #870006;
  --c-brand-light: #DCDCDC;
  /* #ffe4e6 */
  --c-primary: #475569;
  /*#0e7490 cyan-700 */
  --c-primary-dk: #262D38;
  --c-primary-lt: #cffafe;
  /* Estados */
  --c-success: #15803d;
  --c-warn: #b45309;
  --c-danger: #b91c1c;
  --c-info: #1d4ed8;
  /* Superficie */
  --c-bg: #EBEBEB;
  /*#f1f5f9*/
  --c-surface: #ffffff;
  --c-border: #cbd5e1;
  --c-border-dk: #cbd5e1;
  /* Texto */
  --c-text: #0f172a;
  --c-text-2: #9DA9BB;
  --c-text-3: #475569;
  /*#94a3b8*/
  --c-text-4: #94a3b8;
  /* Sidebar */
  --sb-bg: #dcdcdc;
  /*#09162d#1e293b*/
  --sb-bg_rose: #ffc4c4;
  --sb-text: #475569;
  /*#94a3b8*/
  --sb-active: #be123c;
  --sb-hover: #d6000b;
  --sb-w: 248px;
  /* Misc */
  --h-header: 56px;
  --radius: 20px;
  --radius-lg: 10px;
  --shadow: 0 3px 20px rgba(0, 0, 0, .3), 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, .07), 0 2px 4px rgba(0, 0, 0, .05);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, .08), 0 4px 6px rgba(0, 0, 0, .04);
  --transition: .15s ease;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  /* Colores reutilizables */
  --c-brand-bg: #ffe2e2;
  /* fondo de tono de marca: iconos, estados activos */
  --c-success-bg: #dcfce7;
  /* fondo verde suave: avisos/mensajes positivos */
  --c-separator: #f1f5f9;
  /* divisores muy sutiles */
  --c-danger-form: #dc2626;
  /* rojo de validación de formularios (usado en .consent-box) */
  /* Alias de variables usadas en portal pero no definidas en app.css */
  --c-text-muted: var(--c-text-2);
  --c-warning: var(--c-warn);
}

/* ── Reset mínimo ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.5;
  min-height: 100vh;
}

img, svg { vertical-align: middle; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; }

/* ── Tipografía ───────────────────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.0625rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: .9375rem; font-weight: 600; }
small { font-size: .8125rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT DE APLICACIÓN
   ═══════════════════════════════════════════════════════════════════════════ */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sb-w);
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: 1rem 1rem .875rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
}

.sidebar-logo-text { font-size: 1rem; font-weight: 700; color: #f1f5f9; white-space: nowrap; }

/* ── Navegación sidebar ───────────────────────────────────────────────────── */
.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

/* Botón de grupo (acordeón) */
.nav-group-btn {
  display: block;
  width: 100%;
  padding: .5rem 1rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition);
}

.nav-group-btn:hover {
  color: var(--c-brand);
  /*#cbd5e1*/
}

.nav-accordion .nav-group-btn {
  color: var(--c-brand);
  /*#fda4af*/
}

/* Hijos: ocultos por defecto, visibles cuando el acordeón está abierto */
.nav-group-items { max-height: 0; overflow: hidden; transition: max-height 0.01s ease-in-out; }

.nav-accordion.open .nav-group-items {
  max-height: 500px;
  /* Un valor mayor a lo que pueda medir tu menú */
}

/* Ítem de navegación */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: .4375rem 1rem .4375rem 1.375rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--sb-text);
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  text-decoration: none;
}

/* Panel (nivel raíz, sin indent) */
a.nav-item { padding-left: 1rem; }

/* Hijos del acordeón: misma sangría entre sí */
.nav-group-items .nav-item { padding-left: 1.375rem; border-radius: 0 5px 5px 0; }

.nav-item.active {
  background: rgba(255, 255, 255, 1);
  /*background: linear-gradient(90deg,rgba(255, 255, 255, 1) 0%, rgba(255, 196, 196, 1) 50%);*/
  color: var(--c-text);
  border-radius: 0 5px 5px 0;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--c-brand);
  /*border-radius: 0 2px 2px 0;*/
}

.nav-item:hover,
.nav-item.active:hover {
  background: var(--sb-hover);
  color: #e2e8f0;
  border-radius: 0 5px 5px 0;
}

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Pie de sidebar */
.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
  padding: .75rem 1rem;
}

.sidebar-user { display: flex; align-items: center; gap: .625rem; }

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--c-brand);
  truncate: true;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  display: block;
  font-size: .6875rem;
  color: var(--c-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-logout {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sb-text);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.sidebar-user-logout:hover { background: rgba(255, 255, 255, .1); color: #f87171; }
.sidebar-user-logout svg { width: 16px; height: 16px; }

/* ── Contenido principal ──────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sb-w);
  flex: 1;
  padding: 1.5rem;
  min-width: 0;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
}

.main-content>.page-footer { margin-top: auto; padding-top: .75rem; }

/* Botón hamburguesa */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: .55rem;
  left: .55rem;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: white;
  border-radius: var(--radius);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  box-shadow: var(--shadow);
  opacity: 0.85;
}

.sidebar-toggle img { width: 30px; }

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #8f8f8f;
  transition: transform var(--transition), opacity var(--transition);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 99;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CABECERA DE PÁGINA
   ═══════════════════════════════════════════════════════════════════════════ */
.page-header { margin-bottom: 1.5rem; }
.page-header div { display: flex; column-gap: 1rem; padding-bottom: 1rem; align-items: baseline; }
.page-header .btn { margin-left: auto; }
.page-title { font-size: 1.375rem; font-weight: 700; color: var(--c-text); }
.page-subtitle { font-size: .875rem; color: var(--c-text-2); margin: .25rem; }
.page-subtitle2 { font-size: .7rem; color: var(--c-text-2); margin: .25rem; }

/* «?» junto al título: enlace a la guía de la pantalla (Engine::ayuda, config/ayuda.php). */
.page-title__ayuda {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: .5rem;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--c-brand);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background var(--transition);
}
.page-title__ayuda:hover { background: var(--c-brand-dark); color: #fff; }
body.vista-simple .page-title__ayuda { display: none; }

.section-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: .875rem;
}

@media(max-width:480px) {
  .page-header div { display: block; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TARJETAS DE ESTADÍSTICAS
   ═══════════════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card__icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .25rem;
}

.stat-card__icon svg { width: 22px; height: 22px; }
.stat-card__icon--corazonexpres { color: var(--c-brand-dark); }
.stat-card__body { display: flex; flex-direction: column; gap: .125rem; }
.stat-card__value { font-size: 1.875rem; font-weight: 700; line-height: 1; color: var(--c-text); }
.stat-card__label { font-size: .8125rem; color: var(--c-text-2); }

@media(max-width:767px) {
  .stat-card__icon { display: none; }
}

@media(max-width:480px) {
  .stat-card { padding: 0.5rem; flex-direction: row; }
  .stat-card__icon { display: none; }
  .stat-card__body { flex-direction: row; align-items: baseline; gap: 0.5rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCIONES RÁPIDAS
   ═══════════════════════════════════════════════════════════════════════════ */
/* Fila de botones .btn de una línea, entre los avisos y las estadísticas del panel. */
.quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.75rem;
}

.quick-grid .btn { margin: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMULARIOS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1rem; }

/* Estilos del sistema: aplican con la clase explícita (.form-label/.form-input/...) y
   también a los elementos directos dentro de .form-group sin clase (para templates
   antiguos del portal que ahora usan .form-group y heredan estilo automáticamente). */
.form-label, .form-group>label { font-size: .875rem; font-weight: 500; color: var(--c-text-4); }
.form-label--req::after { content: ' *'; color: var(--c-danger); font-weight: 400; }

.form-input,
.form-select,
.form-textarea,
.form-group>input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]),
.form-group>select,
.form-group>textarea,
.form-group .pin-wrap>input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--c-border-dk);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: .9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.form-group>input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):focus,
.form-group>select:focus,
.form-group>textarea:focus,
.form-group .pin-wrap>input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .15);
}

.form-input::placeholder,
.form-group>input::placeholder,
.form-group>textarea::placeholder,
.form-group .pin-wrap>input::placeholder {
  color: var(--c-text-4);
}

.form-textarea, .form-group>textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: .8125rem; color: var(--c-text-2); }
.form-error { font-size: .8125rem; color: var(--c-danger); }

/* Marca de "campo obligatorio" en línea: <label>… <span class="req">*</span></label> */
.req { color: var(--c-danger); margin-left: 2px; font-weight: 600; }

/* Marca de "campo opcional" en línea: <label>… <span class="opt">(opcional)</span></label> */
.opt { font-weight: 400; color: var(--c-text-3); font-size: .75rem; margin-left: 4px; }

/* Estado de error del grupo de formulario: borde rojo y fondo suave en el control.
   Cubre tanto la clase explícita (.form-input/.form-select/.form-textarea) como los
   elementos directos sin clase dentro de .form-group. */
.form-group--invalid .form-input,
.form-group--invalid .form-select,
.form-group--invalid .form-textarea,
.form-group--invalid>input,
.form-group--invalid>select,
.form-group--invalid>textarea,
.form-group--invalid .pin-wrap>input {
  border-color: var(--c-danger);
  background: #fff8f8;
}

.form-group--invalid .form-input:focus,
.form-group--invalid .form-select:focus,
.form-group--invalid .form-textarea:focus,
.form-group--invalid>input:focus,
.form-group--invalid>select:focus,
.form-group--invalid>textarea:focus,
.form-group--invalid .pin-wrap>input:focus {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .1);
}

/* Input con addon (botón dentro) */
.input-group { position: relative; display: flex; }
.input-group .form-input { padding-right: 2.5rem; }

.input-addon {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-4);
  padding: .25rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-addon:hover { color: var(--c-text-2); background: var(--c-bg); }

/* ── Select custom arrow ─── */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.25rem;
}

/* ── Teléfono con prefijo internacional ───
   Parcial partials/_telefono.php: <select> de prefijo + <input> del número, en la
   misma línea dentro de un .form-group. El prefijo tiene ancho fijo porque los
   nombres largos ("Emiratos Árabes Unidos +971") no deben empujar al número. */
.tel-field { display: flex; gap: .375rem; align-items: stretch; }
.tel-field__prefijo { flex: 0 0 auto; width: 10rem; }
.tel-field__numero { flex: 1 1 auto; min-width: 0; }

@media (max-width: 480px) {
  .tel-field { flex-wrap: wrap; }
  .tel-field__prefijo { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTONES
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5rem 1rem;
  font-size: .9375rem;
  font-weight: 500;
  margin: 0.25rem;
  border-radius: var(--radius);
  transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--estado-actual:disabled { opacity: 1; cursor: default; }
.btn--estado { font-weight: 600; }
.btn--estado:hover { box-shadow: var(--shadow); }
.btn--estado-activo { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.btn--estado-activo:hover { background: #bbf7d0; }
.btn--estado-inactivo { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.btn--estado-inactivo:hover { background: #e2e8f0; }
.btn--estado-pendiente { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn--estado-pendiente:hover { background: #fde68a; }
.btn--estado-baja { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.btn--estado-baja:hover { background: #fecaca; }

/* Estados de entrega. Mismos colores que sus .badge-- para que el botón y la etiqueta
   de estado de una entrega se lean como lo mismo. */
.btn--estado-entregada { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.btn--estado-entregada:hover { background: #bfdbfe; }
.btn--estado-ausente { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.btn--estado-ausente:hover { background: #fed7aa; }

/* El estado actual, en negativo: el color de la letra pasa al fondo y el del fondo a
   la letra. Van después de los :hover para que pasar el ratón no lo deshaga. */
.btn--estado-activo.btn--estado-actual { background: #15803d; color: #dcfce7; border-color: #15803d; }
.btn--estado-inactivo.btn--estado-actual { background: #475569; color: #f1f5f9; border-color: #475569; }
.btn--estado-pendiente.btn--estado-actual { background: #92400e; color: #fef3c7; border-color: #92400e; }
.btn--estado-baja.btn--estado-actual { background: #b91c1c; color: #fee2e2; border-color: #b91c1c; }
.btn--estado-entregada.btn--estado-actual { background: #1d4ed8; color: #dbeafe; border-color: #1d4ed8; }
.btn--estado-ausente.btn--estado-actual { background: #c2410c; color: #ffedd5; border-color: #c2410c; }

/* Cuadro de estado de una ayuda (partials/_estado_solicitud.php): se pinta con los
   mismos colores que el botón de ese estado, justo aquí encima. */
.estado-card {
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.estado-card--pendiente { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.estado-card--activo { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.estado-card--baja { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.estado-card--entregada { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.estado-card--ausente { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.estado-card--inactivo { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* Título y estado actual toman el color del cuadro, no el suyo. */
.estado-card .detail-card__title { color: inherit; }
.estado-card__actual { margin: 0; font-size: .8125rem; font-weight: 600; }

/* Dentro del cuadro, los estados que no son el actual son solo texto en su color, sin
   fondo ni borde; el fondo claro de su :hover sigue diciendo que se pueden pulsar. */
.estado-card .btn--estado:not(.btn--estado-actual):not(:hover) { background: transparent; border-color: transparent; }

.is-disabled-by-main-form {
  opacity: .45;
  pointer-events: none;
  transition: opacity var(--transition);
}

.is-disabled-by-main-form a { pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn--sm { padding: .375rem .75rem; font-size: .8125rem; }
.btn--full { width: 100%; }
.btn--primary { background: var(--c-brand-dark); color: #fff; border-color: var(--c-brand-dark); }
.btn--primary:hover { background: var(--c-brand); box-shadow: var(--shadow); }

.btn--secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border-dk);
}

.btn--secondary:hover { background: var(--c-bg); box-shadow: var(--shadow); }
.btn--danger { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn--danger:hover { background: #991b1b; }

.btn--ghost {
  background: var(--c-brand-light);
  color: var(--c-text-3);
  border-color: transparent;
}

.btn--ghost:hover { background: var(--sb-bg_rose); color: var(--c-brand-dark); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLAS
   ═══════════════════════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: auto;
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--c-bg); }

th {
  padding: .625rem .875rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-text-2);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--c-border);
}

td {
  padding: .625rem .875rem;
  font-size: .875rem;
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0, 0, 0, .018); }

/* Cabecera, scroll y fila vacía de tabla (los usa Varios › Cartelas: templates/varios/cartelas.php) */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.table-title { font-size: .9375rem; font-weight: 600; }
.table-scroll { overflow-x: auto; }
.table-empty { text-align: center; padding: 2.5rem; color: var(--c-text-2); font-size: .9375rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .1875rem .625rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  border-radius: 999px;
  white-space: nowrap;
}

.badge--green { background: #dcfce7; color: #15803d; }
.badge--red { background: #fee2e2; color: #b91c1c; }
.badge--orange { background: #ffedd5; color: #c2410c; }
.badge--yellow { background: #fef3c7; color: #92400e; }
.badge--blue { background: #dbeafe; color: #1d4ed8; }
.badge--gray { background: #f1f5f9; color: #475569; }
.badge--purple { background: #f3e8ff; color: #7e22ce; }

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS GENÉRICAS
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MENSAJES FLASH / ALERTAS (misma estructura, dos nombres de clase)
   ═══════════════════════════════════════════════════════════════════════════ */
.flash,
.alert {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.flash { justify-content: space-between; }
.flash--success, .alert--success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }

.flash--error,
.alert--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
  display: block;
}

.flash--warning, .alert--warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash--info, .alert--info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.flash-close { color: inherit; opacity: .6; font-size: 1.125rem; line-height: 1; padding: .125rem; }
.flash-close:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   PAGINACIÓN
   ═══════════════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════════════════ */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  padding: 1rem;
}

/* Tarjeta centrada en el hueco libre y, si hay pie configurable, el pie abajo del todo. */
.login-container { width: 100%; max-width: 400px; margin-block: auto; }
.login-page>.page-footer { margin: 0; padding: 1.5rem 0 0; border-top: 0; color: #94a3b8; }

.login-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-title { font-size: 1.375rem; font-weight: 700; color: var(--c-text); }
.login-subtitle { font-size: .875rem; color: var(--c-text-2); margin-top: .25rem; }
.login-form { display: flex; flex-direction: column; gap: .25rem; }
.login-form .btn--primary { margin-top: .25rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.97) translateY(8px);
  transition: transform .2s;
}

.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
}

.modal-title { font-size: 1rem; font-weight: 600; }

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-2);
  border-radius: var(--radius);
  font-size: 1.25rem;
}

.modal-close:hover { background: var(--c-bg); color: var(--c-text); }
.modal-body { padding: 1.25rem; }

.modal-footer {
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}
.modal-footer--centro { justify-content: center; align-items: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILIDADES
   ═══════════════════════════════════════════════════════════════════════════ */
.flex { display: flex; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--c-text-2); }
.text-danger { color: var(--c-danger); }
.text-small { font-size: 0.7em; }
.mb-4 { margin-bottom: 1rem; }

/* Grid de 2 columnas para formularios */
/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media(max-width:1023px) {
  .sidebar { transform: translateX(calc(-1 * var(--sb-w))); }
  .sidebar-open .sidebar { transform: translateX(0); z-index: 200; }
  .sidebar-open .sidebar-overlay { display: block; }
  .main-content { margin-left: 0; padding: 1rem; }
  .sidebar-toggle { display: flex; }
  .main-content { padding-top: 4rem; }
}

@media(max-width:767px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-toolbar { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 1.25rem; }
}

@media(max-width:480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 1.5rem; }
  .main-content { padding: .75rem; padding-top: 3.5rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTROS (barra de búsqueda + filtros en listados)
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-input {
  padding: .5rem .75rem;
  border: 1px solid var(--c-border-dk);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: .875rem;
  min-width: 220px;
  flex: 1;
}

.filter-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .15);
}

/* Un día: su ancho, sin estirarse como la búsqueda. */
.filter-input--fecha { flex: none; min-width: 0; }

.filter-select {
  padding: .5rem .75rem;
  border: 1px solid var(--c-border-dk);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: .875rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .625rem center;
  padding-right: 2rem;
}

.filter-select:focus { outline: none; border-color: var(--c-primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLA — extensiones para listados de datos
   ═══════════════════════════════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr { background: var(--c-bg); }

.data-table th,
.data-table td {
  padding: .625rem .875rem;
  font-size: .875rem;
  vertical-align: middle;
  text-align: left;
}

/* Separador entre filas en el BORDE SUPERIOR de cada celda del cuerpo (no el inferior):
   así la línea que hay encima de una fila la controla esa misma fila, y la de notas la
   cambia con su propio border-top. Hay que anular el border-bottom de la regla global
   `td`: en border-collapse, un sólido de la fila de arriba le ganaría a un dashed. */
.data-table td { border-top: 1px solid var(--c-border); border-bottom: none; }

.data-table th {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-text-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--c-border);
}

.data-table tbody tr:hover { background: rgba(0, 0, 0, .018); }

/* Fila clicable: <tr data-href> abre la ficha desde cualquier punto (ver app.js) */
.data-table tbody tr[data-href] { cursor: pointer; }
.data-table tbody tr[data-href]:hover { background: rgba(0, 0, 0, .045); }
.th-actions, .td-actions { text-align: right; white-space: nowrap; }
.table-link { color: var(--c-primary); font-weight: 500; }
.table-link:hover { text-decoration: underline; }
.btn--xs { padding: .25rem .5rem; font-size: .75rem; border-radius: var(--radius); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--c-text-2); }
.empty-state p { font-size: .9375rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   PAGINADOR
   ═══════════════════════════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .875rem 1rem;
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 .5rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: var(--c-text-2);
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition);
}

.pagination__item:hover { background: var(--c-bg); color: var(--c-text); }
.pagination__item--active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }

/* Hueco «…» entre saltos de página. No es pulsable: mismo alto que los números
   pero sin fondo ni hover, para que no se confunda con uno. */
.pagination__gap {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 .25rem;
  font-size: .875rem;
  color: var(--c-text-4);
}

.pagination__info { font-size: .8125rem; color: var(--c-text-2); padding: .5rem 1rem; }

/* Pie del listado: selector de nº de líneas + texto "Mostrando…", centrado. */
.list-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .5rem 1rem;
}

.list-footer .per-page {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--c-text-2);
}

.list-footer .per-page .filter-select { padding: .25rem 1.75rem .25rem .5rem; font-size: .8125rem; }
.list-footer .pagination__info { padding: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   DETALLE (ficha de socio / beneficiario)
   ═══════════════════════════════════════════════════════════════════════════ */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  overflow: auto;
}

.detail-card--full { grid-column: 1 / -1; }

.detail-card__title {
  font-size: .875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-2);
  margin-bottom: .875rem;
}

/* Título de tarjeta con una etiqueta a la derecha, en su misma línea. La etiqueta
   escapa del uppercase y del espaciado del título, que son cosa del rótulo. */
.detail-card__title--etiqueta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.detail-card__title--etiqueta .badge { text-transform: none; letter-spacing: .02em; }

/* Marca de «primera ayuda de este beneficiario». Mismo rojo que sus filas en el
   listado; las mayúsculas las hereda del título. */
.marca-primera-vez { color: var(--c-danger); font-weight: 700; font-size: .75rem; }
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: .375rem 1rem; }

.detail-list dt {
  font-size: .75rem;
  font-weight: 500;
  color: var(--c-text-4);
  white-space: nowrap;
  padding: .125rem 0;
  text-wrap: auto;
}

.detail-list dd {
  font-size: .875rem;
  color: var(--c-text);
  padding: .125rem 0;
  word-break: break-word;
}

.notes-text { font-size: .875rem; color: var(--c-text); line-height: 1.6; white-space: pre-wrap; }

.detail-card-warning {
  background-color: var(--c-brand-bg);
  border: 1px solid var(--c-brand-bg);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  overflow: auto;
}

.detail-card-warning .notes-text { color: var(--sb-active); }
.detail-card-warning .detail-card__title { color: var(--sb-active); }

.detail-card-success {
  background-color: var(--c-success-bg);
  border: 1px solid #86efac;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  overflow: auto;
}

.detail-card-success .notes-text,
.detail-card-success .detail-card__title {
  color: var(--c-success);
}

/* Variante morada de .detail-card-warning: distingue las notas de la ENTREGA de las
   notas de la SOLICITUD, que van en la de tono de marca. Colores de .badge--purple. */
.detail-card-purple {
  background-color: #f3e8ff;
  border: 1px solid #f3e8ff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  overflow: auto;
}

.detail-card-purple .notes-text, .detail-card-purple .detail-card__title { color: #7e22ce; }

/* ═══════════════════════════════════════════════════════════════════════════
   ZONA DE PELIGRO (dar de baja)
   ═══════════════════════════════════════════════════════════════════════════ */
.danger-zone {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
}

.danger-zone__title {
  font-size: .875rem;
  font-weight: 600;
  color: #b91c1c;
  margin-bottom: .375rem;
}

.danger-zone__desc { font-size: .8125rem; color: #7f1d1d; margin-bottom: .875rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMULARIOS — tarjeta y secciones
   ═══════════════════════════════════════════════════════════════════════════ */
.form-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-section { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--c-border); }
.form-section:last-of-type { border-bottom: none; }

.form-section__title {
  font-size: .875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-3);
  margin-bottom: 1rem;
  background-color: #00000014;
  padding: 3px 10px;
  border-radius: 20px;
}

.form-section-warning { background-color: var(--c-brand-bg); }
.form-section-success { background-color: var(--c-success-bg); }
.form-section-purple { background-color: #f3e8ff; }
.form-row { display: grid; gap: 0 1rem; }
.form-row--2 { grid-template-columns: 1fr 1fr; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }

@media(max-width:640px) {
  .form-row--2, .form-row--3 { grid-template-columns: 1fr; }
}

/* Miembros del hogar (miembros-familia.js): cada miembro ocupa UNA fila con sus
   tres campos, también en móvil. Con .form-row--3 el móvil los apilaba y no se
   distinguía dónde acababa un miembro y empezaba el siguiente; de ahí también la
   línea separadora y el título de cada fila. */
.mf-row { border-top: 1px solid var(--c-border); padding-top: .75rem; margin-top: .75rem; }
.mf-row:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.mf-row__title {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: .35rem;
}

.mf-row__fields { display: grid; grid-template-columns: .85fr 1fr 1.3fr; gap: 0 .5rem; }

/* Etiquetas a una sola línea: si envuelven, los controles de cada columna dejan
   de alinearse entre sí. */
.mf-row__fields .form-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* En pantallas estrechas se aprieta el control (no la fila): así "16 o más" y
   "Masc." siguen cabiendo sin recortarse. */
@media(max-width:520px) {
  .mf-row__fields { gap: 0 .4rem; }
  .mf-row__fields .form-label { font-size: .8125rem; }

  .mf-row__fields .form-select,
  .mf-row__fields .form-input {
    padding-left: .5rem;
    padding-right: .4rem;
    font-size: .8125rem;
  }
}

.form-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.5rem;
  background: var(--c-bg);
  border-top: 1px solid var(--c-border);
}

.required { color: var(--c-danger); font-weight: 400; }

/* Leyenda "* Campos necesarios" alineada a la derecha en la barra de acciones */
.form-req-legend { margin-left: auto; color: var(--c-text-muted); font-size: .8125rem; }

/* Campo obligatorio (con asterisco) que está vacío: borde rojo para llamar la atención.
   Usa !important porque el borde base se aplica con un selector de mayor especificidad
   (.form-group > input:not(...)) que ganaría a esta clase de estado. */
.form-input.input-req-empty,
.form-select.input-req-empty,
.form-group>.input-req-empty {
  border-color: var(--c-danger-form) !important;
  box-shadow: 0 0 0 1px var(--c-danger-form);
}

.btn-group { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-left: auto; }

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--c-text-2);
  cursor: pointer;
  white-space: nowrap;
}

.filter-checkbox input { width: 15px; height: 15px; cursor: pointer; }
.row--warning { background-color: var(--sb-bg_rose); }
.file-upload { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.file-upload input[type="file"] { position: absolute; opacity: 0; pointer-events: none; }
.file-name { font-size: .875rem; color: var(--c-brand-dark); }

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR PERSONALIZADA (navegadores WebKit)
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   PORTAL PÚBLICO (socios / beneficiarios)
   ═══════════════════════════════════════════════════════════════════════════ */
/* Título de bienvenida de los portales de socio y trabajador/a social */
.portal-welcome { margin: 2.5rem; font-size: 2.5rem; text-align: center; color: #333; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.portal-back-link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--c-text-3);
  text-decoration: none;
  margin-bottom: 1rem;
}

.portal-back-link:hover { color: var(--c-brand); }

.portal-back-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

.portal-header {
  background: var(--c-brand-dark);
  color: #fff;
  padding: .875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.portal-header__brand {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: #fff;
}

.portal-header__brand svg { width: 1.3rem; height: 1.3rem; fill: currentColor; }

.portal-header__nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .875rem;
  flex-wrap: wrap;
}

.portal-header__nav a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.portal-header__nav a:hover { color: #fff; text-decoration: underline; }
.portal-header__user { font-size: 1.5rem; color: rgba(255, 255, 255, 1); font-weight: bold; }

@media(max-width:640px) {
  .portal-header__user { font-size: 1rem; }
}

/* ── Contenedor principal y card ─────────────────────────────────────────── */
.portal-main { max-width: 820px; margin: 2rem auto; padding: 0 1rem 3rem; }

.portal-card {
  background: var(--c-surface);
  /*border: 1px solid var(--c-border);*/
  border-radius: var(--radius);
  font-size: small;
  padding: 1rem;
}

/* Mensaje personal del staff al beneficiario: encima de los botones, tono verde. Crece con el texto. */
.portal-card--personal {
  /*background: var(--c-success-bg);
  border-color: #86efac;*/
  padding: 1.25rem 0;
  margin-bottom: .25rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Aviso global para todos los beneficiarios: debajo de los botones. Crece con el texto. */
.portal-aviso {
  color: var(--c-primary);
  font-style: italic;
  margin-top: 1.5rem;
  padding: 1rem;
  overflow-wrap: anywhere;
}

/* ── Stat-card: aliases de nombres usados en portal (val/lbl vs value/label) */
/* ── Tabla y páginas dentro del portal ───────────────────────────────────── */
.portal-main .page-title { margin-bottom: .25rem; }
.portal-main .page-subtitle { margin-bottom: 1.5rem; }

.portal-main .section-title {
  font-size: .8rem;
  text-transform: uppercase;
  color: var(--c-text-2);
  font-weight: 600;
  letter-spacing: .05em;
  margin: 1.5rem 0 .75rem;
}

/* ── Adaptaciones para tablas heredadas del portal ───────────────────────── */
.portal-main .data-table th, .portal-main .data-table td { padding: .625rem .75rem; }

/* ── Cabecera: nombre y expediente en dos líneas ─────────────────────────── */
.portal-header__meta { display: flex; flex-direction: column; line-height: 1.2; }
.portal-header__exp { font-size: .8125rem; color: rgba(255, 255, 255, .85); }

/* ── Menú de secciones (botones .btn: activo en rojo, resto en blanco) ───── */
.portal-menu {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: 1.25rem;
  justify-content: center;
}

.portal-menu__item {
  color: var(--c-brand);
  margin: 0;
  /* .btn trae margen propio; aquí separa el gap */
}

.portal-menu__item--active,
.portal-menu__item--active:hover {
  background: var(--c-brand);
  border-color: var(--c-brand);
  color: #fff;
}

/* ── Chat embebido en el portal ──────────────────────────────────────────── */
/* .chat-widget vuelve a declararse más abajo (max-height/margin): hace falta
   la especificidad doble para que estas reglas ganen. */
.chat-widget.chat-widget--portal {
  max-width: 100%;
  max-height: none;
  margin: 0;
  /* Integrado en la página: conserva el redondeo, pero sin marco ni sombra. */
  border: 0;
  box-shadow: none;
}

/* Página del chat: alto exacto de la ventana y sin scroll propio, de modo que
   la cabecera, el menú y la fila de escribir quedan siempre a la vista y solo
   se desplaza la lista de mensajes. */
/* Anclada al área visible: el JS de la página le da alto y desplazamiento con
   visualViewport, porque con el teclado abierto el móvil mueve esa ventana y
   el pie del chat se salía por abajo. 100svh es solo el respaldo inicial. */
.portal-chat-page {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 100vh;
  height: 100svh;
  /* body trae min-height:100vh y en Android eso son ~56px más que la ventana
     visible: sin anularlo, el alto que fija el JS no puede reducir la página y
     la fila de escribir se queda fuera de pantalla. */
  min-height: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.portal-chat-page .portal-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

/* Avisos y mensajes del equipo: si son largos, se desplazan ellos en vez de
   comerse el chat. */
.portal-chat-page .portal-chat-avisos { flex: 0 1 auto; overflow-y: auto; max-height: 40%; }
.portal-chat-page .chat-widget.chat-widget--portal { flex: 1; height: auto; min-height: 0; }
.portal-chat-page .chat-widget--portal .chat-messages { min-height: 0; }

/* La cabecera de marca se repliega en cuanto se desplazan los mensajes o se
   escribe, y vuelve al subir del todo: en el móvil ese alto es la diferencia
   entre ver dos mensajes o cuatro. */
.portal-chat-page .portal-header {
  overflow: hidden;
  max-height: 200px;
  transition: max-height .2s ease, padding .2s ease;
}

.portal-chat-page.portal-chat-page--compacta .portal-header {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* En móvil la cabecera y el menú se comprimen para dejarle el alto al chat. */
@media(max-width:640px) {
  .portal-header { padding: .5rem .75rem; gap: .5rem; }
  .portal-header__brand img { height: 30px; }

  .portal-header__nav {
    flex-wrap: nowrap;
    /* si envuelve, el botón de salir cae a otra línea */
    gap: .5rem;
    min-width: 0;
  }

  .portal-header__meta { min-width: 0; }
  .portal-header__user { font-size: .9375rem; }
  .portal-header__exp { font-size: .75rem; }
  .portal-main { margin: 1rem auto; padding: 0 .75rem 1rem; }
  .portal-menu { gap: .3rem; margin-bottom: .75rem; }
  .portal-menu__item { padding: .3rem .7rem; font-size: .8125rem; }

  /* Margen lateral mínimo: lo justo para que se vea el redondeo del chat. */
  .portal-chat-page .portal-main { margin-top: .5rem; padding-left: .25rem; padding-right: .25rem; }
  .portal-chat-page .portal-menu { margin-bottom: .5rem; }
}

/* ── Pie de página ───────────────────────────────────────────────────────── */
.page-footer {
  margin-top: 2rem;
  padding: .75rem 0;
  font-size: .7rem;
  color: var(--c-text-4);
  border-top: 1px solid var(--c-border);
  text-align: center;
}

.page-footer a { color: inherit; }
.page-footer--portal { padding: 1rem; max-width: 820px; margin-inline: auto; }
/* Comodín [Aviso Legal] (ComodinesTexto): subrayado, porque el reset global quita el de los enlaces. */
.enlace-aviso-legal { text-decoration: underline; text-underline-offset: 2px; }
/* Texto de protección de datos. */
.legal-texto { font-size: .9375rem; line-height: 1.6; }
.legal-texto h3 { font-size: 1rem; margin: 1.5rem 0 .5rem; }
.legal-texto ul { padding-left: 1.25rem; }
.legal-texto li { margin-bottom: .375rem; }
.legal-tabla { width: 100%; border-collapse: collapse; font-size: .875rem; margin: .5rem 0 1rem; }
.legal-tabla th, .legal-tabla td { border: 1px solid var(--c-border, #e5e7eb); padding: .5rem .625rem; text-align: left; vertical-align: top; }
.legal-tabla th { background: var(--c-bg-subtle, #f9fafb); }
.legal-capa { font-size: .8125rem; line-height: 1.5; color: var(--c-text-muted, #6b7280); margin: .5rem 0; }
.legal-capa a { color: inherit; text-decoration: underline; }
/* Enlace para que la persona titular confirme (partials/_confirmacion_titular): QR y botones */
.confirmacion-enlace { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin: .75rem 0; }
.confirmacion-enlace__qr { flex: none; width: 176px; padding: 8px; background: #fff; border: 1px solid var(--c-border); border-radius: 6px; }
.confirmacion-enlace__qr svg { display: block; width: 100%; height: auto; }
.confirmacion-enlace__acciones { flex: 1 1 220px; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.confirmacion-enlace__acciones p { margin: 0; }
.confirmacion-enlace__botones { display: flex; flex-wrap: wrap; gap: .5rem; }
/* Email con el que entrará al portal, en grande para que lo apunte (portal/beneficiarios/confirmada) */
/* Qué datos tenemos, en la página del enlace de confirmación */
.confirmacion-datos { list-style: disc; padding-left: 1.25rem; margin: .25rem 0 .5rem; }
.confirmacion-datos li { margin-bottom: .25rem; }
.confirmacion-email { margin: .5rem 0 1rem; padding: .75rem 1rem; font-size: 1.2rem; font-weight: 700; word-break: break-all; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 6px; }

/* ── Chat ────────────────────────────────────────────────────────────────── */
.chat-widget {
  background: var(--sb-bg, #fff);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  position: relative;
  max-height: 100vh;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  background: var(--c-brand);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  font-size: .9rem;
}

.chat-header__title { flex: 1; }
.chat-attach-btn { cursor: pointer; opacity: .85; display: flex; align-items: center; }
.chat-attach-btn:hover { opacity: 1; }
/* Campana de avisos push (misma base que el clip) */
.chat-push-btn { background: none; border: 0; color: inherit; padding: 0; margin-right: .5rem; } /* delante del título */
.chat-push-btn--off { opacity: .45; }
/* Activada: blanco pleno y campana rellena, para que se distinga de apagada */
.chat-push-btn--on { opacity: 1; }
.chat-push-btn--on svg { fill: currentColor; }
.chat-push-btn--blocked { opacity: .3; cursor: not-allowed; }
.chat-widget > .alert { margin: .5rem .75rem 0; }
/* El atributo hidden debe ganar a cualquier display: de la clase */
[hidden] { display: none !important; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  background: #E1E1E1;
  min-height: 200px;
}

.chat-bubble-wrap { display: flex; flex-direction: column; max-width: 75%; }
.chat-bubble-wrap--out { align-self: flex-end; align-items: flex-end; }
.chat-bubble-wrap--in { align-self: flex-start; align-items: flex-start; }

.chat-bubble {
  padding: .45rem .75rem;
  border-radius: 15px;
  font-size: .88rem;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-bubble--out { background: #FFFFFF; border-bottom-right-radius: 2px; }
.chat-bubble--in { background: #fff; border-bottom-left-radius: 2px; }

.chat-bubble--deleted {
  color: var(--c-text-4);
  font-style: italic;
  background: rgba(0, 0, 0, .05) !important;
}

.chat-bubble__sender { font-size: .5rem; font-weight: 600; color: #999; margin-bottom: 2px; }

.chat-bubble__meta {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .6rem;
  color: #999;
  margin-top: 2px;
  justify-content: flex-end;
}

.chat-bubble__meta--in { justify-content: flex-start; }
.chat-ticks { display: inline-flex; gap: 0; }
.chat-ticks svg { width: 14px; height: 14px; }
.chat-ticks--grey { color: #92a0a0; }
.chat-ticks--blue { color: #4fc3f7; }

.chat-bubble__img {
  max-width: 220px;
  max-height: 200px;
  border-radius: 4px;
  display: block;
  cursor: pointer;
}

.chat-bubble__doc {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: rgba(0, 0, 0, .06);
  border-radius: 4px;
  padding: .35rem .5rem;
  font-size: .83rem;
  color: inherit;
  text-decoration: none;
}

.chat-bubble__doc:hover { background: rgba(0, 0, 0, .12); }
.chat-bubble__actions { display: none; gap: .25rem; margin-top: .2rem; }
.chat-bubble-wrap:hover .chat-bubble__actions { display: flex; }

.chat-bubble__action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .7rem;
  color: var(--c-text-4);
  padding: 0 .2rem;
}

.chat-bubble__action-btn:hover { color: var(--c-danger); }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  background: var(--sb-bg);
  border-top: 1px solid var(--c-border);
  border-radius: 0 0 var(--radius) var(--radius);
}

.chat-input {
  flex: 1;
  border: none;
  border-radius: 20px;
  padding: .45rem .85rem;
  font-size: .9rem;
  resize: none;
  background: #fff;
  max-height: 120px;
  overflow-y: auto;
  outline: none;
  line-height: 1.4;
}

.chat-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.5rem .1rem;
  color: #666;
}

.chat-send-btn {
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-file-preview {
  padding: .3rem .75rem;
  background: #e8f5e9;
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-top: 1px solid var(--c-border);
}

.chat-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #c62828;
}

.chat-emoji-picker {
  position: absolute;
  bottom: 70px;
  left: 8px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: .5rem;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.chat-emoji-picker button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: .15rem;
  border-radius: 4px;
}

.chat-emoji-picker button:hover { background: #f5f5f5; }

.chat-date-divider {
  text-align: center;
  font-size: .72rem;
  color: #888;
  background: rgba(255, 255, 255, .7);
  border-radius: 8px;
  padding: .15rem .6rem;
  align-self: center;
  margin: .4rem 0;
}

.chat-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.chat-lightbox.open { display: flex; }
.chat-lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 4px; }

.chat-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
}

/* Chat unread dot in beneficiarios list */
.chat-unread {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: .35rem;
  vertical-align: middle;
}

.chat-unread--red { background: #ef4444; }
.chat-unread--orange { background: #f97316; }

/* ════════════════════════════════════════════════════════════════════════════
   Vista simple (tabla sin chrome)
   ════════════════════════════════════════════════════════════════════════════ */
body.vista-simple { background: transparent !important; }

body.vista-simple .sidebar,
body.vista-simple .sidebar-toggle,
body.vista-simple .sidebar-overlay {
  display: none !important;
}

body.vista-simple .main-content { margin-left: 0; padding: 1rem; }

body.vista-simple .app-layout .main-content {
  margin-left: 0 !important;
  padding: 1.5rem !important;
}

body.vista-simple .page-header,
body.vista-simple .filter-bar,
body.vista-simple .col-toggles-bar,
body.vista-simple .pagination,
body.vista-simple .pagination__info,
body.vista-simple .stats-row,
body.vista-simple .flash {
  display: none !important;
}

/* La columna de acciones no se muestra NUNCA en la vista limpia: sus botones no
   sirven de nada en una tabla pensada para leer, copiar o imprimir. Va aquí y no
   en el selector de columnas para que valga aunque esté marcada como visible. */
body.vista-simple .th-actions, body.vista-simple .td-actions { display: none !important; }

body.vista-simple .table-wrap {
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  /* Sin scroll horizontal: la tabla se desborda libremente para que al imprimir
     el navegador la maneje (ajuste / partido por páginas) sin recortar lo no visible. */
  overflow: visible !important;
}

body.vista-simple, body.vista-simple .main-content { overflow-x: visible !important; }

/* Imprimir y Volver de toda vista limpia (layout base): sin menú ni cabecera, y anclada
   a inicio sin barra del navegador, es la única salida. En la ficha se ven aunque esa
   vista esconda los botones; en el papel nunca. */
.vista-limpia-barra { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
body.vista-ficha .vista-limpia-barra .btn { display: inline-flex !important; }
@media print { .vista-limpia-barra { display: none !important; } }

/* ── Vista limpia de una ficha (?vista=ficha) ──────────────────────────────────
   Vale para la ficha del beneficiario y para las de solicitud y entrega. Hereda todo
   lo de `vista-simple` (sin menú, sin fondos) y encima recupera la cabecera —el nombre
   y el expediente hacen falta en el papel— y esconde lo que no se imprime: botones,
   el cuadro de cambio de estado, notas internas, mensaje del portal, adjuntos y modales. */
body.vista-ficha .page-header { display: block !important; }

body.vista-ficha .btn,
body.vista-ficha .btn-group,
body.vista-ficha .ficha-toolbar,
body.vista-ficha .estado-card,
body.vista-ficha .detail-card-warning,
body.vista-ficha .detail-card-purple,
body.vista-ficha .detail-card-success,
body.vista-ficha #adjuntos,
body.vista-ficha .modal-backdrop {
  display: none !important;
}

body.vista-ficha .detail-card {
  box-shadow: none !important;
  background: transparent !important;
  break-inside: avoid;
}

/* A4 vertical con márgenes de impresora doméstica; las tarjetas a dos columnas
   entran de sobra y la tabla de ayudas no se parte por la mitad. */
@page { size: A4 portrait; margin: 12mm; }

@media print {
  body.vista-ficha .bv-cards>.detail-card { flex: 1 1 45%; }
  body.vista-ficha .data-table { font-size: .75rem; }
  body.vista-ficha tr, body.vista-ficha .detail-list { break-inside: avoid; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Columnas ordenables
   ════════════════════════════════════════════════════════════════════════════ */
.th-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sortable::after { color: var(--c-brand); }

/*content: ' ⇅';opacity: .35; font-size: .75em; */
.th-sortable.sort-asc::after { content: ' ↑'; opacity: 1; }
.th-sortable.sort-desc::after { content: ' ↓'; opacity: 1; }
.th-sortable.sort-desc, .th-sortable.sort-asc { color: var(--c-text) !important; }

/* ════════════════════════════════════════════════════════════════════════════
   Toggles de columnas + botón vista simple
   ════════════════════════════════════════════════════════════════════════════ */
/* Barra propia del botón de vista limpia en una ficha: su línea, a la derecha, con la
   misma separación que la barra de columnas de los listados. En solicitudes y entregas
   comparte la línea con el cuadro de estado, que se queda con todo el ancho restante. */
.ficha-toolbar { display: flex; justify-content: flex-end; align-items: flex-start; gap: .5rem; margin-bottom: .75rem; }
.ficha-toolbar>.estado-card { flex: 1; min-width: 0; margin-bottom: 0; }

.col-toggles-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.col-toggles-label {
  font-size: .6875rem;
  font-weight: 600;
  color: var(--c-text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

#col-toggles { display: flex; flex-wrap: wrap; gap: .3rem; }

/* Memorias del listado: al final de la barra, junto al botón de vista limpia (o a
   .col-vistas, que lo agrupa con los recibos de Entregas). Las memorias crecen hasta
   llenar su línea con los botones a la derecha, así que no dejan hueco con el de vista
   limpia; y si este baja solo a otra línea, su margen automático lo pega a la derecha. */
.col-toggles-bar>#btn-vista-simple, .col-toggles-bar>.col-vistas { margin-left: auto; }
.col-vistas { display: flex; gap: .5rem; }
.col-memorias { display: flex; flex-wrap: wrap; flex-grow: 1; justify-content: flex-end; gap: .3rem; }
.col-memorias .btn { margin: 0; }

.col-toggle {
  font-size: .6875rem;
  font-weight: 500;
  padding: .2rem .55rem;
  border-radius: 15px;
  cursor: pointer;
  border: none;
  background: none;
  line-height: 1.5;
  transition: color .12s, background .12s, border-color .12s, box-shadow .12s;
}

/* Botón con el tamaño de un selector de columnas, conservando su color. */
.btn--mini { padding: .2rem .55rem; font-size: .6875rem; line-height: 1.5; border-radius: 15px; }

.col-toggle--on {
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

.col-toggle--off { border: 1px solid transparent; color: var(--c-text-3); }
.col-toggle--off:hover { color: var(--c-text); }

/* ── Ayudas: primera vez y etiquetas «Especial» ─────────────────────────────── */
/* La primera ayuda de un beneficiario se lee de un vistazo en el listado. */
.fila-primera-vez td { font-weight: 700; color: var(--c-danger); }
.fila-primera-vez td .text-muted { color: var(--c-danger); opacity: .75; }

/* Notas internas a todo el ancho bajo la fila del listado (Solicitudes y Entregas):
   continuación de su fila, no un registro aparte. Fondo el de la fila (sin banda) y
   separadas de sus datos por una línea discontinua tenue (el separador normal entre filas
   va en el borde superior, ver .data-table td). No fija color ni peso: hereda el de la
   fila, así comparte el rojo de «primera vez» (y cualquier estilo futuro de la fila), que
   se copia a esta <tr>. Columna conmutable sin cabecera (data-col-td). */
.fila-notas td { border-top: 1px dashed #eee; padding: .3rem .875rem .5rem 2rem; font-size: .8125rem; white-space: normal; }
.fila-notas strong { font-weight: 600; }

/* Etiquetas sin fondo, una por línea: se leen en pantalla y en papel. */
.especial-tag { color: var(--c-danger); font-size: .75rem; font-weight: 600; white-space: nowrap; }

/* Casillas de «Especial» en los formularios de beneficiario y de ayuda. */
.especiales-check { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }

.especiales-check label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .875rem;
  cursor: pointer;
}

/* ── Productos del recibo de ayuda (F-01) ─────────────────────────────────────
   Las tres columnas del papel con sus colores; Alimentos va en tres subcolumnas. */
.productos-recibo {
  display: grid;
  grid-template-columns: 3fr 1.1fr 1fr;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--c-surface);
}

.productos-recibo__seccion + .productos-recibo__seccion { border-left: 1px solid var(--c-border); }

.productos-recibo__titulo {
  margin: 0;
  padding: .4rem .75rem;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.productos-recibo__seccion--alimentos .productos-recibo__titulo { background: var(--c-brand); }
.productos-recibo__seccion--higiene .productos-recibo__titulo { background: #1f8a5b; }
.productos-recibo__seccion--bebes .productos-recibo__titulo { background: #2f6db3; }

.productos-recibo__lista { list-style: none; margin: 0; padding: 0; }
.productos-recibo__seccion--alimentos .productos-recibo__columnas { display: grid; grid-template-columns: repeat(3, 1fr); }

.productos-recibo__item {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-height: 2.1rem;
  padding: .25rem .75rem;
  border-bottom: 1px solid var(--c-separator);
  font-size: .875rem;
  break-inside: avoid;
}

.productos-recibo__item.is-atenuado { opacity: .35; }
.productos-recibo__item--retirado span { font-style: italic; }

.productos-recibo__casilla { display: inline-flex; align-items: center; gap: .4rem; min-width: 0; cursor: pointer; }

.productos-recibo__detalle { width: 5.5rem; min-width: 0; padding: .1rem .4rem; font-size: .8125rem; }

/* Casilla de solo lectura (fichas): el mismo cuadrado que en el papel. */
.productos-recibo__caja {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--c-text-2);
  border-radius: 3px;
  font-size: .75rem;
  line-height: 1;
}

.productos-recibo__caja.is-marcada { background: var(--c-text); border-color: var(--c-text); color: #fff; }
.productos-recibo__caja.is-marcada::after { content: '✓'; }

/* Lote primera vez y Lote parcial, una línea fina y las etiquetas «Especial», encima de la rejilla. */
.marcas-recibo { display: flex; flex-wrap: wrap; gap: .5rem 0; margin-bottom: .75rem; font-size: .875rem; }
.marcas-recibo__grupo { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; }
.marcas-recibo__grupo + .marcas-recibo__grupo { margin-left: 1.5rem; padding-left: 1.5rem; border-left: 1px solid var(--c-border); }
.marcas-recibo label { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.marcas-recibo__ayuda { display: block; margin: -.25rem 0 .75rem; }

/* «Añadir producto» de la Tabla de productos: debajo de cada sección y a la derecha. */
.productos-recibo__pie { display: flex; justify-content: flex-end; margin-top: .5rem; }

/* «Añadido / Retirado» encima de las notas de entrega: se lee, no se edita. */
.registro-productos {
  margin-bottom: .75rem;
  padding: .5rem .75rem;
  background: rgba(255, 255, 255, .65);
  border-radius: var(--radius-lg);
  font-size: .875rem;
}

.registro-productos__titulo { margin: 0 0 .25rem; font-size: .75rem; font-weight: 600; color: var(--c-text-2); }
.registro-productos__lista { margin: 0; padding-left: 1.1rem; }

/* ── Programar la entrega: horario de reparto en el modal ───────────────────
   Una fila por hora y una casilla por hueco, sin rótulo. Las ocupadas, bloqueadas. */
.horario-huecos { border-top: 1px solid var(--c-separator); }

.horario-fila {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--c-separator);
}

.horario-fila__hora { width: 3.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.horario-fila__hueco { width: 1.15rem; height: 1.15rem; cursor: pointer; }
.horario-fila__hueco:disabled { cursor: not-allowed; opacity: .55; }

/* Campo «Entrega programada» de la edición: el texto y su botón en una línea. */
.programar-campo { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-height: 2.5rem; }
.programar-campo__texto { font-weight: 600; }

/* Modal con un solo campo o dos botones. */
.modal--estrecho { max-width: 420px; }

/* Pantalla «Tabla de productos»: tabla compacta con las marcas centradas. */
.catalogo-productos th,
.catalogo-productos td { padding: .3rem .5rem; }
.catalogo-productos .form-input { min-width: 10rem; padding: .3rem .5rem; }
.catalogo-productos .catalogo-productos__pista { min-width: 6rem; width: 7rem; }
.catalogo-productos .catalogo-productos__marca { text-align: center; }
.catalogo-productos__orden { white-space: nowrap; }

@media (max-width: 900px) {
  .productos-recibo { grid-template-columns: 1fr 1fr; }
  .productos-recibo__seccion--alimentos { grid-column: 1 / -1; }
  .productos-recibo__seccion--alimentos .productos-recibo__columnas { grid-template-columns: repeat(2, 1fr); }
  .productos-recibo__seccion--alimentos + .productos-recibo__seccion { border-left: 0; }
  .productos-recibo__seccion--alimentos ~ .productos-recibo__seccion { border-top: 1px solid var(--c-border); }
}

@media (max-width: 560px) {
  .productos-recibo { grid-template-columns: 1fr; }
  .productos-recibo__seccion + .productos-recibo__seccion { border-left: 0; }
  .productos-recibo__seccion--alimentos .productos-recibo__columnas { grid-template-columns: 1fr; }
}

.btn--icon-only {
  padding: .35rem .45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ════════════════════════════════════════════════════════════════════════════
   Botones de columnas + botón vista simple
   ════════════════════════════════════════════════════════════════════════════ */
.btn-contacto {
  background: none;
  border: 2px solid #FCE6E6;
  border-radius: var(--radius-lg);
  padding: .4rem .4rem;
  margin: -.4rem 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
  color: inherit;
  text-decoration: none;
}

.btn-contacto:hover { border: 2px solid #FF9F9F; }
/* Botón «Contactar» de las fichas, bajo los datos de la persona. */
.ficha-contactar { margin-top: .75rem; }
.contact-actions { display: flex; flex-direction: column; gap: .5rem; }

.contact-action {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s;
  color: var(--c-text);
  border: 1.5px solid var(--c-border);
}

.contact-action:hover { background: var(--c-bg); }

.contact-action__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-action__icon svg { width: 18px; height: 18px; fill: none; stroke-width: 2; stroke: #fff; }
.contact-action--tel .contact-action__icon { background: #16a34a; }
.contact-action--wa .contact-action__icon { background: #25D366; }
.contact-action--mail .contact-action__icon { background: #2563eb; }
.contact-action--chat .contact-action__icon { background: var(--c-brand); }
.contact-action__info { display: flex; flex-direction: column; }
.contact-action__label { font-size: .75rem; color: var(--c-text-3); line-height: 1.2; }
.contact-action__value { font-size: .9rem; font-weight: 600; line-height: 1.3; }
body.vista-simple .btn-contacto { border: none; }

/* ════════════════════════════════════════════════════════════════════════════
   Eventos del panel (dashboard)
   ════════════════════════════════════════════════════════════════════════════ */
.ep-list { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1rem; }

.ep-banner {
  display: flex;
  align-items: center;
  gap: .625rem;
  border-radius: 16px;
  padding: .45rem .75rem .45rem .85rem;
  border-left-width: 5px;
  border-left-style: solid;
  border-right-width: 5px;
  border-right-style: solid;
  font-size: .8125rem;
  line-height: 1.4;
  position: relative;
  cursor: pointer;
  transition: filter .1s;
  box-shadow: var(--shadow-md);
}

.ep-banner:hover { filter: brightness(.97); }
.ep-banner--yellow { background: #fefce8; border-color: #f59e0b; }
.ep-banner--red { background: #fff1f2; border-color: #ef4444; }
.ep-banner--orange { background: #fff7ed; border-color: #f97316; }
.ep-banner--green { background: #f0fdf4; border-color: #22c55e; }
.ep-banner--blue { background: #eff6ff; border-color: #3b82f6; }
.ep-banner--purple { background: #faf5ff; border-color: #a855f7; }
.ep-banner--teal { background: #f0fdfa; border-color: #14b8a6; }
.ep-banner--gray { background: #f9fafb; border-color: #9ca3af; }
.ep-banner__icon { flex-shrink: 0; width: 16px; height: 16px; color: rgba(0, 0, 0, .46); }
.ep-banner__texto { flex: 1; color: var(--c-text); }

.ep-banner__fecha {
  flex-shrink: 0;
  font-size: .6875rem;
  color: var(--c-text-3);
  white-space: nowrap;
}

.ep-banner__close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .08);
  color: var(--c-text-3);
  cursor: pointer;
  border: none;
  padding: 0;
  margin-left: .25rem;
  transition: background .12s, color .12s;
}

.ep-banner__close:hover { background: rgba(220, 0, 0, .15); color: #ef4444; }

.ep-banner__close svg {
  width: 10px;
  height: 10px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   Beneficiario — tarjetas en vista ver
   ════════════════════════════════════════════════════════════════════════════ */
.bv-cards { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.bv-cards>.detail-card { flex: 1 1 260px; min-width: 0; }

/* ════════════════════════════════════════════════════════════════════════════
   Reportes
   ════════════════════════════════════════════════════════════════════════════ */
.report-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.report-section__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--c-border);
}

.stat-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  min-width: 120px;
}

.stat-mini__val { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }

.stat-mini__lbl {
  font-size: .7rem;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-top: .25rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   Ayuda — cards de índice
   ════════════════════════════════════════════════════════════════════════════ */
.ayuda-grid, .ayuda-resultados { display: flex; flex-direction: column; gap: .5rem; max-width: 780px; }

.ayuda-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}

.ayuda-card:hover { border-color: var(--c-primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

.ayuda-card__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--c-bg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-primary);
}

.ayuda-card__body { flex: 1; min-width: 0; }

.ayuda-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: .25rem;
}

.ayuda-card__excerpt {
  font-size: .875rem;
  color: var(--c-text-2);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ayuda-card__arrow {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: var(--c-text-3);
  transition: color .15s, transform .15s;
}

.ayuda-card:hover .ayuda-card__arrow { color: var(--c-primary); transform: translateX(3px); }

@media (max-width: 500px) {
  .ayuda-card { padding: 1rem; gap: 1rem; }
  .ayuda-card__icon { width: 40px; height: 40px; }
  .ayuda-card__excerpt { display: none; }
}

/* Buscador del Centro de ayuda (public/assets/js/ayuda-buscador.js): los resultados son
   .ayuda-card en .ayuda-resultados (no en otra .ayuda-grid, que es la lista que señala el
   vídeo «Qué es Coradmin»); al abrir uno, lo buscado sale resaltado unos segundos en la guía. */
.ayuda-buscador { max-width: 780px; }
.ayuda-resultados__resumen { font-size: .875rem; color: var(--c-text-3); }
.ayuda-resultado__guia {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--c-text-3);
  margin-bottom: .25rem;
}
.ayuda-resultado__padre { font-weight: 400; color: var(--c-text-3); }
.ayuda-resultado__extracto { font-size: .875rem; color: var(--c-text); line-height: 1.5; }
.ayuda-resultado mark, mark.doc-resaltado { background: #fde68a; color: inherit; border-radius: 2px; }
mark.doc-resaltado { transition: background-color 1.5s; }
mark.doc-resaltado--fuera { background-color: transparent; }

/* ════════════════════════════════════════════════════════════════════════════
   Documentación — ver artículo
   ════════════════════════════════════════════════════════════════════════════ */
.doc-body {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 4rem;
  line-height: 1.7;
  color: var(--c-text);
}

.doc-body h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--c-border);
}

.doc-body h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 2.25rem 0 .75rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--c-border);
}

.doc-body h3 { font-size: 1.1rem; font-weight: 600; margin: 1.75rem 0 .5rem; }

.doc-body h4 {
  font-size: .95rem;
  font-weight: 600;
  margin: 1.5rem 0 .4rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--c-text-muted);
}

.doc-body h1:first-child { margin-top: .5rem; }

/* Logo centrado sobre cada guía: ~1/4 del ancho del texto y una línea de separación inferior */
.doc-body .doc-logo { display: block; width: 33%; height: auto; margin: .5rem auto 2rem; border: none; border-radius: 0; box-shadow: none; }
.doc-body .doc-logo+h1 { margin-top: 0; }

/* Imágenes en el cuerpo de la guía: nunca se desbordan del ancho del texto */
.doc-body img { max-width: 100%; height: auto; border: 1px solid var(--c-border); border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.doc-body p { margin: .75rem 0; }
.doc-body ul, .doc-body ol { margin: .75rem 0 .75rem 1.5rem; }
/* El reset de arriba quita viñetas y números a todas las listas; en las guías hacen falta (los pasos remiten a los números de las capturas) */
.doc-body ul { list-style: disc; }
.doc-body ol { list-style: decimal; }
.doc-body li { margin: .3rem 0; }
.doc-body strong { font-weight: 600; }
.doc-body em { font-style: italic; }

/* Etiquetas de permisos al final de un apartado de las guías (línea íntegra en cursiva con '#'): gris medio y algo más pequeñas. */
.doc-body p em:only-child { color: var(--c-text-muted); font-size: .85rem; }
.doc-body a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 2px; }
.doc-body a:hover { opacity: .8; }
.doc-body hr { border: none; border-top: 1px solid var(--c-border); margin: 2rem 0; }

.doc-body blockquote {
  margin: 1rem 0;
  padding: .3rem 0;
  color: var(--c-brand-dark);
  font-style: italic;
}

.doc-body code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
  font-size: .875em;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: .15em .4em;
  color: #d63384;
}

.doc-body pre {
  background: #1e1e2e;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.55;
}

.doc-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #cdd6f4;
  font-size: .85rem;
}

.doc-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }

.doc-body th {
  background: var(--c-bg);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  padding: .6rem .85rem;
  border: 1px solid var(--c-border);
  text-align: left;
}

.doc-body td { padding: .55rem .85rem; border: 1px solid var(--c-border); vertical-align: top; }
.doc-body tr:nth-child(even) td { background: var(--c-bg); }
.doc-body tr:hover td { background: #f0f4ff; }
.doc-layout { display: grid; grid-template-columns: 1fr 220px; gap: 2rem; align-items: start; }

.doc-toc {
  position: sticky;
  top: 1.5rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: .8rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.doc-toc__title {
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  margin-bottom: .5rem;
}

.doc-toc a {
  display: block;
  color: #64748b;
  text-decoration: none;
  padding: .2rem 0;
  line-height: 1.4;
  transition: color .15s;
}

.doc-toc a:hover { color: var(--c-primary); }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { position: static; }
}

.doc-breadcrumb {
  font-size: .8rem;
  color: var(--c-text-muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.doc-breadcrumb a:not(.btn) { color: var(--c-text-muted); text-decoration: none; }
.doc-breadcrumb a:not(.btn):hover { color: var(--c-primary); }

/* Botón "Vista impresión" (empujado a la derecha de la miga de pan). */
.doc-breadcrumb .doc-print-link { margin-left: auto; white-space: nowrap; text-decoration: none; }

/* Vista imprimible de las guías: sin índice, miga de pan ni pie; a todo el ancho.
   El menú lateral ya lo oculta la clase .vista-simple del layout base. */
body.vista-simple:has(.doc-body) .page-footer { display: none !important; }
body.vista-simple .doc-body--print { max-width: 900px; margin: 0 auto; }

/* Vídeo de un apartado de la guía ([texto](video:nombre) en el Markdown; lo pinta
   VideosGuia::boton): centrado bajo el título, abre /video/… en otra pestaña. El mismo
   botón vale fuera de las guías ($e->video(), p. ej. en el Centro de ayuda).
   .doc-body a subraya y agrisa los enlaces: aquí se devuelve el aspecto de botón. */
.doc-video { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .25rem; margin: 1rem 0 1.25rem; }
.doc-video .btn { text-decoration: none; }
.doc-video .btn--primary { color: #fff; white-space: normal; }
.doc-video .btn--primary:hover { opacity: 1; }
.doc-video__duracion { font-size: .8125rem; font-weight: 400; opacity: .75; }

/* En el índice lateral, el apartado con vídeo lleva al lado el símbolo de reproducir. */
.doc-toc__fila { display: flex; align-items: flex-start; gap: .35rem; }
.doc-toc__fila a:first-child { flex: 1; }
.doc-toc a.doc-toc__video { flex: none; padding-top: .3rem; margin-top: 2px; }
.doc-toc__video svg { display: block; width: 13px; height: 13px; }

/* Página pública de un vídeo (/video/{nombre}-{clave}, templates/docs/video.php): el vídeo
   ocupa toda la ventana. El botón grande, si el navegador no deja empezar solo, va por
   debajo del centro para no tapar la tarjeta del título de la portada. */
body.video-pagina { min-height: 0; background: #000; overflow: hidden; }
.video-pagina__video { display: block; width: 100vw; height: 100vh; height: 100dvh; object-fit: contain; background: #000; }
.video-pagina__play { position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; width: clamp(3.5rem, 11vmin, 5.5rem); height: clamp(3.5rem, 11vmin, 5.5rem); border-radius: 50%; background: var(--c-brand); color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.4); transition: transform var(--transition), background var(--transition); }
.video-pagina__play[hidden] { display: none; }
.video-pagina__play:hover { background: var(--c-brand-dark); transform: translateX(-50%) scale(1.06); }
.video-pagina__play svg { width: 45%; height: 45%; margin-left: 6%; }

@media print {
  .doc-video { display: none !important; }
  body.vista-simple .main-content { margin: 0 !important; padding: 0 !important; }
  body.vista-simple .doc-body--print { max-width: none; }
}

/* ── Wizard layout ─────────────────────────────────────────────────────────── */
.reg-wrap { max-width: 640px; margin: 2rem auto; padding: 0 0 4rem; }

/* Progress */
.reg-progress { display: flex; align-items: center; margin-bottom: 2rem; gap: 0; }

.reg-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  cursor: default;
}

.reg-step__circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-3);
  font-size: .8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: all .25s;
}

.reg-step__label {
  font-size: .7rem;
  font-weight: 500;
  color: var(--c-text-3);
  margin-top: .35rem;
  text-align: center;
  white-space: nowrap;
}

.reg-step--active .reg-step__circle {
  border-color: var(--c-brand);
  background: var(--c-brand);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(214, 0, 11, .12);
}

.reg-step--active .reg-step__label { color: var(--c-brand); font-weight: 600; }

.reg-step--done .reg-step__circle {
  border-color: var(--c-success);
  background: var(--c-success);
  color: #fff;
}

.reg-step--done .reg-step__label { color: var(--c-success); }

.reg-step-line {
  flex: 1;
  height: 2px;
  background: var(--c-border);
  margin: 1.4rem 0.5rem;
  transition: background .25s;
}

.reg-step-line--done { background: var(--c-success); }

/* Cards de cada paso */
.reg-card {
  background: var(--c-surface);
  border-radius: 14px;
  box-shadow: 0 2px 24px rgba(0, 0, 0, .07), 0 1px 4px rgba(0, 0, 0, .04);
  overflow: hidden;
  display: none;
}

.reg-card.active { display: block; }

.reg-card__header {
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--c-separator);
  display: flex;
  align-items: center;
  gap: .875rem;
}

.reg-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--c-brand-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.reg-card__icon svg { width: 20px; height: 20px; stroke: var(--c-brand); }
.reg-card__title { font-size: 1rem; font-weight: 700; color: var(--c-text); }
.reg-card__subtitle { font-size: .8rem; color: var(--c-text-3); margin-top: .1rem; }
.reg-card__body { padding: 1.75rem 2rem; }

/* Inputs flotantes */
/* Consent */
.consent-box {
  background: #fafbfc;
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  gap: .875rem;
  align-items: flex-start;
  cursor: pointer;
  transition: border-color .18s;
}

.consent-box:has(input:checked) { border-color: var(--c-success); background: #f0fdf4; }
.consent-box.consent--invalid { border-color: var(--c-danger-form); background: #fff8f8; }

.consent-box input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--c-success);
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.consent-box span { font-size: .8375rem; color: var(--c-text-2); line-height: 1.55; }

/* PIN display */
.pin-wrap { position: relative; }
.pin-wrap input { padding-right: 2.75rem; letter-spacing: .15em; }

.pin-toggle {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--c-text-3);
  line-height: 1;
}

.pin-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Strength indicator */
.pin-strength { margin-top: .4rem; display: flex; gap: 3px; }

.pin-strength__bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--c-border);
  transition: background .2s;
}

/* Nav buttons */
.reg-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem 1.5rem;
  border-top: 1px solid var(--c-separator);
  gap: 1rem;
}

.btn-next,
.btn-back,
.btn-submit {
  padding: .7rem 1.75rem;
  border-radius: 8px;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.btn-next, .btn-submit { background: var(--c-brand); color: #fff; }

.btn-next:hover,
.btn-submit:hover {
  background: #b0000a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(214, 0, 11, .25);
}

.btn-back { background: transparent; color: var(--c-text-2); border: 1.5px solid var(--c-border); }
.btn-back:hover { background: #f8fafc; }

.btn-back svg,
.btn-next svg,
.btn-submit svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

/* Primer paso: sin botón "Atrás", el único botón se mantiene a la derecha. */
.reg-nav .btn-next:only-child { margin-left: auto; }

/* Contador de paso */
.step-counter {
  font-size: .8rem;
  color: var(--c-text-3);
  font-weight: 500;
  margin: auto;
  display: block;
  text-align: center;
  margin-bottom: 1rem;
}

/* Pie de la tarjeta: nota de campos obligatorios (izq.) + contador de paso (der.) */
.reg-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0 2rem 1rem;
  font-size: .8rem;
  color: var(--c-text-3);
}

.reg-foot .step-counter { margin: 0; text-align: right; }

/* Flashes */
.reg-flash {
  border-radius: 10px;
  padding: .875rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: .625rem;
}

.reg-flash--error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.reg-flash--success { background: #f0fdf4; border: 1px solid #86efac; color: #14532d; }

/* Login link */
.reg-footer { text-align: center; margin-top: 1.25rem; font-size: .875rem; color: var(--c-text-2); }
.reg-footer a { color: var(--c-brand); font-weight: 500; text-decoration: underline; }

/* Responsive */
@media (max-width: 520px) {
  .form-row--2, .form-row--3 { grid-template-columns: 1fr; }

  .reg-card__body,
  .reg-nav,
  .reg-card__header,
  .reg-foot {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .reg-step__label { display: none; }
  .form-row { gap: 0; }
}

/* ── Mi área — datos grid ───────────────────────────────────────────────────── */
.mis-datos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: .75rem;
}

.mis-datos-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.mis-datos-card__head { display: flex; align-items: center; gap: .625rem; margin-bottom: .875rem; }

.mis-datos-card__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--c-brand-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mis-datos-card__icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--c-brand);
  fill: none;
  stroke-width: 2;
}

.mis-datos-card__title { font-size: .8125rem; font-weight: 700; color: var(--c-text); }
.mis-datos-dl { margin: 0; }

.mis-datos-dl dt {
  font-size: .5rem;
  font-weight: 600;
  color: var(--c-text-4);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: .6rem;
}

.mis-datos-dl dt:first-child { margin-top: 0; }

.mis-datos-dl dd {
  margin: .15rem 0 0 0;
  font-size: .875rem;
  color: var(--c-text);
  word-break: break-word;
}

.mis-datos-dl dd.empty { color: var(--c-text-3); font-style: italic; }

/* ── Chat widget en el portal ───────────────────────────────────────────────── */
.chat-widget { max-height: 65vh; margin: auto; }

/* ── Foto de socio — circular ───────────────────────────────────────────────── */
.socio-foto {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--c-border);
}

.socio-foto-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.25rem;
}

.socio-foto-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--c-bg);
  border: 3px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
}

.socio-foto-placeholder svg { width: 40px; height: 40px; }

/* ── Donación info card ──────────────────────────────────────────────────────── */
.donacion-info-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
}

.donacion-info-card__title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--c-text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .75rem;
}

.donacion-info-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: .04em;
  word-break: break-all;
}

.donacion-copy-btn {
  background: none;
  border: 1.5px solid var(--c-border);
  border-radius: 6px;
  padding: .3rem .65rem;
  font-size: .75rem;
  cursor: pointer;
  color: var(--c-text-2);
  margin-left: .75rem;
  transition: background .15s;
  vertical-align: middle;
}

.donacion-copy-btn:hover { background: var(--c-bg); }

/* ── Page wrappers ──────────────────────────────────────────────────────────── */
.portal-page { max-width: 420px; margin: 2rem auto; }
.portal-page--wide { max-width: 540px; margin: 2rem auto; }

/* ════════════════════════════════════════════════════════════════════════════
   Cartelas 66 × 39 mm: hoja A4 para imprimir (templates/varios/cartelas_imprimir.php)
   El @page sin márgenes está en la propia plantilla: aquí valdría para todo el panel.
   ════════════════════════════════════════════════════════════════════════════ */
.cartelas-toolbar { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; margin: 1.25rem; }

.cartelas-hoja {
  --mc-l: 3mm;      /* marcas de corte: largo, grosor y color */
  --mc-a: .2mm;
  --mc-c: #aaa;
  --mc-colortexto: #3f3f3f;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 8mm;
  background: white;
  display: grid;
  grid-template-columns: repeat(3, 66mm);
  grid-auto-rows: 39mm;
  justify-content: center;
  align-content: start;
}

.cartela {
  width: 66mm;
  height: 39mm;
  position: relative;
  padding: 2mm 4mm 4mm 4mm;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  page-break-inside: avoid;
}

.cartela::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--mc-c), var(--mc-c)) left top / var(--mc-l) var(--mc-a) no-repeat,
    linear-gradient(var(--mc-c), var(--mc-c)) left top / var(--mc-a) var(--mc-l) no-repeat,
    linear-gradient(var(--mc-c), var(--mc-c)) right top / var(--mc-l) var(--mc-a) no-repeat,
    linear-gradient(var(--mc-c), var(--mc-c)) right top / var(--mc-a) var(--mc-l) no-repeat,
    linear-gradient(var(--mc-c), var(--mc-c)) left bottom / var(--mc-l) var(--mc-a) no-repeat,
    linear-gradient(var(--mc-c), var(--mc-c)) left bottom / var(--mc-a) var(--mc-l) no-repeat,
    linear-gradient(var(--mc-c), var(--mc-c)) right bottom / var(--mc-l) var(--mc-a) no-repeat,
    linear-gradient(var(--mc-c), var(--mc-c)) right bottom / var(--mc-a) var(--mc-l) no-repeat;
  opacity: .45;
}

.cartela__logo { width: 35mm; margin: 1mm auto; }

.cartela__titulo {
  font-family: 'Merienda', cursive;
  color: var(--mc-colortexto);
  font-size: 13pt;
  font-weight: 700;
  line-height: 1.15;
  margin: 2mm;
}

.cartela__texto {
  color: var(--mc-colortexto);
  font-size: 11pt;
  line-height: 1.15;
  font-style: italic;
  overflow-wrap: anywhere;
}

@media print {
  body:has(.cartelas-hoja) { background: white; }
  .cartelas-toolbar { display: none; }
  .cartelas-hoja { margin: 0; }
}

/* Varios › Formularios papel: miniatura de la primera hoja */
.miniatura-form { display: block; width: 75px; height: auto; border: 1px solid var(--c-border); box-shadow: var(--shadow-md); }

/* ════════════════════════════════════════════════════════════════════════════
   Recibo de ayuda (F-01) impreso: /entregas/{id}?vista=ficha
   Una hoja A4 con el diseño del PDF de papel; medidas en mm y pt, como el papel.
   Los colores se imprimen aunque el navegador no imprima fondos (print-color-adjust).
   ════════════════════════════════════════════════════════════════════════════ */
.recibo-pagina { background: #e5e5e5; }
.recibo-toolbar { display: flex; justify-content: center; gap: .5rem; padding: 1rem; }

.recibo {
  --recibo-tinta: #3f3f3f;
  --recibo-gris: #707070;
  --recibo-linea: #8c8c8c;
  --recibo-suave: #e2e2e2;
  --recibo-fila: 7.4mm;
  display: flex;
  flex-direction: column;
  width: 210mm;
  height: 297mm;
  margin: 0 auto 2rem;
  padding: 10mm 12mm 8mm;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-lg);
  color: var(--recibo-tinta);
  font-family: 'Lato', Arial, sans-serif;
  font-size: 8.2pt;
  line-height: 1.25;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Los recibos del listado (?vista=recibos): cada uno en su hoja. */
.recibo + .recibo { break-before: page; }

.recibo__cabecera { display: flex; justify-content: space-between; align-items: flex-start; }
.recibo__logo { width: 48mm; height: auto; margin-top: 1mm; }
.recibo__titulos { text-align: right; }
.recibo__titulo { margin-top: 1mm; font-size: 21pt; font-weight: 900; line-height: 1.1; color: var(--recibo-tinta); }

/* Casilla del papel. La marca es un trazo, no un fondo: sale siempre al imprimir. */
.recibo__caja {
  position: relative;
  display: inline-block;
  flex: none;
  width: 3.6mm;
  height: 3.6mm;
  margin-right: 2.2mm;
  border: .3mm solid var(--recibo-tinta);
  border-radius: .8mm;
  vertical-align: -.8mm;
}

.recibo__caja.is-marcada::after {
  content: '';
  position: absolute;
  left: 1.05mm;
  top: .15mm;
  width: .95mm;
  height: 2.05mm;
  border: solid #000;
  border-width: 0 .55mm .55mm 0;
  transform: rotate(45deg);
}

/* Campos: el rótulo arriba y el dato sobre la línea, como en el papel. */
.recibo__fila { display: grid; gap: 0 6mm; margin-top: 4.5mm; }
.recibo__fila--datos { grid-template-columns: 1.5fr 1fr; }
.recibo__fila--fecha { grid-template-columns: 42mm 1fr; }
.recibo__fila--cantidades { grid-template-columns: 1fr 1fr 1fr 1.1fr; }
.recibo__campo { display: flex; flex-direction: column; min-width: 0; }
.recibo__rotulo { font-size: 6.4pt; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--recibo-gris); }

.recibo__valor {
  display: flex;
  align-items: flex-end;
  min-height: 8mm;
  padding-bottom: .8mm;
  border-bottom: .3mm solid var(--recibo-linea);
  font-size: 10pt;
  overflow: hidden;
  white-space: nowrap;
}

.recibo__valor--nombre { font-size: 13pt; font-weight: 700; color: #000; }

/* Marcas que tiene la ayuda, solo las marcadas, justo encima de la tabla. */
.recibo__marcas { display: flex; flex-wrap: wrap; margin-top: 5.5mm; font-size: 9pt; font-weight: 700; color: #000; }
.recibo__marcas span + span { margin-left: 4mm; padding-left: 4mm; border-left: .3mm solid var(--recibo-linea); }
.recibo__marcas + .recibo__tabla { margin-top: 2.5mm; }

.recibo__fecha span { display: inline-block; min-width: 7mm; text-align: center; }
.recibo__fecha i { margin: 0 1mm; font-style: normal; font-weight: 300; font-size: 11pt; color: #a8a8a8; }

.recibo__total { padding: 1.5mm 2.5mm 0; background: #fdeced; border-radius: 1mm 1mm 0 0; }
.recibo__total .recibo__rotulo { color: #a50008; }
.recibo__total .recibo__valor { min-height: 6.5mm; border-bottom-color: var(--c-brand); font-weight: 900; }

/* Rejilla de productos: Alimentos en tres columnas, Higiene y Bebés. */
.recibo__tabla { width: 100%; margin-top: 5.5mm; border-collapse: collapse; table-layout: fixed; }
.recibo__tabla col { width: 19.4%; }
.recibo__tabla .recibo__col-higiene { width: 21.6%; }
.recibo__tabla .recibo__col-bebes { width: 20.2%; }

.recibo__tabla th.recibo__seccion {
  height: 6.7mm;
  padding: 0 0 0 2.5mm;
  border: 0;
  color: #fff;
  font-size: 7.2pt;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  vertical-align: middle;
}

.recibo__seccion--alimentos { background: var(--c-brand); }
.recibo__seccion--higiene { background: #1f8a5b; }
.recibo__seccion--bebes { background: #2f6db3; }

.recibo__tabla td {
  height: var(--recibo-fila);
  padding: 0 1.2mm 0 2.5mm;
  border: 0;
  border-bottom: .2mm solid var(--recibo-suave);
  border-left: .2mm solid var(--recibo-suave);
  color: var(--recibo-tinta);
  font-size: 8.2pt;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recibo__tabla td:first-child { border-left: 0; }
.recibo__tabla tbody tr:nth-child(even) td { background: #f7f7f7; }
.recibo__tabla tbody tr:last-child td { border-bottom: .3mm solid var(--recibo-linea); }
.recibo__hueco { display: inline-block; width: 11mm; border-bottom: .25mm solid var(--recibo-tinta); vertical-align: -.4mm; }

.recibo__firmas { display: flex; justify-content: flex-end; gap: 5mm; margin-top: 5mm; }
/* Ficha de Solicitudes: la descripción y las notas ocupan todo el espacio hasta el pie, rodeando el cuadro de firma; recibo-notas.js reduce la letra si no caben. */
.recibo__firmas--notas { display: block; flex: 1; min-height: 0; overflow: hidden; padding-bottom: 1.5mm; font-size: 8.2pt; line-height: 1.2; white-space: pre-line; }
.recibo__firmas--notas .recibo__firma { float: right; margin: 0 0 2mm 5mm; white-space: normal; }
.recibo__nota + .recibo__nota { margin-top: .8mm; }
.recibo__firma { width: 90mm; height: 27.5mm; padding: 2mm 3mm; border: .3mm solid #b8b8b8; border-radius: 1.6mm; }

/* Pie: QR y protección de datos, y debajo el teléfono y la web (ReciboAyuda::PIE) con la referencia. */
.recibo__pie { margin-top: auto; padding-top: 2.5mm; border-top: .3mm solid var(--recibo-suave); }
.recibo__privacidad { display: flex; align-items: flex-start; gap: 3.5mm; }
.recibo__qr { flex: none; width: 14mm; margin: 0; text-align: center; }
.recibo__qr img { display: block; width: 14mm; height: 14mm; }
.recibo__qr figcaption { margin-top: .8mm; font-size: 5.2pt; font-weight: 700; line-height: 1.15; letter-spacing: .05em; text-transform: uppercase; color: var(--recibo-gris); }
.recibo__privacidad p { font-size: 6.8pt; line-height: 1.38; text-align: justify; color: #5c5c5c; }
.recibo__direccion { display: flex; justify-content: space-between; gap: 4mm; margin-top: 3.5mm; font-size: 6.8pt; }
.recibo__direccion span { white-space: nowrap; color: var(--recibo-gris); }

@media print {
  .recibo-pagina { background: #fff; }
  .recibo-toolbar { display: none; }
  .recibo { margin: 0; box-shadow: none; }
}
