:root { --ease-out: cubic-bezier(.22, 1, .36, 1); }

html { -webkit-tap-highlight-color: transparent; scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Red de seguridad: nada puede ensanchar la página en móvil (clip no rompe position: sticky) */
html, body { max-width: 100%; overflow-x: clip; }
#view > * , #view .grid > * { min-width: 0; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
details > summary::-webkit-details-marker { display: none; }
/* Selectores de fecha nativos (iOS): alto y alineación consistentes con el resto de inputs */
input[type="date"] { -webkit-appearance: none; appearance: none; min-height: 2.75rem; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }

/* ---------- Skeleton ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #ececee;
  border-radius: .5rem;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Entradas de vista ---------- */
.view-fade { animation: fadeIn .2s ease-out both; }
.view-enter .reveal {
  animation: fadeUp .32s var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), 8) * 30ms);
}
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.leave { animation: leave .28s ease-in both; pointer-events: none; }
@keyframes leave { to { opacity: 0; transform: translateX(18px) scale(.97); } }

details[open] .details-body { animation: fadeUp .3s var(--ease-out) both; }
details[open] .details-chevron { transform: rotate(90deg); }
.details-chevron { transition: transform .25s var(--ease-out); }

/* ---------- Modal / bottom sheet ---------- */
.modal-backdrop { animation: fadeIn .2s ease-out both; }
.modal-panel    { animation: sheetUp .4s var(--ease-out) both; }
.closing .modal-backdrop { animation: fadeOut .2s ease-in both; }
.closing .modal-panel    { animation: sheetDown .22s ease-in both; }
@keyframes sheetUp   { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@media (min-width: 640px) {
  .modal-panel { animation-name: zoomIn; }
  .closing .modal-panel { animation-name: zoomOut; }
}
@keyframes zoomIn  { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes zoomOut { to { opacity: 0; transform: scale(.97); } }

/* ---------- Padrón virtual ---------- */
.padron-overlay { animation: fadeIn .25s ease-out both; }
.padron-overlay.closing { animation: fadeOut .2s ease-in both; }
.padron-pop { animation: zoomIn .45s var(--ease-out) both; }

/* ---------- Toast ---------- */
.toast     { animation: toastIn .4s var(--ease-out) both; }
.toast.out { animation: toastOut .25s ease-in both; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.96); } }

/* ---------- Varios ---------- */
.tab-indicator { transition: transform .4s var(--ease-out); }
.progress-bar  { transition: width 1s var(--ease-out); }
.splash { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

.blob { animation: float 14s ease-in-out infinite; }
.blob-2 { animation-delay: -7s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.1); }
}

/* ---------- Impresión del padrón ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; overflow: visible !important; }
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-area { position: fixed; left: 0; top: 0; width: 100%; max-width: 160mm; box-shadow: none !important; }
  .padron-overlay { background: #fff !important; backdrop-filter: none !important; }
  .modal-panel, .modal-backdrop { animation: none !important; box-shadow: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}
