/* ============================================================
   Regina Caeli — Panel de administración
   CSS propio, sin dependencias. Tokens del canon visual:
   setting/SISTEMA-VISUAL-REGINA-CAELI.md
   ============================================================ */

@font-face { font-family: "Cinzel"; src: url("/fonts/Cinzel-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("/fonts/Cinzel-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  /* Color — canon §2 */
  --navy-900: #001c3d; --navy-800: #002a5c; --navy-700: #003d7b;
  --navy-600: #0a4f95; --navy-200: #c3d6ec; --navy-100: #e4edf7; --navy-50: #f2f7fc;
  --gold-700: #b07d00; --gold-600: #cf9405; --gold-500: #eeb311;
  --gold-300: #f9dc8a; --gold-100: #fef6e3;
  --red-600: #b50000; --red-500: #cd0000; --red-300: #e8736b; --red-100: #fbe5e3;
  --cream-100: #faf4e9; --cream-600: #c8a877;
  --ink-900: #16202e; --ink-700: #34404f; --ink-500: #5b6675;
  --ink-400: #8a93a0; --ink-300: #b8bec8; --ink-200: #dce0e6; --ink-100: #eef0f3;
  --paper: #ffffff; --bg: #f7f9fc;
  --success: #2f8f5b;
  /* Gradientes canónicos */
  --gradient-navy: linear-gradient(160deg, #0a4f95 0%, #003d7b 55%, #001c3d 100%);
  --gradient-gold: linear-gradient(160deg, #f4c648 0%, #eeb311 100%);
  /* Sombra navy + focus oro — canon §6 */
  --shadow-sm: 0 2px 8px rgba(0, 28, 61, 0.07);
  --shadow-md: 0 8px 24px rgba(0, 28, 61, 0.09);
  --focus-ring: 0 0 0 3px rgba(238, 179, 17, 0.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink-700);
  font-family: "Poppins", -apple-system, sans-serif; font-size: 15px; line-height: 1.55;
}
a { color: var(--navy-600); text-decoration: none; }

/* ---- Layout: sidebar navy + contenido ---- */
.layout { display: flex; min-height: 100vh; }
.icon {
  width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* La barra queda fija a la altura de la pantalla: el menú se desplaza por
   dentro y el pie (tu perfil) siempre se ve. */
.sidebar {
  width: 264px; flex-shrink: 0; background: var(--gradient-navy); color: #fff;
  display: flex; flex-direction: column; padding: 20px 14px 14px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; color: #fff; }
.sidebar .brand img { width: 34px; height: 34px; }
.sidebar .brand span {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 13px;
  letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.3;
}

.nav {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  margin: 0 -6px; padding: 0 6px 12px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.nav-top, .nav-group > summary {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--navy-200); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background 130ms, color 130ms;
}
.nav-group > summary { list-style: none; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-top:hover, .nav-group > summary:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-top.active { background: rgba(255, 255, 255, 0.13); color: #fff; }
.nav-group.current > summary { color: #fff; }
.nav-group > summary .nav-label { flex: 1; }
.nav-group > summary .chev { width: 16px; height: 16px; opacity: 0.6; transition: transform 200ms; }
.nav-group[open] > summary .chev { transform: rotate(180deg); }

.nav-items {
  display: flex; flex-direction: column; gap: 1px;
  margin: 2px 0 8px 21px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.14);
}
.nav-items a {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px;
  color: var(--navy-200); font-weight: 500; font-size: 13.5px;
  transition: background 130ms, color 130ms;
}
.nav-items a span:first-child { flex: 1; }
.nav-items a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-items a.active { background: rgba(255, 255, 255, 0.13); color: #fff; }
.nav-items a.active span:first-child::before {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold-500); margin: 0 8px 2px -2px; vertical-align: middle; /* el punto oro del canon */
}
.nav-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--gold-500); color: var(--navy-900);
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* Pie: tu perfil (abre «Mi cuenta») y salir. */
.sidebar .foot {
  display: flex; align-items: center; gap: 6px; padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar .foot .me {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 12px; color: #fff; transition: background 130ms;
}
.sidebar .foot .me:hover, .sidebar .foot .me.active { background: rgba(255, 255, 255, 0.1); }
.sidebar .foot .me .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sidebar .foot .me .who strong {
  font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .foot .me .who span { font-size: 11px; color: var(--navy-200); }
.sidebar .foot .icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: none; background: none;
  color: var(--navy-200); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar .foot .icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* Avatar: foto en círculo, o iniciales crema sobre navy (como en la app). */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy-700); color: var(--cream-100);
  font-weight: 600; font-size: 13px; letter-spacing: 0.02em;
}
.sidebar .foot .me .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3); }

.main { flex: 1; padding: 32px 40px; max-width: 1200px; min-width: 0; }
/* Las tablas anchas se desplazan de lado dentro de su tarjeta en vez de
   ensanchar la página (solo las tarjetas con tabla: los desplegables de los
   formularios no se recortan). */
.card:has(> table) { overflow-x: auto; }

/* ---- Tipografía canónica ---- */
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--gold-600); margin: 0 0 6px;
}
h1.title {
  font-family: "Cinzel", serif; font-weight: 600; font-size: 28px;
  letter-spacing: 0.075em; text-transform: uppercase; color: var(--navy-700);
  margin: 0 0 4px; line-height: 1.18;
}
.subtitle { color: var(--ink-500); margin: 0 0 28px; font-size: 14px; }

/* ---- Cards (canon §9.17): planas, sin borde ni sombra ---- */
.card { background: var(--paper); border-radius: 20px; padding: 24px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 28px; }

/* ---- Stat (canon §9.18) ---- */
.stat .label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-400); margin-bottom: 6px;
}
.stat .value {
  font-size: 36px; font-weight: 800; letter-spacing: -0.025em; line-height: 1;
  color: var(--ink-900); font-variant-numeric: tabular-nums;
}
.stat .hint { font-size: 11px; color: var(--ink-400); margin-top: 6px; }
.stat.featured { background: var(--gold-100); }

