/* =========================================================
   Sistema de Registro Ciudadano — Diversidad
   Sistema de Diseño Institucional (base INJUVE + extensiones)
   H. Ayuntamiento de Ecatepec de Morelos
   ========================================================= */

:root {
  --guinda:       #691C32;
  --guinda-dark:  #4e1526;
  --guinda-xdark: #38101b;
  --guinda-light: #7d2240;
  --dorado:       #BC955C;
  --dorado-light: #c9a670;
  --dorado-pale:  #e8d4aa;
  --crema:        #ECD798;
  --crema-light:  #f5edcc;
  --crema-pale:   #fdf9f0;

  --panel:   #ffffff;
  --panel-2: #fdf9f0;
  --line:    #e8d9c0;
  --bg:      #f4ebe0;
  --text:     #231018;
  --muted:    #7a5560;

  --success: #166534; --success-bg: #dcfce7;
  --warning: #854d0e; --warning-bg: #fef9c3;
  --danger:  #991b1b; --danger-bg:  #fee2e2;
  --info:    #1e40af; --info-bg:    #dbeafe;

  --sh-xs: 0 1px 4px  rgba(105,28,50,0.06);
  --sh-sm: 0 2px 8px  rgba(105,28,50,0.08);
  --sh:    0 4px 16px rgba(105,28,50,0.10);
  --sh-md: 0 8px 28px rgba(105,28,50,0.14);
  --sh-lg: 0 16px 48px rgba(105,28,50,0.20);
  --sh-xl: 0 24px 64px rgba(0,0,0,0.28);

  --r:    18px;
  --r-sm: 12px;
  --r-xs: 8px;
  --t:    .18s ease;
  --t-lg: .28s cubic-bezier(.4,0,.2,1);

  --sb-width: 260px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--dorado);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ── Animations ── */
@keyframes viewIn  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideUp { from { opacity:0; transform:translateY(28px) scale(.97); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--r-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--sh-md);
  animation: toastIn .22s ease;
  pointer-events: auto;
  max-width: 340px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info    { background: var(--info); }

/* ── Header ── */
.main-header {
  background: #fff;
  color: var(--text);
  padding: 0 24px;
  box-shadow: var(--sh-sm);
  border-bottom: 3px solid var(--guinda);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  gap: 12px;
}
.header-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.header-logo-img {
  height: 50px;
  width: auto;
  max-width: min(58vw, 240px);
  display: block;
  object-fit: contain;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-inicio {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--guinda);
  background: var(--crema-pale);
  border: 1.5px solid var(--dorado-pale);
  padding: 8px 20px;
  border-radius: 50px;
  transition: var(--t);
  cursor: pointer;
}
.btn-inicio:hover {
  background: var(--crema-light);
  border-color: var(--dorado);
}
.admin-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--guinda), var(--guinda-light));
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  transition: var(--t);
  box-shadow: 0 2px 8px rgba(105,28,50,.25);
}
.admin-link:hover {
  background: linear-gradient(135deg, var(--guinda-dark), var(--guinda));
  box-shadow: 0 4px 14px rgba(105,28,50,.35);
}
.back-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--t);
}
.back-link:hover { color: var(--guinda); }

/* ── Home ── */
.home-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px;
  animation: viewIn .24s ease;
}
.home-hero {
  text-align: center;
  margin-bottom: 52px;
}
.home-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--guinda);
  margin-bottom: 10px;
}
.home-hero p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  max-width: 560px;
  margin: 0 auto;
}
.service-card {
  background: var(--panel);
  border-radius: var(--r);
  padding: 40px 32px;
  box-shadow: var(--sh);
  border-top: 4px solid var(--guinda);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t);
}
.service-card:hover,
.service-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg);
}
.service-icon {
  font-size: 2.4rem;
  line-height: 1;
}
.service-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--guinda);
}
.service-card p {
  font-size: 0.9rem;
  color: var(--muted);
  flex: 1;
  line-height: 1.6;
}
.home-note {
  text-align: center;
  margin-top: 40px;
  font-size: 0.85rem;
  color: var(--muted);
}
.home-note a { color: var(--guinda); font-weight: 600; text-decoration: underline; }

