/* ==========================================================================
   CÍVICA GESTOROPS — SISTEMA DE DISEÑO UI/UX EJECUTIVO Y COMPACTO (v3)
   Identidad Oficial Cívica: Azul Real (#00236F) + Verde Lima (#9EFF00 / #006C4A)
   Escala SaaS moderna (Linear / Stripe / Vercel style), Cero superposiciones
   ========================================================================== */

:root {
  --civica-topbar-h: 44px;
  --civica-sidebar-w: 236px;
  --civica-header-h: 54px;
  --civica-primary: #00236f;
  --civica-lime: #a3e635;
  --civica-emerald: #059669;
  --civica-border: #e2e8f0;
  --civica-bg: #f8fafc;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 13.5px !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden !important;
  font-variant-numeric: tabular-nums;
  background-color: var(--civica-bg) !important;
  color: #0f172a;
}

/* Foco accesible limpio */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #2563eb !important;
  outline-offset: 1px !important;
}

/* Alturas equilibradas para inputs y botones */
button,
.btn-touch-target,
select,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"] {
  min-height: 36px;
  font-size: 13px !important;
}

/* ==========================================================================
   1. PROTECCIÓN ESTRICTA DE ÍCONOS MATERIAL SYMBOLS
   ========================================================================== */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
  font-weight: normal;
  font-style: normal;
  line-height: 1 !important;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  white-space: nowrap !important;
  word-wrap: normal;
  direction: ltr;
  overflow: hidden !important;
  width: 1.25em;
  height: 1.25em;
  max-width: 24px !important;
  max-height: 24px !important;
  vertical-align: middle;
  flex-shrink: 0;
  user-select: none;
}

/* ==========================================================================
   2. BARRA SUPERIOR GLOBAL DE UNA SOLA LÍNEA CON LOGO OFICIAL CÍVICA
   ========================================================================== */
#civica-global-bar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: var(--civica-topbar-h) !important;
  z-index: 9999 !important;
  background: linear-gradient(90deg, #001442 0%, #00236f 60%, #0f296b 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(163, 230, 53, 0.28);
  padding: 0 16px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 12px;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px;
  box-shadow: 0 2px 10px rgba(0, 20, 66, 0.22);
  overflow-x: auto;
  scrollbar-width: none;
}

#civica-global-bar::-webkit-scrollbar {
  display: none;
}

#civica-global-bar > div {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

#civica-global-bar select {
  min-height: 28px !important;
  height: 28px !important;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 11.5px !important;
  font-weight: 600;
  max-width: 215px;
  cursor: pointer;
}

#civica-global-bar select option {
  background: #00164e;
  color: #ffffff;
}

#civica-global-bar .civica-badge-db {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #bbf7d0;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}

/* ==========================================================================
   3. LAYOUT DE ESCRITORIO Y MÓVIL SIN SUPERPOSICIONES
   ========================================================================== */
body {
  padding-top: var(--civica-topbar-h) !important;
}

aside.fixed.left-0.w-72,
aside.fixed.w-72 {
  top: var(--civica-topbar-h) !important;
  height: calc(100vh - var(--civica-topbar-h)) !important;
  width: var(--civica-sidebar-w) !important;
  z-index: 60 !important;
  background: #ffffff !important;
  border-right: 1px solid var(--civica-border) !important;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.03) !important;
}

div.pl-72 {
  padding-left: var(--civica-sidebar-w) !important;
}

header.fixed.left-72 {
  top: var(--civica-topbar-h) !important;
  left: var(--civica-sidebar-w) !important;
  height: var(--civica-header-h) !important;
  z-index: 50 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid var(--civica-border) !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
}

/* Pantallas móviles (ej. registro rápido en terreno) con header fixed top-0 */
header.fixed.top-0.w-full {
  top: var(--civica-topbar-h) !important;
}

main.pt-16 {
  padding-top: calc(var(--civica-header-h) + 14px) !important;
  padding-left: 22px !important;
  padding-right: 22px !important;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}

/* Evitar que el modal de la pantalla 2 quede atrapado en un overlay oscuro gigante */
.fixed.inset-0.z-50.flex.items-center.justify-center.p-space-md.sm\:p-space-lg.bg-inverse-surface\/60 {
  position: relative !important;
  inset: auto !important;
  z-index: 10 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 8px 0 28px 0 !important;
}

.fixed.inset-0.z-50.flex.items-center.justify-center.p-space-md.sm\:p-space-lg.bg-inverse-surface\/60 > div {
  max-height: none !important;
  max-width: 1120px !important;
  border: 1px solid var(--civica-border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
}

/* Ocultar el fondo borroso innecesario de la pantalla 2 cuando se convierte en vista limpia */
.opacity-40.pointer-events-none.select-none.filter.blur-\[2px\] {
  display: none !important;
}

/* ==========================================================================
   4. ESCALA TIPOGRÁFICA Y TARJETAS REFINADAS (UI/UX SaaS Limpio)
   ========================================================================== */
.font-display-lg {
  font-size: 24px !important;
  line-height: 30px !important;
  letter-spacing: -0.02em !important;
}

.font-headline-lg {
  font-size: 19px !important;
  line-height: 25px !important;
}

.font-headline-md {
  font-size: 16.5px !important;
  line-height: 22px !important;
}

.font-headline-sm {
  font-size: 14.5px !important;
  line-height: 20px !important;
}

.font-title-md {
  font-size: 13.5px !important;
  line-height: 19px !important;
}

.font-body-md {
  font-size: 13px !important;
  line-height: 19px !important;
}

.font-body-sm, .font-label-md {
  font-size: 11.5px !important;
  line-height: 16px !important;
}

/* Tarjetas más elegantes con borde sutil */
.bg-surface-container-lowest.rounded-xl {
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

/* Sidebar estilizado */
aside nav a {
  padding: 6px 10px !important;
  font-size: 12.5px !important;
  border-radius: 8px !important;
  margin-bottom: 1px;
}

/* Widgets interactivos Cívica (Mapa Vivienda, Puesto de Votación, Cumpleaños, Firma Legal) */
.civica-ux-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.civica-sig-canvas {
  width: 100%;
  height: 130px;
  background: #f8fafc;
  border: 1.5px dashed #94a3b8;
  border-radius: 10px;
  cursor: crosshair;
  touch-action: none;
}

.civica-map-box {
  width: 100%;
  height: 230px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  overflow: hidden;
  z-index: 5;
}

/* ==========================================================================
   5. ADAPTACIÓN MÓVIL Y TABLET (< 1024px)
   ========================================================================== */
@media (max-width: 1023px) {
  aside.fixed.left-0.w-72,
  aside.fixed.w-72 {
    transform: translateX(-105%);
    transition: transform 0.22s ease-in-out;
    z-index: 9990 !important;
    width: 250px !important;
    max-width: 85vw;
  }

  body.civica-R-nav-open aside.fixed.left-0.w-72,
  body.civica-R-nav-open aside.fixed.w-72 {
    transform: translateX(0);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.35) !important;
  }

  div.pl-72 {
    padding-left: 0 !important;
  }

  header.fixed.left-72 {
    left: 0 !important;
    position: sticky !important;
    top: var(--civica-topbar-h) !important;
    height: auto !important;
    min-height: 48px !important;
    padding: 6px 12px !important;
    flex-wrap: wrap;
    gap: 6px;
  }

  main.pt-16 {
    padding-top: 12px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

.overflow-x-auto,
table {
  max-width: 100%;
}

@media (max-width: 640px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