/* ---- Tabla ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 10px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-400); padding: 10px 12px;
  border-bottom: 1px solid var(--ink-200);
}
td { padding: 13px 12px; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--navy-50); }

/* ---- Badges (canon §9.9) ---- */
.badge {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
}
.badge.navy { background: var(--navy-100); color: var(--navy-700); }
.badge.gold { background: var(--gold-100); color: var(--gold-700); }
.badge.sacred { background: var(--red-100); color: var(--red-600); }
.badge.success { background: #e3f2ea; color: var(--success); }
.badge.neutral { background: var(--ink-100); color: var(--ink-700); }
.badge.cream { background: #f0e3cf; color: var(--cream-600); }

/* ---- Botones (canon §9.1) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform 130ms cubic-bezier(.4,0,.2,1), filter 130ms, background 130ms;
}
.btn:hover { filter: brightness(0.94); }
.btn:active { transform: scale(0.975); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.btn.primary { background: var(--navy-700); color: #fff; box-shadow: var(--shadow-sm); }
.btn.sacred { background: var(--gradient-gold); color: var(--navy-900); box-shadow: var(--shadow-sm); }
.btn.secondary { background: var(--paper); color: var(--navy-700); border: 1.5px solid var(--ink-300); }
.btn.danger { background: var(--red-500); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* Acciones de cada fila: discretas, a la derecha. El rojo pleno queda para
   la acción destructiva principal de una página, no para cada fila. */
td .actions-inline { justify-content: flex-end; }
td .btn.secondary { border-color: var(--ink-200); }
td .btn.secondary:hover { background: var(--navy-50); border-color: var(--navy-200); filter: none; }
td .btn.danger, .btn.danger.sm {
  background: transparent; color: var(--red-600); box-shadow: none;
  border: 1.5px solid rgba(181, 0, 0, 0.22);
}
td .btn.danger:hover, .btn.danger.sm:hover { background: var(--red-100); filter: none; }

/* ---- Formularios (canon §9.3) ---- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 500; color: var(--ink-700); margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  width: 100%; height: 48px; padding: 0 14px; font: inherit; font-size: 15px;
  color: var(--ink-900); background: var(--paper);
  border: 1.5px solid var(--ink-300); border-radius: 14px;
  transition: border-color 130ms, box-shadow 130ms;
}
.field textarea { height: auto; padding: 12px 14px; resize: vertical; }
/* Archivo: zona punteada con su propio botón (el nativo desentona). */
.field input[type="file"] {
  height: auto; padding: 9px 10px; font-size: 13px; color: var(--ink-500);
  background: var(--bg); border-style: dashed; cursor: pointer;
}
.field input[type="file"]::file-selector-button {
  height: 34px; padding: 0 14px; margin-right: 12px; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--navy-700);
  background: var(--paper); border: 1.5px solid var(--ink-300);
}
.field input[type="file"]:hover::file-selector-button { background: var(--navy-50); }
.field input[type="color"] { padding: 6px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--navy-700); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring);
}
.field .error { color: var(--red-600); font-size: 12px; margin-top: 6px; }