/* ── Footer institucional ── */
.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  border-top: 1px solid var(--line);
}
.site-footer-logo {
  height: 68px;
  width: auto;
  max-width: 80vw;
  object-fit: contain;
  opacity: 0.95;
}
.site-footer-org {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--guinda);
  letter-spacing: 0.01em;
}
.site-footer-meta {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--guinda), var(--guinda-light));
  color: #fff;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(105,28,50,.30);
  transition: var(--t);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--guinda-dark), var(--guinda));
  box-shadow: 0 6px 18px rgba(105,28,50,.40);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-secondary {
  background: transparent;
  color: var(--dorado);
  border: 2px solid var(--dorado);
  padding: 9px 24px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--t);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.btn-secondary:hover {
  background: var(--dorado);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 9px 20px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--t);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--crema-pale); color: var(--text); }
.btn-ghost:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-excel {
  background: #1d6f42;
  color: #fff;
  padding: 9px 20px;
  border-radius: var(--r-xs);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: var(--t);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-excel:hover { background: #15532f; }
.btn-excel:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 6px 16px; font-size: 0.8rem; }
.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--crema-pale);
  color: var(--guinda);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: var(--t);
  font-size: 1rem;
}
.btn-icon:hover { background: var(--crema-light); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--t);
}
.btn-danger:hover { background: #7f1616; }

/* ── Form Container ── */
.form-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  animation: viewIn .24s ease;
}
.form-page-wide {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  animation: viewIn .24s ease;
}
.form-page-head { text-align: center; margin-bottom: 28px; }
.form-page-head h1 { font-size: 1.7rem; font-weight: 800; color: var(--guinda); margin-bottom: 8px; }
.form-page-head p { font-size: 0.95rem; color: var(--muted); }

/* ── Form Panel ── */
.form-panel {
  background: var(--panel);
  border-radius: var(--r);
  padding: 36px;
  box-shadow: var(--sh);
  border-top: 4px solid var(--guinda);
}
.form-panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--guinda);
  margin-bottom: 6px;
}
.form-panel-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 28px;
}
.form-section-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .form-panel { padding: 24px 20px; }
}

/* ── Indicador de pasos (wizard) ── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
}
.step-item { display: flex; align-items: center; }
.step-wrapper { display: flex; flex-direction: column; align-items: center; }
.step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  transition: var(--t);
  position: relative; z-index: 1;
}
.step-item.active .step-circle {
  background: var(--guinda);
  border-color: var(--guinda);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(105,28,50,0.15);
}
.step-item.completed .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.step-item.completed .step-circle::after { content: '✓'; font-size: 0.875rem; }
.step-label {
  font-size: 0.75rem; font-weight: 600;
  color: var(--muted);
  margin-top: 6px; white-space: nowrap;
}
.step-item.active .step-label { color: var(--guinda); }
.step-item.completed .step-label { color: var(--success); }
.step-connector {
  width: 60px; height: 2px;
  background: var(--line);
  margin-bottom: 22px;
  transition: var(--t);
}
.step-connector.done { background: var(--success); }
@media (max-width: 480px) {
  .step-indicator { margin-bottom: 28px; }
  .step-connector { width: 28px; }
  .step-label { font-size: 0.68rem; }
}

/* ── Form Groups ── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.form-group label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--panel);
  color: var(--text);
  transition: var(--t);
  font-size: 0.9375rem;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--dorado);
  box-shadow: 0 0 0 3px rgba(188,149,92,.15);
}
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(153,27,27,.10);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  font-weight: 500;
  display: none;
}
.form-error.visible { display: block; }
.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Checkbox ── */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: var(--crema-pale);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: var(--t);
  margin: 4px 0;
}
.checkbox-group:hover { border-color: var(--dorado); background: var(--crema-light); }
.checkbox-group.error { border-color: var(--danger); }
.checkbox-group input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--guinda);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}
.checkbox-group span {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}
.checkbox-group span a { color: var(--guinda); font-weight: 600; text-decoration: underline; }

