/* VeciParking · tema común (rediseño estilo red social).
   Paleta: azules, verdes, grises, blanco y negro (solo para texto). Sin café.
   Modo oscuro automático según el teléfono: se reasignan las clases de Tailwind que usa la app. */

.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 9999px; font-weight: 700; letter-spacing: .02em; }
.chip { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; border-radius: 9999px; border: 1px solid #d1d5db; background: #fff; padding: .4rem .8rem; font-weight: 500; color: #1f2937; transition: background-color .15s, border-color .15s; }
.chip:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.pestanas { position: sticky; top: 0; z-index: 15; display: flex; gap: .25rem; overflow-x: auto; background: inherit; }
.pestanas button { white-space: nowrap; border-bottom: 2px solid transparent; padding: .65rem .85rem; font-size: .875rem; font-weight: 600; color: #6b7280; }
.pestanas button[aria-selected="true"] { border-color: #1d4ed8; color: #1d4ed8; }
.cifra { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.cifra b { font-size: 1.15rem; }
.cifra span { font-size: .7rem; color: #6b7280; }
.anillo-buen_vecino { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #16a34a; }
.anillo-observacion { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #2563eb; }
.anillo-conflictivo { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #374151; }

/* Foco del teclado: anillo común bien visible (WCAG 2.4.7 / 2.4.13). Solo con teclado (:focus-visible). */
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
/* Texto de ayuda en campos: legible (4,8:1) en vez del gris claro por defecto. */
html input::placeholder, html textarea::placeholder { color: #64748b; opacity: 1; } /* «html» le gana al preflight de Tailwind, que carga después */
.bg-blue-700 :focus-visible, header :focus-visible { outline-color: #ffffff; }

/* Movimiento sutil: solo si la persona no pidió reducirlo */
@media (prefers-reduced-motion: no-preference) {
  .entrada { animation: entrada .28s ease-out both; }
  .pulso { animation: pulso .35s ease-out; }
  .check-ok { animation: check .45s ease-out both; }
  @keyframes entrada { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  @keyframes pulso { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
  @keyframes check { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
}

/* ---------- Modo oscuro ---------- */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; }
  body.bg-gray-100, .bg-gray-100 { background-color: #0b1220 !important; }
  .bg-white, .bg-white\/95 { background-color: #111a2e !important; }
  .bg-gray-50 { background-color: #16213a !important; }
  .bg-gray-200 { background-color: #1f2a44 !important; }
  .text-gray-900, .text-gray-800 { color: #e5e7eb !important; }
  .text-gray-700 { color: #cbd5e1 !important; }
  .text-gray-600, .text-gray-500 { color: #94a3b8 !important; }
  .text-gray-400 { color: #8b9bb4 !important; }
  .border-gray-100, .border-gray-200, .border-gray-300, .divide-gray-100 > * + *, .divide-gray-200 > * + * { border-color: #24324f !important; }
  .bg-blue-50 { background-color: #10244a !important; }
  .bg-blue-100 { background-color: #15306a !important; }
  .text-blue-900, .text-blue-800 { color: #bfdbfe !important; }
  .text-blue-700 { color: #93c5fd !important; }
  .border-blue-200 { border-color: #1e3a8a !important; }
  .bg-green-50, .bg-green-100 { background-color: #0f2e1f !important; }
  .text-green-900, .text-green-800, .text-green-700 { color: #86efac !important; }
  .bg-blue-700 .text-blue-100, header .text-blue-100 { color: #dbeafe !important; }
  input, select, textarea { background-color: #0f1a30 !important; color: #e5e7eb !important; border-color: #24324f !important; }
  input::placeholder, textarea::placeholder { color: #94a3b8 !important; }
  /* Estados hover: sin esto, hover:bg-white dejaba fondo blanco con texto claro (1,5:1). */
  .hover\:bg-white:hover, .hover\:bg-gray-50:hover, .hover\:bg-gray-100:hover { background-color: #1a2742 !important; }
  .hover\:bg-blue-50:hover, .hover\:bg-blue-100:hover { background-color: #15306a !important; }
  .hover\:bg-green-50:hover { background-color: #14532d !important; }
  .hover\:border-blue-300:hover { border-color: #3b82f6 !important; }
  :focus-visible { outline-color: #93c5fd; }
  .chip { background: #111a2e; border-color: #24324f; color: #e5e7eb; }
  .chip:hover { background: #10244a; border-color: #1e3a8a; color: #93c5fd; }
  .anillo-buen_vecino, .anillo-observacion, .anillo-conflictivo { --anillo-fondo: #111a2e; }
  .anillo-buen_vecino { box-shadow: 0 0 0 3px #111a2e, 0 0 0 6px #22c55e; }
  .anillo-observacion { box-shadow: 0 0 0 3px #111a2e, 0 0 0 6px #3b82f6; }
  .anillo-conflictivo { box-shadow: 0 0 0 3px #111a2e, 0 0 0 6px #94a3b8; }
  .ring-offset-2 { --tw-ring-offset-color: #111a2e !important; }
  .shadow-md, .shadow-lg { box-shadow: 0 1px 2px rgba(0,0,0,.4) !important; }
  dialog { background-color: #111a2e; color: #e5e7eb; }
  nav [data-escanear] { border-color: #111a2e !important; }
  img[src$="icon-192.png"] { filter: none; }
}
@media print { .pestanas, nav { display: none !important; } }

/* ---------- Gestión (agregado): hoja inferior, interruptor y barra de secciones ---------- */
/* Hoja inferior (Hoja.pedir en js/unidades.js y convivencia.html): reemplaza prompt() y confirm(). */
dialog.hoja { margin: auto auto 0; width: 100%; max-width: 36rem; max-height: 90dvh; overflow-y: auto; border: 0; padding: 0; border-radius: 1.25rem 1.25rem 0 0; }
dialog.hoja::backdrop { background: rgba(0, 0, 0, .6); }
@media (min-width: 640px) { dialog.hoja { margin: auto; border-radius: 1.25rem; } }
@media (prefers-reduced-motion: no-preference) {
  dialog.hoja[open] { animation: hoja-sube .22s ease-out both; }
  @keyframes hoja-sube { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
/* Interruptor (role="switch"): la fila entera es el área táctil (≥ 44 px). */
.interruptor { position: relative; display: inline-flex; flex-shrink: 0; width: 3rem; height: 1.75rem; border-radius: 9999px; background: #cbd5e1; transition: background-color .15s; }
.interruptor-bola { position: absolute; top: .2rem; left: .2rem; width: 1.35rem; height: 1.35rem; border-radius: 9999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.interruptor-on { background: #16a34a; }
.interruptor-on .interruptor-bola { transform: translateX(1.25rem); }
/* Barra de secciones de Gestión y de Faltas y multas: táctil ≥ 44 px. */
#barra-gestion button, #barra-conv button { min-height: 44px; padding-left: .7rem; padding-right: .7rem; }
.pestanas button .cuenta { display: inline-flex; min-width: 1.25rem; justify-content: center; margin-left: .35rem; border-radius: 9999px; background: #1d4ed8; padding: 0 .35rem; font-size: .75rem; line-height: 1.25rem; color: #fff; }
@media (prefers-color-scheme: dark) {
  .interruptor { background: #334155; }
  .interruptor-on { background: #16a34a; }
  .pestanas button { color: #94a3b8; }
  .pestanas button[aria-selected="true"] { border-color: #93c5fd; color: #93c5fd; }
  .bg-green-50\/50, .bg-blue-50\/60 { background-color: #10244a !important; }
  .border-green-200 { border-color: #166534 !important; }
}
dialog.hoja > form { padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); }

/* ---------- Tarjetas internas: relieve muy sutil ----------
   Las tarjetas que van dentro de una tarjeta principal llevan un brillo superior de 1 px (el «bump»)
   y una sombra corta y tenue. Sin cambiar colores, bordes ni contraste. Campos y botones no se tocan. */
.shadow-md :is(div, li, section, details, label, ul, figure).rounded-xl.border,
.shadow-md :is(div, li, section, details, ul).rounded-2xl.border,
.shadow-sm :is(div, li, section, details, ul).rounded-xl.border {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 1px 2px rgba(15, 23, 42, .05), 0 2px 6px -2px rgba(15, 23, 42, .06);
}
@media (prefers-color-scheme: dark) {
  .shadow-md :is(div, li, section, details, label, ul, figure).rounded-xl.border,
  .shadow-md :is(div, li, section, details, ul).rounded-2xl.border,
  .shadow-sm :is(div, li, section, details, ul).rounded-xl.border {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 1px 2px rgba(0, 0, 0, .35), 0 2px 6px -2px rgba(0, 0, 0, .3);
  }
}