/* ---- Login (superficie devocional navy) ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--gradient-navy); padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--paper);
  border-radius: 28px; padding: 40px 36px; text-align: center;
}
.login-card img { width: 72px; margin: 0 auto 16px; }
.login-card h1 {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 18px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--navy-700); margin: 0 0 4px;
}
.login-card .sub { color: var(--ink-500); font-size: 13px; margin: 0 0 28px; }
.login-card form { text-align: left; }

/* ---- Flash / misc ---- */
.flash {
  background: #e3f2ea; color: var(--success); border: 1px solid #bfe3cf;
  border-radius: 14px; padding: 12px 16px; margin-bottom: 20px; font-size: 14px;
}
.flash-error {
  background: var(--red-100); color: var(--red-600); border-color: var(--red-300);
}
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.toolbar input[type="search"] {
  flex: 1; height: 40px; padding: 0 14px; font: inherit; font-size: 14px;
  border: 1.5px solid var(--ink-300); border-radius: 10px;
}
.toolbar input[type="search"]:focus { outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring); }
.tabs { display: inline-flex; gap: 6px; background: var(--ink-100); border-radius: 999px; padding: 4px; }
.tabs a { padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-500); }
.tabs a.active { background: var(--paper); color: var(--navy-700); box-shadow: 0 1px 2px rgba(0,28,61,.06); }
.pagination { display: flex; gap: 6px; margin-top: 20px; }
.pagination a, .pagination span {
  padding: 8px 13px; border-radius: 10px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--ink-200); color: var(--ink-700);
}
.pagination .current { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.muted { color: var(--ink-400); font-size: 12px; }
.actions-inline { display: flex; gap: 8px; align-items: center; }
.empty { text-align: center; padding: 48px 24px; color: var(--ink-500); }
.empty .icon { font-size: 40px; margin-bottom: 12px; }
details.reject-form { margin-top: 6px; }
details.reject-form summary { cursor: pointer; font-size: 13px; color: var(--red-600); font-weight: 500; }
details.reject-form form { margin-top: 10px; display: flex; gap: 8px; }
details.reject-form input { flex: 1; height: 36px; padding: 0 12px; border: 1.5px solid var(--ink-300); border-radius: 10px; font: inherit; font-size: 13px; }

/* Combobox de ciudad — cascada del formulario de apostolados */
.geo-field { position: relative; }
.geo-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  margin-top: 4px; max-height: 260px; overflow-y: auto;
  background: var(--paper); border: 1.5px solid var(--ink-200);
  border-radius: 14px; box-shadow: var(--shadow-md);
}
.geo-result { padding: 11px 14px; font-size: 15px; color: var(--ink-900); cursor: pointer; }
.geo-result:hover { background: var(--navy-50); }

/* ---- Directorio de iglesias: filtro por país, mapa y editor de horarios ---- */
.toolbar .toolbar-select {
  height: 40px; max-width: 220px; padding: 0 12px; font: inherit; font-size: 14px;
  color: var(--ink-900); background: var(--paper);
  border: 1.5px solid var(--ink-300); border-radius: 10px;
}
.toolbar .toolbar-select:focus { outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring); }