/* Honeypot — accessibly hidden, off-viewport */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ── File Upload ── */
.file-upload-area {
  border: 2px dashed var(--dorado-pale);
  border-radius: var(--r-xs);
  padding: 24px;
  background: var(--crema-pale);
  transition: var(--t);
  cursor: pointer;
  text-align: center;
}
.file-upload-area:hover,
.file-upload-area:focus-visible,
.file-upload-area.drag-over {
  border-color: var(--dorado);
  background: var(--crema-light);
}
.file-upload-area.has-file {
  border-color: var(--success);
  background: var(--success-bg);
}
.file-upload-area input[type="file"] { display: none; }
.file-upload-icon { font-size: 2rem; margin-bottom: 8px; }
.file-upload-text {
  font-size: 0.85rem;
  color: var(--muted);
}
.file-upload-text strong { color: var(--guinda); }
.file-upload-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--success);
  margin-top: 6px;
  word-break: break-all;
}
.file-meta {
  display: none;
  margin-top: 10px;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.file-meta.visible { display: flex; }
.file-meta-name { font-size: 0.82rem; font-weight: 600; color: var(--success); word-break: break-all; }
.file-meta-size { font-size: 0.78rem; color: var(--muted); }
.file-replace {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--guinda);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}
.file-progress {
  display: none;
  height: 6px;
  border-radius: 4px;
  background: var(--dorado-pale);
  overflow: hidden;
  margin-top: 10px;
}
.file-progress.visible { display: block; }
.file-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--dorado), var(--guinda));
  transition: width .2s ease;
}
.file-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.file-group-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.file-group-label .req { color: var(--danger); }

/* ── Form Actions ── */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  gap: 12px;
  flex-wrap: wrap;
}
.form-actions-right { display: flex; gap: 12px; margin-left: auto; }

/* ── Privacy notice box ── */
.privacy-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 16px 18px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 14px;
  max-height: 160px;
  overflow-y: auto;
}
.privacy-box strong { color: var(--guinda); }

/* ── Success Screen ── */
.success-screen {
  text-align: center;
  padding: 20px 0;
  animation: viewIn .3s ease;
}
.success-icon {
  width: 80px; height: 80px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 24px;
}
.success-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--guinda);
  margin-bottom: 10px;
}
.success-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 440px;
  margin: 0 auto 24px;
}
.folio-box {
  background: var(--crema-pale);
  border: 2px solid var(--dorado-pale);
  border-radius: var(--r-sm);
  padding: 18px 28px;
  display: inline-block;
  margin-bottom: 28px;
}
.folio-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.folio-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--guinda);
  letter-spacing: 0.05em;
}
.success-details {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 8px 24px;
  text-align: left;
  margin: 0 auto 26px;
  padding: 18px 24px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.success-details dt { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.success-details dd { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.success-hint {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 460px;
  margin: 0 auto 28px;
}

/* ── Admin Layout ── */
.admin-shell {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: var(--sb-width);
  background: linear-gradient(160deg, var(--guinda-xdark), var(--guinda-dark));
  color: #f5e8ec;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
}
.sb-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sb-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}
.sb-logo-img {
  width: 100%;
  max-width: 200px;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.28));
}
.sb-title {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dorado-pale);
  margin-top: 10px;
}
.sb-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.8rem;
  opacity: 0.75;
}
.sb-nav { flex: 1; padding: 12px 12px; }
.sb-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(245,232,236,0.8);
  cursor: pointer;
  transition: var(--t);
  margin-bottom: 4px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sb-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.sb-nav-item.active {
  background: rgba(236,215,152,0.14);
  border-left: 3px solid var(--dorado);
  color: var(--crema);
  padding-left: 9px;
}
.sb-nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }
.sb-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Drawer toggle + backdrop (mobile) */
.sb-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--r-xs);
  background: var(--crema-pale);
  border: 1px solid var(--line);
  color: var(--guinda);
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(35,16,24,0.5);
  z-index: 1100;
}
.sb-backdrop.open { display: block; animation: fadeIn .18s ease; }

