html { font-size: 17px; }
body { -webkit-tap-highlight-color: transparent; padding-bottom: 80px; }
button { min-height: 52px; font-size: 1rem; font-weight: 600; }
input, textarea, select { font-size: 1rem; min-height: 52px; }
textarea { min-height: 90px; }
/* Placeholder con el gris del sistema (--muted, 6,26:1 sobre blanco). El gris por defecto de Tailwind medía 2,54:1. */
/* "html" delante: app.css (preflight de Tailwind) carga después con la misma especificidad y ponía #9ca3af. */
html input::placeholder, html textarea::placeholder { color: rgb(var(--muted, 91 97 104)); opacity: 1; }
/* Arriba, sobre la barra de la pantalla (no sobre el título de la primera tarjeta ni sobre el botón de abajo). */
/* Posición real la fija utils.js placeToast (toast-core.js toastPlacement): ENCIMA de lo fijo de abajo (botón
   principal o barra) y centrado en la columna de contenido. Historia: abajo tapaba el botón (ronda 1), arriba el título
   de la primera tarjeta (ronda 3) y la cabecera con volver/Edit (ronda 4). Este top es sólo el respaldo sin JS. */
.toast { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(92vw, 560px); display: flex; align-items: center; gap: 10px; background: #15803d; color: #fff; padding: 8px 14px; border-radius: 12px; font-size: 0.95rem; font-weight: 600; line-height: 1.35; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 999; animation: slideUp .3s ease; }
/* Colores por tipo: contraste medido en tests/unit/toast.test.mjs (success 5,02 · error 6,47 · warn 8,15). */
.toast-success { background: #15803d; color: #fff; pointer-events: none; } /* no bloquea: el toque pasa a lo de abajo */
/* Texto de error que cambia con el modo (token --bad): el red-700 fijo daba ~2,9:1 sobre el papel oscuro. */
.text-bad { color: rgb(var(--bad)); }
.toast-error { background: #b91c1c; color: #fff; }
.toast-warn { background: #fef3c7; color: #78350f; border: 2px solid #f59e0b; }
.toast-icon { display: inline-flex; flex: none; }
/* Ronda 15: en la hoja de "More" el globo va junto a su etiqueta (no en left:50% como en la barra). */
/* Ronda 17: al llevar un campo a la vista (foco, Tab), que no quede debajo del botón fijo ni de la barra de abajo. */
.jd input, .jd select, .jd textarea { scroll-margin-top: 96px; scroll-margin-bottom: 170px; }
.nav-badge.nav-badge-inline { position: static; margin-left: 8px; box-shadow: none; }
/* Ronda 13: "Try again" dentro del aviso de error: 48 px, borde del color del texto (blanco sobre el rojo, 6,47:1). */
.toast > span:not(.toast-icon) { text-wrap: pretty; }
/* Con "Try again": el botón baja a una segunda fila (alineado con el texto) y el texto conserva su ancho: 1–2 líneas
   a 390 (al lado del botón quedaban 4). La X sigue en la primera fila. */
.toast-has-retry { flex-wrap: wrap; }
.toast-has-retry > span:not(.toast-icon) { flex: 1 1 calc(100% - 100px); }
.toast-has-retry .toast-retry { order: 5; margin-left: 30px; }
.toast-retry { flex: none; min-height: 48px; padding: 0 14px; border: 2px solid currentColor; border-radius: 10px; background: transparent; color: inherit; font-weight: 700; white-space: nowrap; }
.toast-close { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; margin: -10px -10px -10px 0; background: transparent; color: inherit; font-size: 1.1rem; border-radius: 10px; flex: none; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.pulse { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.chip { flex-shrink: 0; padding: 8px 16px; border-radius: 999px; border: 2px solid transparent; font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.chip:active { transform: scale(.95); }
.hide-scroll::-webkit-scrollbar { display: none; }
.hide-scroll { -ms-overflow-style: none; scrollbar-width: none; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: rgb(var(--card)); border-top: 1px solid rgb(var(--line)); display: flex; justify-content: space-around; padding: 8px 0; z-index: 50; box-shadow: 0 -4px 20px rgba(0,0,0,.08); }
/* Íconos Lucide (2026-10-08). Activo: ink + barra hi-vis arriba (forma, no sólo color). Inactivo: muted (6,3:1). */
.bottom-nav button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 4px 4px; font-size: .875rem; font-weight: 600; color: rgb(var(--muted)); background: transparent; border: none; cursor: pointer; font-family: Inter, system-ui, sans-serif; }
.bottom-nav button.active { color: rgb(var(--ink)); }
.bottom-nav > button.active::before { content: ''; position: absolute; top: -9px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: rgb(var(--hivis)); }
.bottom-nav button:focus-visible { outline: 2px solid rgb(var(--ink)); outline-offset: -2px; border-radius: 10px; }
.bottom-nav button .nav-icon { display: grid; place-items: center; line-height: 1; }
.bottom-nav button .nav-icon svg { transition: transform .15s ease; }
.bottom-nav button:active .nav-icon svg { transform: scale(.92); }
@media (prefers-reduced-motion: reduce) { .bottom-nav button .nav-icon svg { transition: none; } }
/* Celular: con más de 5 secciones se muestran 4 + "More" (hoja con el resto). Escritorio: barra lateral con todo. */
.bottom-nav .nav-more { display: none; }
@media (max-width: 767px) {
  .bottom-nav .nav-extra { display: none; }
  .bottom-nav .nav-more { display: flex; }
}
.nav-sheet { margin: auto 0 0; width: 100%; max-width: 100%; border: 0; border-radius: 20px 20px 0 0; padding: 8px 16px max(16px, env(safe-area-inset-bottom)); background: rgb(var(--card)); color: rgb(var(--ink)); }
.nav-sheet::backdrop { background: rgba(15, 23, 42, .45); }
.nav-sheet-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; padding: 4px 0 8px; }
.nav-sheet-head button { min-width: 48px; min-height: 48px; font-size: 1.1rem; border-radius: 12px; }
.nav-sheet ul { display: grid; gap: 4px; }
/* La hoja vive dentro de .bottom-nav: hay que pisar el estilo de los botones de la barra (columna, centrado, gris). */
.bottom-nav .nav-sheet button { flex: none; flex-direction: row; min-height: 48px; color: rgb(var(--ink)); }
.bottom-nav .nav-sheet li button { width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 12px; min-height: 56px; padding: 0 12px; border-radius: 12px; font-weight: 600; font-size: 1rem; text-align: left; }
html.dark .bottom-nav .nav-sheet button { color: rgb(243 242 238); }
.bottom-nav .nav-sheet li button[aria-current="page"] { background: rgb(var(--paper)); box-shadow: inset 3px 0 0 rgb(var(--hivis)); }
.bottom-nav .nav-sheet li button .nav-sheet-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: rgb(var(--paper)); color: rgb(var(--ink)); }
html.dark .nav-sheet { background: rgb(30 33 37); color: rgb(243 242 238); }
/* Ronda 13: calendario con los tokens (claro y oscuro). Hoy = anillo de tinta; con trabajos = borde slate-500 (4,76:1)
   y el número en tinta; elegido = tinta llena. Antes azules fijos (#3b82f6, 3,68:1) sin versión oscura. */
.cal-day { aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 4px; color: rgb(var(--ink)); background: transparent; border: 2px solid transparent; }
.cal-day:hover { background: rgb(var(--paper)); }
.cal-day.today { box-shadow: inset 0 0 0 2px rgb(var(--ink)); font-weight: 700; }
.cal-day.has-jobs { border-color: rgb(100 116 139); }
html.dark .cal-day.has-jobs { border-color: rgb(138 144 153); }
.cal-day .day-num { font-size: 1rem; font-weight: 600; }
.cal-day .day-count { font-size: .875rem; font-weight: 700; color: rgb(var(--muted)); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: white; border-radius: 20px; padding: 24px; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }

/* Kanban */
.kanban-col { min-width: 260px; flex-shrink: 0; }
.kanban-card { background: white; border: 2px solid #e2e8f0; border-radius: 16px; padding: 12px; margin-bottom: 8px; cursor: pointer; }

/* Controles nativos (flechas del número, ícono del calendario, barras de scroll) en el tema de la página: sin esto el
   campo de precio mostraba un recuadro blanco en oscuro y el ícono de la fecha casi no se veía (jueces, ronda 5). */
html { color-scheme: light; }
html.dark { color-scheme: dark; }
/* Dinero no se ajusta con flechitas de 0,01: sin spinners (en oscuro eran lo más brillante de la pantalla). */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ==================== MODO OSCURO, POR CLASE DE COLOR ====================
   Ronda 7 (jueces 2026-10-14): los remapeos por pantalla dejaban huecos (amber-800 a 1,97:1, slate-600 a 2,43:1).
   Ahora cada clase de color de Tailwind que usa js/ tiene su equivalente oscuro, sobre los grises GRAFITO de los
   tokens (papel 18 20 23 · tarjeta 30 33 37 · línea 52 57 64), no el azul pizarra de antes (tres negros sin relación).
   Valores medidos contra la tarjeta (≥ 4,5:1 texto, ≥ 3:1 bordes de campo); los verifica la auditoría automática de
   contraste en cada captura. La pantalla nueva puede usar tokens (text-muted, bg-card) o estas clases: las dos andan. */
html.dark body { background: rgb(18 20 23); color: rgb(243 242 238); }
html.dark .bg-white { background: rgb(30 33 37) !important; }
html.dark .bg-slate-50, html.dark .bg-gray-50 { background: rgb(24 26 30) !important; }
html.dark .bg-slate-100, html.dark .bg-gray-100 { background: rgb(36 40 45) !important; }
html.dark .bg-slate-200, html.dark .bg-gray-200 { background: rgb(44 48 54) !important; }
html.dark .bg-slate-400, html.dark .bg-slate-500 { background: rgb(108 114 122) !important; }
html.dark .bg-slate-700, html.dark .bg-slate-800 { background: rgb(52 57 64) !important; }
html.dark .bg-slate-900 { background: rgb(11 12 14) !important; }
/* Texto gris: 900/800 = tinta clara (14,4:1 en tarjeta); 700 = 11:1; 600/500/400 = muted (7,1:1 tarjeta, 8,0:1 papel). */
html.dark .text-slate-900, html.dark .text-slate-800 { color: rgb(243 242 238) !important; }
html.dark .text-slate-700, html.dark .text-gray-700 { color: rgb(214 211 206) !important; }
html.dark .text-slate-600, html.dark .text-slate-500, html.dark .text-slate-400, html.dark .text-gray-500 { color: rgb(167 172 179) !important; }
html.dark .text-slate-300 { color: rgb(167 172 179) !important; }
/* Bordes: los finos (100–300) son líneas; 400/500 delimitan campos (≥ 3:1 en tarjeta y papel). */
html.dark .border-slate-100, html.dark .border-slate-200, html.dark .border-slate-300, html.dark .border-gray-300, html.dark .divide-slate-200 > * + * { border-color: rgb(52 57 64) !important; }
html.dark .border-slate-400, html.dark .border-slate-500 { border-color: rgb(138 144 153) !important; }
html.dark .border-slate-900 { border-color: rgb(243 242 238) !important; }
/* Colores con significado: texto claro del mismo tono (≥ 6:1 sobre su tinte y sobre la tarjeta). */
html.dark body:not(.public-view) :is(.text-amber-900, .text-amber-800, .text-amber-700, .text-amber-600) { color: rgb(252 211 77); }
html.dark body:not(.public-view) :is(.text-green-900, .text-green-800, .text-green-700, .text-green-600) { color: rgb(134 239 172); }
html.dark body:not(.public-view) :is(.text-red-900, .text-red-800, .text-red-700, .text-red-600, .text-red-500) { color: rgb(252 165 165); }
html.dark body:not(.public-view) :is(.text-blue-900, .text-blue-800, .text-blue-700, .text-blue-600) { color: rgb(147 197 253); }
html.dark body:not(.public-view) :is(.text-purple-900, .text-purple-800, .text-purple-700, .text-purple-600, .text-violet-900) { color: rgb(196 181 253); }
html.dark body:not(.public-view) .text-orange-800 { color: rgb(253 186 116); }
/* Tintes de fondo (-50/-100): translúcidos sobre grafito, en vez de parches crema que encandilan. */
html.dark body:not(.public-view) :is(.bg-amber-50, .bg-amber-100) { background-color: rgb(245 158 11 / .16); }
html.dark body:not(.public-view) :is(.bg-green-50, .bg-green-100) { background-color: rgb(34 197 94 / .16); }
html.dark body:not(.public-view) :is(.bg-red-50, .bg-red-100) { background-color: rgb(239 68 68 / .16); }
html.dark body:not(.public-view) :is(.bg-blue-50, .bg-blue-100) { background-color: rgb(59 130 246 / .18); }
html.dark body:not(.public-view) :is(.bg-purple-50, .bg-purple-100, .bg-violet-50) { background-color: rgb(139 92 246 / .2); }
html.dark body:not(.public-view) .bg-orange-100 { background-color: rgb(249 115 22 / .18); }
/* Bordes de color (200/300/400): el tono a media opacidad, no el pastel claro que brillaba más que los campos. */
html.dark body:not(.public-view) :is(.border-amber-200, .border-amber-300) { border-color: rgb(245 158 11 / .5); }
html.dark body:not(.public-view) :is(.border-green-200, .border-green-300, .border-green-400) { border-color: rgb(34 197 94 / .5); }
html.dark body:not(.public-view) .border-red-300 { border-color: rgb(239 68 68 / .5); }
html.dark body:not(.public-view) :is(.border-blue-200, .border-blue-300) { border-color: rgb(59 130 246 / .5); }
html.dark body:not(.public-view) .border-purple-300 { border-color: rgb(139 92 246 / .5); }
html.dark body:not(.public-view) .border-orange-300 { border-color: rgb(249 115 22 / .5); }
/* Barra de navegación, hoja y modales: los mismos grises de los tokens que el resto de la app. */
html.dark .bottom-nav { background: rgb(30 33 37); border-top-color: rgb(52 57 64); }
html.dark .bottom-nav button { color: rgb(167 172 179); }
html.dark .bottom-nav button.active { color: rgb(243 242 238); }
html.dark .modal { background: rgb(30 33 37); }
html.dark .kanban-card { background: rgb(30 33 37); border-color: rgb(52 57 64); }

.cal-day.selected { background: rgb(var(--ink)) !important; color: rgb(var(--paper)) !important; border-color: rgb(var(--ink)); font-weight: 700; }
.cal-day.selected .day-count { color: rgb(var(--paper)); }


/* ==================== DESKTOP UI ==================== */
@media (min-width: 768px) {
  html { font-size: 17px; }
  body { padding-bottom: 0; }

  /* Sidebar nav */
  .bottom-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: 220px;
    flex-direction: column;
    justify-content: flex-start;
    padding: 12px 0;
    border-top: none;
    border-right: 1px solid rgb(var(--line));
    box-shadow: none;
    overflow-y: auto;
  }
  /* En la barra lateral los ítems no se estiran a toda la altura (antes quedaban a ~100 px uno de otro). */
  .bottom-nav button {
    flex: none;
    min-height: 48px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 20px;
    min-width: 0 !important;
    width: 100%;
    font-size: 1rem;
    border-radius: 0;
  }
  /* Barra lateral: el activo se marca con fondo paper y la barra hi-vis a la izquierda (no arriba). */
  .bottom-nav > button.active::before { top: 8px; bottom: 8px; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .bottom-nav button.active { background: rgb(var(--paper)); }

  /* Content area */
  #app {
    max-width: none !important;
    margin-left: 220px;
    width: calc(100% - 220px);
  }

  /* Paddings moderados */
  #app .p-5 { padding: 20px 24px; }
  #app .p-6 { padding: 24px; }
  #app .max-w-2xl { max-width: 900px; }
  #app .max-w-md { max-width: 500px; }

  /* Botones */
  button { min-height: 52px; font-size: 1rem; }
  input, textarea, select { font-size: 1rem; min-height: 52px; }

  /* Modal */
  .modal { max-width: 720px !important; padding: 32px; }

  /* Header sticky del jobDetail/form/etc */
  .sticky.top-0 { border-radius: 0; }

  /* Calendar: celdas adaptadas */
  .cal-day {
    aspect-ratio: auto;
    min-height: 80px;
    max-height: 90px;
  }
  .cal-day .day-num { font-size: 1.1rem; }
  .cal-day .day-count { font-size: .875rem; }
}

@media (min-width: 1100px) {
  .bottom-nav { width: 240px; }
  #app { margin-left: 240px; width: calc(100% - 240px); }
  #app .p-5 { padding: 24px 32px; }
}

/* Dark mode ajustes */
html.dark .bottom-nav {
  background: rgb(30 33 37);
  border-right-color: rgb(52 57 64);
}
/* Ronda 8: el fondo de la pestaña activa sólo en el lateral (≥768), como en claro. En el teléfono pintaba un
   rectángulo oscuro de ~78 px pegado al borde que en claro no existe. */
@media (min-width: 768px) {
  html.dark .bottom-nav button.active { background: rgb(18 20 23); }
}
/* Ronda 9: barras del gráfico. En oscuro --ink es casi blanco y la barra encandilaba: gris medio (--muted, 7,08:1 medido
   sobre la tarjeta, sobra para el 3:1 de un objeto gráfico). */
.chart-bar { background: rgb(var(--ink)); }
html.dark .chart-bar { background: rgb(var(--muted)); }
/* Ronda 9: casilla propia (la nativa no expone su borde y la auditoría no la podía medir). Borde slate-500
   (4,76:1 sobre blanco); marcada = tinta con tilde del color del papel. */
/* min-height: 0: el input{min-height:52px} global ganaba al height y la casilla salía de 22×52 (ronda 11). El área
   tocable de 48 px la da la <label> que la envuelve. */
.jd-check { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; min-height: 0; margin: 0; border: 2px solid rgb(100 116 139); border-radius: 6px; background: rgb(var(--card)) center / 16px no-repeat; cursor: pointer; }
.jd-check:checked { background-color: rgb(var(--ink)); border-color: rgb(var(--ink)); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
html.dark .jd-check { border-color: rgb(148 163 184); }
html.dark .jd-check:checked { border-color: rgb(var(--ink)); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23121417' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
/* Landing y vistas públicas sin sidebar */
@media (min-width: 768px) {
  body.public-view #app {
    margin-left: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }
  body.public-view .bottom-nav { display: none !important; }
}
/* ==================== ANIMATIONS & POLISH ==================== */

/* Page transition */
#app > div {
  animation: pageFadeIn 0.25s ease-out;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Button press feedback */
button:not(:disabled):active {
  transform: scale(0.97);
  transition: transform 0.1s;
}

/* Modal animations */
.modal-bg {
  animation: modalFadeIn 0.2s ease-out;
}
.modal {
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Toast animation upgrade */
.toast {
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -16px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Card hover on desktop */
@media (hover: hover) and (min-width: 768px) {
  #jobList > div:hover,
  .card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    transition: all 0.2s ease;
  }
  #jobList > div {
    transition: all 0.2s ease;
  }
}

/* Stagger-in lists */
.stagger-in > * {
  animation: fadeSlideUp 0.3s ease-out backwards;
}
.stagger-in > *:nth-child(1) { animation-delay: 0.02s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.04s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.06s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.08s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.10s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.12s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.14s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.16s; }
.stagger-in > *:nth-child(n+9) { animation-delay: 0.18s; }
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Success pulse (para cuando completás algo) */
@keyframes checkPulse {
  0% { transform: scale(0.6); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.success-pulse {
  animation: checkPulse 0.5s ease-out;
}

/* Accessibility: si el usuario prefiere menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* ==================== SKELETON LOADERS ==================== */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: 12px;
}
html.dark .skeleton {
  background: linear-gradient(90deg, rgb(30 33 37) 25%, rgb(52 57 64) 50%, rgb(30 33 37) 75%);
  background-size: 200% 100%;
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==================== NAV BADGE ==================== */
.bottom-nav button {
  position: relative;
}
.nav-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 8px;
  /* Ronda 14: 12 px blanco sobre #b91c1c = 6,47:1 (antes 10 px sobre #ef4444 = 3,76:1). Igual en claro y oscuro: en
     oscuro --bad es un rojo claro y el blanco encima no llegaría. */
  background: #b91c1c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 0 2px white;
}
html.dark .nav-badge {
  box-shadow: 0 0 0 2px rgb(30 33 37);
}

/* Campo inválido (ronda 7): borde --bad visible (no sólo el texto de abajo) y el mensaje con un ícono de alerta. */
.jd [aria-invalid="true"] {
  border-color: rgb(var(--bad)) !important;
  box-shadow: 0 0 0 1px rgb(var(--bad)) !important;
}
#desc_err:not(.hidden), #price_err:not(.hidden) {
  display: flex; align-items: flex-start; gap: .375rem;
}
#desc_err::before, #price_err::before {
  content: ""; flex: none; width: 1.1em; height: 1.1em; margin-top: .1em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Ronda 20: el icono de una cabecera de tarjeta no se encoge (medía 19 px junto a títulos largos). */
[data-card-h] > svg { flex-shrink: 0; }

/* Ronda 21: cabecera de tarjeta: el icono se alinea con la PRIMERA línea del título (antes centrado en dos líneas)
   y un solo espacio título → contenido en todas las tarjetas (0.75rem). La cifra va en una píldora a la derecha. */
[data-card-h] { align-items: flex-start !important; }
[data-card-h] > svg { margin-top: calc((1.75rem - 1.25rem) / 2); }
section > [data-card-h], .rounded-2xl:not(summary) > [data-card-h] { margin-bottom: 0 !important; }
section > [data-card-h] + *, .rounded-2xl:not(summary) > [data-card-h] + * { margin-top: .75rem !important; }
.count-pill { display: inline-flex; align-items: center; margin-top: .2rem; min-width: 1.75rem; justify-content: center; border-radius: 9999px; padding: 0 .5rem; font-size: .875rem; line-height: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; color: rgb(var(--muted)); background: rgb(var(--paper)); box-shadow: inset 0 0 0 1px rgb(var(--line)); }
/* Ronda 21: un campo bloqueado se lee cerrado aunque el aviso quede arriba: candado a la derecha sobre el papel. */
.jd [data-locked] { background-color: rgb(var(--paper)); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6168' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem top .95rem; background-size: 1.15rem; padding-right: 2.75rem; }
/* Ronda 21: sin palabras huérfanas en las ayudas y párrafos. */
#app p { text-wrap: pretty; }
/* Ronda 21: el botón fijo no "sube" al final del scroll (medido: 129 px a 390). Debajo de su caja queda justo su
   distancia fija: 8 px + 80 px del body = 88 px en el teléfono; 0 desde 768 px (bottom-0, sin barra abajo). */
main:has(> [data-sticky-cta]:last-child) { padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
.jd:has(> main > [data-sticky-cta]:last-child) { padding-bottom: 0 !important; }
@media (min-width: 768px) { main:has(> [data-sticky-cta]:last-child) { padding-bottom: 0 !important; } }
/* Ronda 22: las ayudas y consejos (texto chico gris) se equilibran: sin una palabra sola en la última línea. */
#app p.text-sm.text-muted, #app [data-hint-for], #app #desc_hint { text-wrap: balance; }
/* Ronda 22: en oscuro, el chevron y el candado con el gris de oscuro (#A7ACB3): con #5B6168 medían 2,58:1 y 2,95:1. */
html.dark .jd select.appearance-none { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A7ACB3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html.dark .jd [data-locked] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A7ACB3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E"); }
/* Ronda 22: un campo bloqueado no se estira y la fecha no muestra su calendario nativo (quedaba bajo el candado). */
.jd textarea[data-locked] { resize: none; }
.jd input[data-locked]::-webkit-calendar-picker-indicator { display: none; }
/* Ronda 22: segunda señal de "cerrado" además del candado: la palabra "Locked" junto a la etiqueta (una señal de
   texto, que no depende del color; un relleno distinto no llegaba a 1,3:1 contra la tarjeta sin parecer error). */
.locked-tag { display: inline-flex; align-items: center; gap: .25rem; margin-left: .5rem; padding: 0 .5rem; border-radius: 9999px; font-size: .875rem; line-height: 1.5rem; font-weight: 600; color: rgb(var(--muted)); box-shadow: inset 0 0 0 1px rgb(var(--line)); vertical-align: middle; }
/* Ronda 23: la caja de fotos bloqueada lleva el mismo fondo de papel que los campos bloqueados. */
.jd [data-locked-box] { background-color: rgb(var(--paper)); }