.map-search { display: flex; gap: 8px; margin-bottom: 8px; }
.map-search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px; font: inherit; font-size: 14px;
  color: var(--ink-900); background: var(--paper);
  border: 1.5px solid var(--ink-300); border-radius: 10px;
}
.map-search input:focus { outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring); }
.map-status { margin: 0 0 8px; line-height: 1.5; }
.map-results { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.map-result {
  text-align: left; padding: 9px 12px; font: inherit; font-size: 13px; line-height: 1.4;
  color: var(--ink-900); background: var(--paper);
  border: 1px solid var(--ink-200); border-radius: 10px; cursor: pointer;
}
.map-result:hover { background: var(--navy-50); border-color: var(--navy-200); }
/* z-index 0 = contexto propio: los paneles de Leaflet (z 400+) no tapan el
   desplegable de ciudades que se abre encima. */
.church-map {
  position: relative; z-index: 0; height: 280px; margin-bottom: 16px;
  background: var(--ink-100); border: 1.5px solid var(--ink-200); border-radius: 16px; overflow: hidden;
}
.church-map.off {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  text-align: center; font-size: 13px; color: var(--ink-500);
}

.schedule-row {
  margin-bottom: 12px; padding: 12px 14px; background: var(--bg);
  border-left: 4px solid var(--gold-500); border-radius: 14px;
}
.schedule-row[data-kind="confession"] { border-left-color: var(--navy-600); }
.schedule-row[data-kind="adoration"] { border-left-color: var(--gold-700); }
.schedule-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.schedule-kind {
  height: 36px; padding: 0 10px; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--navy-700); background: var(--paper);
  border: 1.5px solid var(--ink-300); border-radius: 10px;
}
.schedule-kind:focus { outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring); }
.days { display: inline-flex; gap: 4px; margin-right: 4px; }
.day { position: relative; display: inline-flex; cursor: pointer; }
.day input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.day span {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  font-size: 13px; font-weight: 600; color: var(--ink-500); background: var(--paper);
  border: 1.5px solid var(--ink-300); border-radius: 50%; user-select: none;
  transition: background 130ms, color 130ms, border-color 130ms;
}
.day input:checked + span { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.day input:focus-visible + span { box-shadow: var(--focus-ring); }
.schedule-remove { margin-left: auto; }
.schedule-fields { display: grid; grid-template-columns: 130px 130px 1fr 1.5fr; gap: 10px; }
.schedule-fields .field { margin-bottom: 0; }
.schedule-fields .field label { margin-bottom: 4px; font-size: 12px; }
.schedule-fields .field input { height: 40px; font-size: 14px; border-radius: 10px; }
@media (max-width: 720px) {
  .schedule-fields { grid-template-columns: 1fr 1fr; }
}

/* ---- Cabecera de página: título a la izquierda, acción principal a la derecha ---- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 32px;
  flex-wrap: wrap; margin-bottom: 28px;
}
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.page-head .subtitle { margin-bottom: 0; max-width: 760px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
  font-size: 13px; font-weight: 600; color: var(--ink-500); transition: color 130ms;
}
.back-link:hover { color: var(--navy-700); }
.back-link .icon { width: 16px; height: 16px; }

/* ---- Utilidades de formulario ---- */
.hint { color: var(--ink-400); font-size: 12px; margin-top: 6px; }
.field .optional {
  font-size: 11px; font-weight: 500; color: var(--ink-400); margin-left: 4px;
  text-transform: lowercase;
}
.btn .icon { width: 16px; height: 16px; }
.btn.ghost { background: transparent; color: var(--ink-500); }
.btn.ghost:hover { background: var(--ink-100); filter: none; }
.btn.danger-text { color: var(--red-600); }
.btn.busy { opacity: 0.7; pointer-events: none; }
.badge .icon { width: 13px; height: 13px; margin-right: 6px; }
.form-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 8px;
}
.form-actions .hint { margin: 0 auto 0 0; flex: 1 1 auto; }
.form-actions .btn { flex-shrink: 0; white-space: nowrap; }
.callout { background: var(--gold-100); border-radius: 14px; padding: 14px 16px; }
.callout label { color: var(--gold-700); font-weight: 600; }
.input-reveal { position: relative; }
.input-reveal input { padding-right: 46px; }
.input-reveal .reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: none; background: none; border-radius: 10px;
  color: var(--ink-400); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.input-reveal .reveal:hover { background: var(--ink-100); color: var(--ink-700); }
.input-reveal .reveal.on { color: var(--navy-700); }