/* ── Admin Main ── */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-topbar {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 4px solid var(--guinda);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--guinda);
}
.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
}
.topbar-date { font-size: 0.8rem; color: var(--muted); }
.admin-content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
  animation: viewIn .24s ease;
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--panel);
  border-radius: var(--r-sm);
  padding: 22px 24px;
  box-shadow: var(--sh-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--guinda);
}
.stat-card.dorado::after { background: var(--dorado); }
.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.info::after { background: var(--info); }
.stat-card.danger::after { background: var(--danger); }
.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--guinda);
  line-height: 1;
}
.stat-card.dorado .stat-value { color: var(--dorado); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.info .stat-value { color: var(--info); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-icon {
  position: absolute;
  top: 18px; right: 20px;
  font-size: 1.8rem;
  opacity: 0.15;
}
.stat-card.pending-flag {
  border: 1.5px solid var(--warning);
}
.pending-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--warning);
  margin-left: 8px;
  vertical-align: middle;
  animation: pendPulse 1.6s ease-in-out infinite;
}
@keyframes pendPulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* ── Table ── */
.table-wrap {
  background: var(--panel);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.table-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.table-title {
  font-size: 0.935rem;
  font-weight: 700;
  color: var(--guinda);
}
.table-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-select {
  padding: 7px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--crema-pale);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--t);
}
.filter-select:focus { border-color: var(--dorado); }
.filter-date {
  padding: 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  transition: var(--t);
}
.filter-date:focus { border-color: var(--dorado); }
.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.search-input {
  padding: 7px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--panel);
  font-size: 0.82rem;
  outline: none;
  transition: var(--t);
  min-width: 200px;
}
.search-input:focus { border-color: var(--dorado); }
.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: var(--crema-light);
  color: var(--guinda);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid var(--dorado-pale);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: var(--crema-pale); }
tbody tr:hover td { background: #fef6e4; }
.cell-folio { font-size: 0.78rem; color: var(--guinda); font-weight: 700; font-family: 'Inter', monospace; }

/* ── Solicitudes: tabla compacta que cabe completa, sin barra horizontal ── */
.sol-table { table-layout: fixed; width: 100%; }
.sol-table th, .sol-table td { padding: 11px 12px; }
.sol-table th { white-space: normal; }
.sol-table td { word-break: break-word; overflow-wrap: anywhere; }
.sol-table .cell-date { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
/* Reparto de anchos: nombre manda, fechas y acciones compactas */
.sol-table th:nth-child(1), .sol-table td:nth-child(1) { width: 11%; }   /* Folio */
.sol-table th:nth-child(2), .sol-table td:nth-child(2) { width: 12%; }   /* Registrada */
.sol-table th:nth-child(3), .sol-table td:nth-child(3) { width: 21%; }   /* Nombre */
.sol-table th:nth-child(4), .sol-table td:nth-child(4) { width: 11%; }   /* Celular */
.sol-table th:nth-child(5), .sol-table td:nth-child(5) { width: 11%; }   /* Estatus */
.sol-table th:nth-child(6), .sol-table td:nth-child(6) { width: 13%; }   /* Atendió */
.sol-table th:nth-child(7), .sol-table td:nth-child(7) { width: 12%; }   /* Actualizada */
.sol-table th:nth-child(8), .sol-table td:nth-child(8) { width: 9%; text-align: center; }  /* Acciones */
.sol-table td.cell-actions { text-align: center; }
@media (max-width: 640px) {
  /* En móvil la tabla ya colapsa a tarjetas: anular anchos fijos */
  .sol-table, .sol-table th, .sol-table td { width: auto !important; table-layout: auto; }
}
.table-empty {
  text-align: center;
  padding: 48px;
  color: var(--muted);
  font-size: 0.9rem;
}
.table-footer {
  padding: 12px 20px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Pagination */
.pagination { display: flex; align-items: center; gap: 6px; }
.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--line);
  background: var(--panel);
  color: var(--guinda);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--t);
}
.page-btn:hover:not(:disabled) { background: var(--crema-pale); border-color: var(--dorado); }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.page-info { font-size: 0.8rem; color: var(--muted); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-pendiente   { background: var(--info-bg);    color: var(--info);    }
.badge-en_revision { background: var(--warning-bg); color: var(--warning); }
.badge-aprobada    { background: var(--success-bg); color: var(--success); }
.badge-rechazada   { background: var(--danger-bg);  color: var(--danger);  }
.badge-activo   { background: var(--success-bg); color: var(--success); }
.badge-inactivo { background: var(--danger-bg);  color: var(--danger);  }
.badge-rol { background: var(--crema-pale); color: var(--guinda); border: 1px solid var(--dorado-pale); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35,16,24,0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}
.modal {
  background: var(--panel);
  border-radius: 22px;
  border-top: 4px solid var(--guinda);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .24s cubic-bezier(.4,0,.2,1);
}
.modal-header {
  padding: 24px 28px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--guinda);
}
.modal-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--crema-pale);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  transition: var(--t);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* ── Detail Sections ── */
.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 20px;
}
.detail-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 3px;
}
.detail-field span {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}
.doc-links { display: flex; flex-wrap: wrap; gap: 10px; }
.doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--crema-pale);
  border: 1.5px solid var(--dorado-pale);
  border-radius: var(--r-xs);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--guinda);
  cursor: pointer;
  transition: var(--t);
  text-decoration: none;
}
.doc-btn:hover { background: var(--crema-light); border-color: var(--dorado); }