/* ---- Mi cuenta ---- */
.account { max-width: 1000px; }
.account-hero { padding: 0; overflow: hidden; }
.account-hero-banner {
  height: 104px; background: var(--gradient-navy); position: relative;
}
.account-hero-banner::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--gradient-gold); opacity: 0.85;
}
.account-hero-body {
  display: flex; align-items: flex-start; gap: 22px; flex-wrap: wrap;
  padding: 16px 28px 24px; position: relative;
}
/* Solo la foto sube sobre la franja; el nombre queda en blanco, legible. */
.account-avatar { position: relative; margin-top: -72px; }
.avatar.avatar-hero {
  width: 116px; height: 116px; font-size: 40px; font-family: "Cinzel", serif;
  border: 4px solid var(--paper); box-shadow: var(--shadow-md);
}
.account-avatar-edit {
  position: absolute; right: 2px; bottom: 6px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-gold); color: var(--navy-900); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border: 3px solid var(--paper); box-shadow: var(--shadow-sm);
}
.account-avatar-edit .icon { width: 16px; height: 16px; }
.account-id { flex: 1; min-width: 240px; padding-bottom: 2px; }
.account-id h2 {
  font-family: "Cinzel", serif; font-weight: 600; font-size: 24px; letter-spacing: 0.03em;
  color: var(--navy-700); margin: 0 0 4px; line-height: 1.2;
}
.account-line { display: flex; align-items: center; gap: 8px; color: var(--ink-500); font-size: 14px; margin: 0 0 12px; }
.account-line .icon { width: 16px; height: 16px; color: var(--ink-400); }
.account-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.account-photo-actions { display: flex; align-items: center; gap: 8px; align-self: center; }
.account-hero-error { padding: 0 28px 20px; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 980px) { .account-grid { grid-template-columns: 1fr; } }

.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.card-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--navy-50); color: var(--navy-700);
  display: inline-flex; align-items: center; justify-content: center;
}
.card-head h3 {
  font-family: "Cinzel", serif; font-weight: 600; font-size: 17px; letter-spacing: 0.04em;
  color: var(--navy-700); margin: 2px 0 2px;
}
.card-head p { margin: 0; color: var(--ink-500); font-size: 13px; }

/* ---- Denuncias: resolver con nota, descartar o suspender ---- */
.report-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.report-actions form { display: flex; gap: 6px; }
.input-sm {
  height: 32px; width: 160px; padding: 0 10px; font: inherit; font-size: 13px; color: var(--ink-900);
  background: var(--paper); border: 1.5px solid var(--ink-300); border-radius: 10px;
}
.input-sm:focus { outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring); }

/* ---- Celdas: icono o imagen + título y una línea de detalle ---- */
.cell-media { display: flex; align-items: center; gap: 12px; }
.thumb-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; background: var(--navy-100);
}
td a strong { color: var(--navy-700); }
td a:hover strong { text-decoration: underline; text-underline-offset: 3px; }

/* ---- Actividades: formulario por secciones, iglesia, galería y video ---- */
.form-stack { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.check {
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500;
  color: var(--ink-700); cursor: pointer;
}
.field label.check { display: flex; margin-bottom: 0; font-size: 14px; }
.check input[type="checkbox"] { width: auto; height: auto; margin: 0; }
.church-picker { margin-bottom: 0; }
.church-picker input[type="search"] { background: var(--paper); }
.church-picked {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 6px 0 14px;
  background: var(--paper); border-radius: 14px; color: var(--navy-700);
}
.church-picked strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-result .muted { font-size: 13px; }
.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-bottom: 10px;
}
.photo-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 6px; margin: 0;
  background: var(--bg); border-radius: 14px; cursor: pointer;
}
.field .photo-tile { margin-bottom: 0; }
.photo-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.photo-tile .check { font-size: 12px; padding: 0 4px 2px; }
.photo-tile:has(input:checked) { background: var(--red-100); }
.photo-tile:has(input:checked) img { opacity: 0.45; }
.media-current {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 10px 14px;
  background: var(--navy-50); border-radius: 14px; font-size: 13px;
}
.media-current img { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.media-current div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.media-current a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow .optional { letter-spacing: 0; text-transform: lowercase; font-weight: 500; color: var(--ink-400); margin-left: 4px; }
.thumb-img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--ink-100); }
.cell-media .thumb-icon { width: 44px; height: 44px; color: var(--navy-700); }

/* ---- Avisos planos (sin borde ni sombra) y barra de importación ---- */
.notice { border-radius: 14px; padding: 14px 18px; margin: 0 0 16px; font-size: 14px; line-height: 1.55; }
.notice.warn { background: var(--gold-100); color: var(--gold-700); }
.notice.error { background: var(--red-100); color: var(--red-600); }
.notice a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.card.tint { background: var(--navy-50); }
.import-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px 24px; padding: 16px 20px; margin-bottom: 16px;
}
.import-bar form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.import-bar .field { margin: 0; }
.import-bar .field input { width: 190px; height: 40px; border-radius: 10px; font-size: 14px; }
.import-bar .meta { margin: 0; max-width: 460px; text-align: right; }
.cell-origin { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.run-summary { margin: 0 0 12px; font-size: 13px; line-height: 1.6; color: var(--ink-700); }
.run-summary ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-500); }

/* ---- Pantallas estrechas (móvil, tablet): barra superior con «Menú» ---- */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: auto; height: auto; z-index: 50; padding: 10px 16px;
    flex-direction: row; flex-wrap: wrap; align-items: center;
  }
  .sidebar .brand { flex: 1; padding: 4px 0; }
  .sidebar .brand img { width: 30px; height: 30px; }
  .menu-toggle {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
    border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08);
    color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  }
  .menu-toggle .when-open, .sidebar.open .menu-toggle .when-closed { display: none; }
  .sidebar.open .menu-toggle .when-open { display: block; }
  .sidebar .nav, .sidebar .foot { display: none; flex-basis: 100%; }
  .sidebar.open .nav { display: flex; max-height: calc(100vh - 150px); margin: 10px -6px 0; }
  .sidebar.open .foot { display: flex; }

  .main { padding: 24px 16px 40px; max-width: none; min-width: 0; }
  h1.title { font-size: 24px; }
  /* Las tablas se desplazan de lado dentro de su tarjeta; los formularios
     pasan a una columna. */
  .card { overflow-x: auto; }
  .card > table { min-width: 640px; }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .account-hero-body { padding: 16px 20px 22px; }
  .account-photo-actions { align-self: flex-start; }
  .import-bar .meta { max-width: none; text-align: left; }
}

/* ============================================================
   Mensajes equipo ↔ usuario (Comunidad → Mensajes)
   Bandeja, mensaje nuevo y conversación. Tarjetas planas.
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }

/* ---- Bandeja ---- */
.msg-list { padding: 8px; }
.msg-row {
  display: grid; grid-template-columns: 12px 38px minmax(150px, 230px) minmax(0, 1fr) auto;
  align-items: center; gap: 14px; padding: 12px 12px; border-radius: 14px; color: inherit;
  transition: background 130ms;
}
.msg-row:hover { background: var(--navy-50); }
.msg-row:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.msg-row + .msg-row { margin-top: 2px; }
.msg-dot { width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.msg-row.unread .msg-dot { background: var(--gold-500); }
.msg-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.msg-who strong, .msg-who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-who strong { color: var(--ink-900); font-weight: 600; font-size: 14px; }
.msg-row.unread .msg-who strong { font-weight: 700; }
.msg-main-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.msg-tags { display: inline-flex; gap: 6px; flex-shrink: 0; }
.msg-tags:not(:has(.badge)) { display: none; }
.msg-tags .badge { padding: 2px 10px; font-size: 11px; }
.msg-preview {
  min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-500); font-size: 14px;
}
.msg-preview .you { color: var(--ink-400); }
.msg-row.unread .msg-preview { color: var(--ink-900); font-weight: 500; }
.msg-time {
  color: var(--ink-400); font-size: 12px; white-space: nowrap; text-align: right;
  font-variant-numeric: tabular-nums;
}
.msg-row.unread .msg-time { color: var(--ink-700); font-weight: 600; }