/* Historial timeline */
.historial-list { display: flex; flex-direction: column; gap: 0; }
.historial-item {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 2px solid var(--dorado-pale);
}
.historial-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.historial-item::before {
  content: '';
  position: absolute;
  left: -6px; top: 3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--guinda);
  border: 2px solid var(--panel);
}
.historial-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.historial-arrow { font-size: 0.78rem; color: var(--muted); }
.historial-meta { font-size: 0.76rem; color: var(--muted); }
.historial-notas { font-size: 0.82rem; color: var(--text); margin-top: 4px; background: var(--panel-2); padding: 8px 12px; border-radius: var(--r-xs); }

/* ── Admin Login ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--guinda-xdark) 0%, var(--guinda) 50%, var(--guinda-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--panel);
  border-radius: var(--r);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--sh-xl);
  animation: slideUp .28s cubic-bezier(.4,0,.2,1);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-img {
  width: auto;
  height: 58px;
  max-width: 260px;
  object-fit: contain;
  margin: 0 auto 18px;
  display: block;
}
.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--guinda), var(--guinda-light));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(105,28,50,.35);
}
.login-logo-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--guinda);
}
.login-logo-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}
.login-form-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  text-align: center;
}
.login-form-fields { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-guinda { border-color: rgba(105,28,50,0.25); border-top-color: var(--guinda); }

/* ── Misc ── */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.muted { color: var(--muted); }
.section-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--guinda);
  margin-bottom: 4px;
}
.section-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 20px; }

/* ── Responsive: table → cards ── */
@media (max-width: 640px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody { display: block; width: 100%; }
  table.responsive tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    margin: 12px;
    padding: 6px 4px;
    background: var(--panel);
    box-shadow: var(--sh-xs);
  }
  table.responsive tbody tr:nth-child(even) td,
  table.responsive tbody tr:hover td { background: transparent; }
  table.responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    border: none;
    padding: 8px 14px;
    text-align: right;
  }
  table.responsive td::before {
    content: attr(data-label);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
  }
  table.responsive td.cell-actions { justify-content: flex-end; }
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: 0; top: 0;
    z-index: 1200;
    display: flex;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--sh-lg);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .sb-toggle { display: inline-flex; }
  .admin-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 32px 24px; }
  .recent-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 1.7rem; }
  .header-content { height: auto; padding: 12px 0; }
  .site-footer-logo { height: 54px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Bloque de motivo de rechazo (destacado, rojo suave) ── */
.reject-box {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-left: 4px solid var(--danger);
  border-radius: var(--r-sm);
  padding: 14px 16px;
}
.reject-box-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--danger);
  margin-bottom: 6px;
}
.reject-box-text {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.reject-note {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-weight: 600;
}

/* ── Consulta pública ── */
.home-consulta {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.consulta-card { margin-top: 20px; }
.consulta-msg {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 500;
}
.consulta-msg-ok   { background: var(--success-bg); color: var(--success); }
.consulta-msg-info { background: var(--info-bg);    color: var(--info);    }