/* ---- Mensaje nuevo ---- */
.msg-new { max-width: 760px; display: flex; flex-direction: column; gap: 16px; }
.msg-search { display: flex; gap: 8px; }
.msg-search input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; font: inherit; font-size: 15px;
  color: var(--ink-900); background: var(--paper); border: 1.5px solid var(--ink-300); border-radius: 12px;
}
.msg-search input:focus { outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring); }
.msg-search .btn { height: 44px; }
.msg-results { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.msg-pick {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
  color: inherit; transition: background 130ms;
}
.msg-pick:hover, .msg-pick:focus-visible { background: var(--navy-50); outline: none; }
.msg-pick .msg-who { flex: 1; }
.msg-recipient {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px;
  background: var(--navy-50); border-radius: 14px;
}
.msg-recipient .msg-who { flex: 1; }
.msg-composer.msg-composer-flat { padding: 0; border-top: 0; }
.msg-composer-flat .field textarea { min-height: 150px; }

/* ---- Conversación ---- */
.msg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.msg-main { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.msg-thread-wrap { position: relative; }
.msg-thread {
  display: flex; flex-direction: column; gap: 4px; padding: 20px 24px;
  height: clamp(280px, calc(100vh - 420px), 640px); overflow-y: auto; overscroll-behavior: contain;
}
.msg-older, .msg-empty { align-self: center; margin: 0 0 8px; font-size: 12px; color: var(--ink-400); text-align: center; }
.msg-empty { margin: auto; font-size: 14px; }
.msg-day { align-self: center; margin: 14px 0 8px; }
.msg-day span {
  display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--ink-100);
  color: var(--ink-500); font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
}
.msg { display: flex; }
.msg-user { justify-content: flex-start; }
.msg-team { justify-content: flex-end; }
.msg + .msg.msg-team, .msg + .msg.msg-user { margin-top: 2px; }
.msg-user + .msg-team, .msg-team + .msg-user { margin-top: 8px; }
.msg-bubble {
  max-width: min(78%, 560px); padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.5;
}
.msg-user .msg-bubble { background: var(--ink-100); color: var(--ink-900); border-bottom-left-radius: 6px; }
.msg-team .msg-bubble { background: var(--navy-700); color: #fff; border-bottom-right-radius: 6px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; font-size: 11px; line-height: 1.3; }
.msg-user .msg-meta { color: var(--ink-500); }
.msg-team .msg-meta { color: var(--navy-200); justify-content: flex-end; }
.msg-poll-status { margin: 0; padding: 6px 24px; font-size: 12px; color: var(--red-600); background: var(--red-100); }
.msg-poll-status.paused { color: var(--gold-700); background: var(--gold-100); }
.msg-poll-resume {
  margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.msg-newpill {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2;
  height: 32px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--navy-700); color: #fff; font: inherit; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-md);
}
.msg-composer { border-top: 1px solid var(--ink-100); padding: 14px 18px 16px; }
.msg-composer textarea {
  display: block; width: 100%; min-height: 78px; max-height: 240px; padding: 12px 14px; resize: vertical;
  font: inherit; font-size: 15px; line-height: 1.5; color: var(--ink-900); background: var(--paper);
  border: 1.5px solid var(--ink-300); border-radius: 14px;
  transition: border-color 130ms, box-shadow 130ms;
}
.msg-composer textarea:focus { outline: none; border-color: var(--navy-700); box-shadow: var(--focus-ring); }
.msg-composer .error { color: var(--red-600); font-size: 12px; margin-top: 6px; }
.msg-composer-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.msg-composer-foot .hint { flex: 1; margin: 0; }
.msg-count { font-size: 12px; color: var(--ink-400); white-space: nowrap; font-variant-numeric: tabular-nums; }
.msg-count.near { color: var(--gold-700); font-weight: 600; }
.msg-count.over { color: var(--red-600); font-weight: 700; }

.msg-side { display: flex; flex-direction: column; gap: 16px; }
.msg-profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.msg-profile-head .msg-who strong { font-size: 15px; }
.msg-profile dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0 0 16px; font-size: 13px; }
.msg-profile dt { color: var(--ink-400); }
.msg-profile dd { margin: 0; color: var(--ink-900); text-align: right; overflow-wrap: anywhere; }
.msg-links { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.msg-actions { display: flex; flex-direction: column; gap: 10px; }
.msg-actions form, .msg-actions .btn { width: 100%; }
.msg-actions .hint { margin: 2px 0 0; }

@media (max-width: 560px) {
  .msg-thread { padding: 16px 14px; }
  .msg-composer { padding: 12px 12px 14px; }
  .msg-composer-foot { flex-wrap: wrap; }
  .msg-composer-foot .hint { flex-basis: 100%; }
  .msg-composer-foot .msg-count { margin-left: auto; }
}
@media (max-width: 980px) {
  .msg-layout { grid-template-columns: 1fr; }
  .msg-row { grid-template-columns: 12px 38px minmax(0, 1fr) auto; row-gap: 4px; }
  .msg-row .msg-main-line { grid-column: 3 / -1; grid-row: 2; }
  .msg-bubble { max-width: 88%; }
}
