:root {
  --page-bg: #FFFFFF;
  --bg: #E3E8F1;
  --input-bg: #FFFFFF;
  --text: #2B3242;
  --muted: #6C7690;
  --accent: #4A5FE8;
  --accent-soft: #DCE1F7;
  --cat-2: #D97706;
  --positive: #1E9A63;
  --negative: #D94F63;
  --warning: #B87F16;
  --shadow-light: #FFFFFF;
  --shadow-dark: #A9B4C9;
  --radius: 16px;
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2.25rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #0B0D12;
    --bg: #1D2230;
    --input-bg: #1D2230;
    --text: #E7EAF3;
    --muted: #8891A6;
    --accent: #7089FF;
    --accent-soft: #222841;
    --cat-2: #C97A38;
    --positive: #3ECF8E;
    --negative: #FF6B7E;
    --warning: #F0B942;
    --shadow-light: #2A3145;
    --shadow-dark: #0E1119;
  }
}
:root[data-theme="dark"] {
  /* US-043 (2-ago): --page-bg #000 puro contra las cards #1D2230 creaba
     "islas flotantes" (salto de contraste 1.32:1 entre fondo y tarjeta,
     demasiado brusco); #0B0D12 lo suaviza sin perder negro real. Medido con
     WCAG: --accent-soft #2B3352 original daba 3.91-3.95:1 con el texto de
     los badges (inventario/publicada) — por debajo del 4.5:1 de AA. Con
     #222841 los 5 colores de badge pasan AA (4.41-7.78:1), igual que el
     enlace activo del nav y rec-price, que comparten el token. */
  --page-bg: #0B0D12;
  --bg: #1D2230;
  --input-bg: #1D2230;
  --text: #E7EAF3;
  --muted: #8891A6;
  --accent: #7089FF;
  --accent-soft: #222841;
  --cat-2: #C97A38;
  --positive: #3ECF8E;
  --negative: #FF6B7E;
  --warning: #F0B942;
  --shadow-light: #2A3145;
  --shadow-dark: #0E1119;
}
:root[data-theme="light"] {
  --page-bg: #FFFFFF;
  --bg: #E3E8F1;
  --input-bg: #FFFFFF;
  --text: #2B3242;
  --muted: #6C7690;
  --accent: #4A5FE8;
  --accent-soft: #DCE1F7;
  --cat-2: #D97706;
  --positive: #1E9A63;
  --negative: #D94F63;
  --warning: #B87F16;
  --shadow-light: #FFFFFF;
  --shadow-dark: #A9B4C9;
}

* { box-sizing: border-box; }
html { font-feature-settings: "tnum" 1; }
body {
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
.mono { font-variant-numeric: tabular-nums; }

/* US-027 (1-ago): sin regla base, los enlaces sueltos caían al azul de
   user-agent por defecto — casi negro sobre fondo oscuro, el peor problema
   de legibilidad en modo oscuro. En celdas de tabla/tarjeta, subrayado solo
   al pasar el ratón para no ensuciar listas densas con líneas por todas
   partes (fuera de ahí conservan el subrayado normal). */
a { color: var(--accent); }
a:visited { color: var(--accent); }
td a, .item-card-row a { text-decoration: none; }
td a:hover, .item-card-row a:hover, td a:focus-visible, .item-card-row a:focus-visible { text-decoration: underline; }

/* ---- primitivas neomorficas ---- */
.raised {
  background: var(--bg);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
}
.pressed {
  background: var(--bg);
  box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light);
}
.flat-ring {
  background: var(--bg);
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

/* US-146 (3-ago): rediseño del header — de 16 enlaces planos (fila que
   forzaba scroll horizontal) a 4 grupos en dropdown + menú de cuenta,
   mismo ancho máximo que el resto de la web (antes el nav iba de borde a
   borde con márgenes fijos, mientras .container quedaba centrado a
   1100px — visualmente dos anchos distintos en la misma página). Los
   enlaces de baja frecuencia ("Cómo funciona") bajan al footer nuevo. */
.nav {
  background: var(--bg);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-5);
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}
.nav .brand {
  color: var(--text);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  padding: var(--space-2) var(--space-2);
  flex-shrink: 0;
  text-decoration: none;
}
.nav .brand:hover { color: var(--text); background: none; }

/* Dropdowns: <details>/<summary> nativo — accesible por teclado sin JS
   propio, mismo patrón ya usado en "Configuración avanzada" (cuentas.html)
   y "Apuntar mensaje a mano" (bandeja.html). */
.nav-dropdown { position: relative; }
.nav-dropdown summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.86rem;
  padding: var(--space-2) var(--space-3);
  border-radius: 10px;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover { color: var(--text); }
.nav-dropdown summary.active { color: var(--accent); background: var(--accent-soft); }
.nav-dropdown[open] summary { color: var(--text); background: var(--shadow-light); }
.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 6px 6px 16px var(--shadow-dark), -6px -6px 16px var(--shadow-light);
  padding: var(--space-2);
}
.nav-dropdown-panel-right { left: auto; right: 0; }
.nav-dropdown-panel a, .nav-dropdown-panel .logout {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
  padding: var(--space-2) var(--space-3);
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-dropdown-panel a:hover { color: var(--text); background: var(--shadow-light); }
.nav-dropdown-panel a.active { color: var(--accent); background: var(--accent-soft); }
/* US-037 (2-ago): "Mensajes (3)" — glanceable desde el nav sin entrar. */
.nav-badge {
  display: inline-block;
  min-width: 1.1rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--negative);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
}
.nav-dropdown-panel .logout { margin: 0; }
.nav-dropdown-panel button {
  background: none; border: none; color: var(--negative); cursor: pointer;
  padding: var(--space-2) var(--space-3); font-family: inherit; font-size: 0.86rem;
  font-weight: 700; box-shadow: none; width: 100%; text-align: left; border-radius: 8px;
}
.nav-dropdown-panel button:hover { background: var(--shadow-light); }
.nav-dropdown-panel button:active { box-shadow: none; }

.site-footer { margin-top: var(--space-6); padding: var(--space-5) 0 var(--space-6); }
.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-5) 0;
  border-top: 1px solid var(--shadow-dark);
  flex-wrap: wrap;
}
.site-footer-inner a { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 0.85rem; }
.site-footer-inner a:hover { color: var(--text); }
.site-footer-inner a.active { color: var(--accent); }
.site-footer-meta { color: var(--muted); font-size: 0.78rem; }

.theme-toggle {
  width: 50px;
  height: 28px;
  padding: 3px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}
.theme-toggle .thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}
:root[data-theme="dark"] .theme-toggle .thumb { transform: translateX(22px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .thumb { transform: translateX(22px); }
}

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  padding: 0.3rem;
}
.table-scroll table { margin-top: 0; }
/* US-029 (1-ago): la tabla de /piezas (la pantalla más usada) partía
   descripciones en 6-8 líneas y desalineaba los importes — 1 línea con
   elipsis (título completo al pasar el ratón) + dinero a la derecha sin
   partirse en dos líneas. */
@media (min-width: 641px) {
  [data-col="descripcion"] { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  [data-col="coste"], [data-col="precio"], [data-col="beneficio"] { text-align: right; white-space: nowrap; }
}
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.015em; line-height: 1.25; margin: 0 0 var(--space-1); display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-top: var(--space-6); margin-bottom: var(--space-2); font-weight: 800; }
.cards { display: flex; gap: 1rem; flex-wrap: wrap; margin: var(--space-4) 0; }
.card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  padding: 1rem 1.2rem;
  min-width: 180px;
  flex: 1;
}
a.card { display: block; color: inherit; text-decoration: none; }
.hoy-panel .cards { margin: 0.6rem 0; }
.hoy-bot-estado { margin-top: 0.4rem; }
a.card:hover { box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light); }
.card-label { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.card-value { font-size: 1.65rem; font-weight: 800; letter-spacing: -0.01em; margin: 0.2rem 0; font-variant-numeric: tabular-nums; }
.card-sub { color: var(--muted); font-size: 0.75rem; }
.card.positive .card-value { color: var(--positive); }
.card.negative .card-value { color: var(--negative); }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; font-size: 0.9rem; }
th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr:not(:last-child) td { box-shadow: inset 0 -1px 0 var(--shadow-dark); }
.btn {
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  text-decoration: none;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
}
.btn:active { box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light); }
.btn-danger { color: var(--negative); font-weight: 600; }
.btn-primary { background: var(--accent); color: white; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 0.95rem; }
.form { display: flex; flex-direction: column; gap: 0.8rem; max-width: 420px; margin-top: 1rem; }
.form-ancho { max-width: none; }
.form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
input, select, textarea, button {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light);
}
input, select, textarea { background: var(--input-bg); }
input::placeholder, textarea::placeholder { color: var(--muted); }
button {
  cursor: pointer;
  font-weight: 600;
  box-shadow: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);
}
button:active { box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light); }
textarea { min-height: 60px; }
.error { color: var(--negative); }
/* US-136 (1-ago): el error pegado al campo que lo causó, no solo un
   párrafo genérico arriba — más rápido de relacionar con qué hay que
   corregir. aria-invalid ya da el borde rojo vía la regla de abajo. */
.campo-error { font-size: 0.8rem; font-weight: 600; margin: 0.2rem 0 0; }
input[aria-invalid="true"], select[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--negative); }
.flash-msg {
  background: var(--positive); color: white; font-weight: 700;
  padding: 0.6rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
  animation: flash-desvanece 4s ease forwards;
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
}
.flash-msg-undo { animation: none; }
.flash-undo-form { margin: 0; }
.flash-undo-btn {
  background: rgba(255, 255, 255, 0.25); color: white; font-weight: 700;
  border: none; border-radius: 8px; padding: 0.25rem 0.6rem; font-size: 0.8rem; cursor: pointer;
}
.flash-undo-btn:hover { background: rgba(255, 255, 255, 0.4); }
@keyframes flash-desvanece { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
.notas { color: var(--muted); font-style: italic; }
.login-box { max-width: 320px; margin: 4rem auto; text-align: center; }
.login-box form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.filters { display: flex; gap: 0.6rem; margin-top: 0.8rem; }
.filters-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.8rem 0 1rem; }
.filters-rango { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.filters-rango label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--muted); }
.filters-rapido { display: flex; gap: 0.3rem; }
.filters-rapido button, .filters-rapido a {
  padding: 0.35rem 0.7rem; font-size: 0.78rem; border-radius: 8px; border: none; cursor: pointer;
  background: var(--bg); box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  color: var(--muted); text-decoration: none; font-family: inherit;
}
.filters-rapido a.active { color: var(--accent); font-weight: 700; }
.actions { display: flex; flex-direction: column; gap: 0.3rem; }
.inline-form { display: flex; gap: 0.3rem; }
.inline-form input { padding: 0.3rem 0.5rem; }
.inline-form button { padding: 0.3rem 0.6rem; font-size: 0.75rem; border-radius: 8px; }
/* US-031 (1-ago): mapeo de color único — nunca reusar el mismo tono para
   dos cosas distintas, si no el semáforo deja de significar algo fijo:
   --positive = dinero ganado/estado avanzado sin problema (vendida, ok)
   --negative = parada/cancelada — puede volver a intentarse (retirada)
   --warning  = pérdida real, algo roto/no vendible (merma) — tono propio,
                antes compartía rojo con retirada y eran indistinguibles
   --muted    = neutro, sin carga (inventario, cero €) */
.badge { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--accent-soft); }
.badge-inventario { color: var(--muted); }
.badge-publicada { color: var(--accent); }
.badge-vendida { color: var(--positive); }
.badge-retirada { color: var(--negative); }
.badge-merma { color: var(--warning); }
.texto-positivo { color: var(--positive); font-weight: 700; }
.texto-negativo { color: var(--negative); font-weight: 700; }
.texto-warning { color: var(--warning); font-weight: 700; }
.badge-dac7-ok { color: var(--positive); }
.badge-dac7-aviso { color: var(--warning); }
.badge-job-pending { color: var(--muted); }
.badge-job-running { color: var(--accent); }
.badge-job-done { color: var(--positive); }
.badge-job-error { color: var(--negative); }
.badge-job-cancelado { color: var(--muted); }
.job-payload {
  max-width: 320px;
  max-height: 160px;
  overflow: auto;
  font-size: 0.7rem;
  background: var(--page-bg);
  padding: 0.4rem;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.badge-dac7-superado { color: var(--negative); }
.badge-actua-vinted, .badge-solo-registro {
  display: inline-block; margin-left: 0.4rem; font-size: 0.7rem; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 999px; vertical-align: middle;
}
.badge-actua-vinted { background: var(--accent-soft); color: var(--accent); }
.badge-solo-registro { background: var(--bg); color: var(--muted); box-shadow: inset 1px 1px 2px var(--shadow-dark); }
.aviso-parada {
  color: var(--warning);
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  font-size: 0.85rem;
}
.aviso-parada a { color: var(--warning); }
.lista-retomar { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9rem; }
.photo-grid { display: flex; gap: 0.8rem; flex-wrap: wrap; margin: 0.8rem 0; }
.photo-item { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.photo-item img { width: 140px; height: 140px; object-fit: cover; border-radius: 10px; background: var(--bg); box-shadow: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light); }
/* US-034 (1-ago): las fotos "sin fondo" son PNG con transparencia real —
   sin un indicador propio, en modo oscuro el sujeto flota sobre --bg (un
   navy liso) y es fácil confundirlo con una foto normal o, si el sujeto es
   claro, con un hueco vacío. Tablero de ajedrez clásico (como
   Photoshop/GIMP) detrás, siempre visible sea cual sea el tema. */
.foto-sin-fondo {
  background-image:
    conic-gradient(#ccc 90deg, #eee 90deg 180deg, #ccc 180deg 270deg, #eee 270deg);
  background-size: 16px 16px;
  background-color: transparent;
}
.photo-item button { font-size: 0.75rem; padding: 0.3rem 0.6rem; }
.zona-badge { color: var(--accent); font-weight: 700; }
.aviso-zona-inline { color: var(--warning); font-size: 0.75rem; margin-left: 0.3rem; }
.chart-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  padding: 1rem 1.2rem;
  margin-top: 1.2rem;
}
.chart-card h2 { margin-top: 0; }

.heatmap-grid { display: flex; flex-direction: column; gap: 1.4rem; margin-top: 0.8rem; }
.heatmap-block h4 { margin: 0 0 0.3rem; font-size: 0.85rem; }

.dropzone {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--shadow-dark); border-radius: var(--radius);
  padding: 1.4rem 1rem; cursor: pointer; color: var(--muted); font-size: 0.85rem;
  transition: border-color 0.15s, color 0.15s; margin-bottom: 0.6rem;
}
.dropzone:hover, .dropzone.dropzone-over { border-color: var(--accent); color: var(--accent); }
.dropzone input[type="file"] { display: none; }

.mensaje-card { display: flex; flex-direction: column; gap: 0.5rem; }
.mensaje-card + .mensaje-card { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--shadow-dark); }
.mensaje-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.mensaje-comprador { font-weight: 700; }
.mensaje-item { color: var(--muted); font-size: 0.82rem; }
.mensaje-texto { background: var(--input-bg); border-radius: var(--radius); padding: 0.6rem 0.8rem; }
.mensaje-respuesta textarea { width: 100%; min-height: 4.5rem; resize: vertical; }
.mensaje-acciones { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
/* US-036 (1-ago): mini-card de la prenda (foto+título+precio+mínimo) para
   aprobar respuestas con criterio sin salir de /bandeja, y lenguaje de
   chat — burbuja del comprador a la izquierda, respuesta a la derecha, en
   vez de dos cajas idénticas sin jerarquía visual. */
.mensaje-pieza-mini {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.6rem;
  background: var(--bg); border-radius: 10px; color: inherit; text-decoration: none; align-self: flex-start;
}
.mensaje-pieza-mini:hover { box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light); }
.mensaje-pieza-mini-texto { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.85rem; }
.chat-hilo { display: flex; flex-direction: column; gap: 0.5rem; }
.chat-burbuja { max-width: 85%; margin: 0; }
.chat-burbuja-comprador { align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-burbuja-respuesta, .mensaje-respuesta.chat-burbuja-respuesta {
  align-self: flex-end; max-width: 85%; background: var(--accent-soft); border-radius: var(--radius); border-bottom-right-radius: 4px; padding: 0.6rem 0.8rem;
}
.chat-burbuja-respuesta textarea { background: var(--page-bg); }
/* -- animaciones de entrada, toda la plataforma (30-jul/31-jul, petición
   Alberto: "animar las diferentes partes y las gráficas le daría una
   apariencia más moderna"). Las gráficas en sí (ApexCharts, desde 1-ago)
   traen su propia animación de entrada — esto queda para tarjetas/KPIs.
   Detrás de prefers-reduced-motion para no forzar movimiento a quien no
   lo quiera. */
@media (prefers-reduced-motion: no-preference) {
  .cards .card {
    animation: pe-aparecer-arriba 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  .cards .card:nth-child(2) { animation-delay: 0.08s; }
  .cards .card:nth-child(3) { animation-delay: 0.16s; }
  .cards .card:nth-child(4) { animation-delay: 0.24s; }

  .chart-card {
    animation: pe-aparecer-arriba 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    animation-delay: 0.1s;
  }

  .item-card {
    animation: pe-aparecer-arriba 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
}

@keyframes pe-aparecer-arriba { from { opacity: 0; transform: translateY(10px); } }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-3); margin-top: 1.2rem; }
.stats-grid .chart-card { margin-top: 0; }
.analisis-resumen-compacto { font-size: 0.85rem; color: var(--muted); margin: 0.2rem 0 0.6rem; }

.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.chart-head h2 { margin-top: 0; }
.chart-head form { flex-shrink: 0; }
.sparkline { width: 110px; height: 34px; flex-shrink: 0; }

/* -- panel de análisis IA -- */
.analisis-card { margin-top: 0; }
.analisis-resumen { font-size: 0.95rem; line-height: 1.5; }
.analisis-fecha { margin-top: 1rem; font-size: 0.75rem; }
.hallazgos { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.hallazgo {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.88rem;
  background: var(--page-bg);
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}
.hallazgo-icono { flex-shrink: 0; }
.hallazgo-positivo { border-left: 3px solid var(--positive); }
.hallazgo-alerta { border-left: 3px solid var(--negative); }
.hallazgo-oportunidad { border-left: 3px solid var(--accent); }
.recomendaciones { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.9rem; line-height: 1.6; }
.hallazgos-compacto { margin: 0.5rem 0; }
.hallazgos-compacto .hallazgo { font-size: 0.82rem; padding: 0.45rem 0.7rem; }

/* -- barra de progreso (recuperación de inversión) -- */
.progress-bar { position: relative; height: 30px; border-radius: 15px; background: var(--page-bg); box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 15px; background: var(--positive); transition: width 0.4s ease; }
.progress-bar-fill.negativo { background: var(--accent); }
.progress-bar-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* -- toolbar de listas: vista tarjetas/lista + selector de columnas -- */
.list-toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-3) 0; }
.view-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg); box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light); }
.view-switch button { box-shadow: none; padding: 0.35rem 0.7rem; font-size: 0.8rem; border-radius: 8px; color: var(--muted); font-weight: 700; }
.view-switch button.active { background: var(--bg); color: var(--accent); box-shadow: 3px 3px 7px var(--shadow-dark), -3px -3px 7px var(--shadow-light); }
.view-switch button:active { box-shadow: 3px 3px 7px var(--shadow-dark), -3px -3px 7px var(--shadow-light); }

.col-toggle { position: relative; }
.col-toggle > summary { list-style: none; cursor: pointer; display: inline-block; padding: 0.5rem 0.9rem; border-radius: 10px; background: var(--bg); box-shadow: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light); font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.col-toggle > summary::-webkit-details-marker { display: none; }
.col-toggle[open] > summary { color: var(--accent); }
.col-toggle-panel { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 180px; padding: var(--space-3); border-radius: 12px; background: var(--bg); box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light); display: flex; flex-direction: column; gap: 0.4rem; }
.col-toggle-panel label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text); cursor: pointer; }
.cuenta-avanzada { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; }
.cuenta-avanzada input { margin-top: 0.3rem; }
.col-toggle-panel input { box-shadow: none; padding: 0; width: auto; }

[data-view-root][data-active-view="cards"] .list-view { display: none; }
[data-view-root][data-active-view="list"] .cards-view { display: none; }

[data-edit-root][data-mode="view"] .edit-field { display: none; }
[data-edit-root][data-mode="edit"] .view-field { display: none; }
[data-edit-root][data-mode="view"] [data-edit-btn="view"] { display: none; }
[data-edit-root][data-mode="edit"] [data-edit-btn="edit"] { display: none; }
.lot-fields { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-3) 0; }
.lot-field { display: flex; flex-direction: column; gap: 0.2rem; min-width: 150px; }
.lot-field-notas { flex-basis: 100%; }
.lot-field > span:first-child, .lot-field > label:first-child { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.lot-field > span.notas { font-size: 0.72rem; font-weight: 400; }
.lot-field > strong { font-size: 1rem; font-weight: 700; color: var(--text); }
.lot-field > input.edit-field,
.lot-field > select.edit-field,
.lot-field > textarea.edit-field {
  font: inherit; font-size: 1rem; font-weight: 700; color: var(--text);
  background: transparent; box-shadow: none; border: none;
  border-bottom: 2px solid var(--accent); border-radius: 0; padding: 0.1rem 0;
}
.lot-field > textarea.edit-field { min-height: 4.5rem; border: 2px solid var(--accent); border-radius: 10px; padding: 0.5rem; }
.tabs { display: flex; gap: 0.4rem; margin: var(--space-3) 0; border-bottom: 2px solid var(--shadow-dark); }
.tabs button { background: none; box-shadow: none; padding: 0.5rem 1rem; font-weight: 700; color: var(--muted); border-radius: 10px 10px 0 0; }
.tabs button.active { color: var(--accent); background: var(--bg); box-shadow: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light); }
.tab-panel { display: none; } /* el JS muestra la activa (style.display) al cargar, evita parpadeo inicial */

.cards-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; }
.item-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.item-card .item-card-title { font-weight: 800; font-size: 0.95rem; }
.item-card .item-card-title a { color: var(--text); text-decoration: none; }
.item-card .item-card-row { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); }
.item-card .item-card-row strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.item-card .item-card-actions { display: flex; gap: 0.5rem; margin-top: var(--space-2); }
.item-card-link { color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow 0.15s; }
.item-card-link:hover { box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light); }

/* US-028 (1-ago): navegar por foto, no solo por referencia — miniatura de
   48px en las tablas de /piezas y del lote (antes solo la tenía la vista
   tarjeta). */
.table-thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: 8px;
  background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.table-thumb-placeholder { color: var(--muted); }

.item-card-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 0.3rem;
  background: var(--page-bg);
}

/* US-035 (2-ago): "Escaparate" — foto-primero, denso, 3:4 como Vinted;
   distinto a la vista Tarjetas (ficha de datos con foto pequeña) a propósito:
   aquí la foto ES el dato, precio y aviso de parada van de overlay. */
.escaparate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0;
}
.escaparate-tile {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  border-left: 4px solid transparent;
  box-shadow: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);
  transition: box-shadow 0.15s ease;
}
.escaparate-tile:hover { box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light); }
/* US-047 (2-ago): frescura del anuncio publicado — verde <7d, ámbar 7-21d, rojo >21d */
.escaparate-tile-fresca { border-left-color: var(--positive); }
.escaparate-tile-templada { border-left-color: var(--warning); }
.escaparate-tile-parada { border-left-color: var(--negative); }
.escaparate-tile-link { display: block; }
.escaparate-tile-actions {
  padding: 0.3rem 0.5rem 0.5rem;
  text-align: right;
}
.escaparate-tile-actions button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
}
.escaparate-tile-actions button:hover { text-decoration: underline; }
.escaparate-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: var(--page-bg);
}
.escaparate-photo-placeholder { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; color: var(--muted); }
.escaparate-precio {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  box-shadow: 3px 3px 7px var(--shadow-dark), -3px -3px 7px var(--shadow-light);
}
.escaparate-edad {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}
.escaparate-edad-templada { background: var(--warning); }
.escaparate-edad-parada { background: var(--negative); }
.escaparate-titulo {
  display: block;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* US-040 (2-ago): timeline vertical de la pestaña Historial — antes tabla
   de texto plano. Punto coloreado reutiliza el mismo mapeo de color que
   los badges de estado (US-031: el color siempre significa lo mismo). */
.timeline { position: relative; padding-left: 1.6rem; margin: var(--space-3) 0; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: var(--shadow-dark);
}
.timeline-item { position: relative; padding-bottom: var(--space-4); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -1.6rem;
  top: 0.3rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px var(--bg);
}
.timeline-dot-publicada .timeline-dot, .timeline-dot-bajada_precio .timeline-dot, .timeline-dot-resubida .timeline-dot, .timeline-dot-enviada .timeline-dot { background: var(--accent); }
.timeline-dot-vendida .timeline-dot, .timeline-dot-entregada .timeline-dot, .timeline-dot-resena .timeline-dot { background: var(--positive); }
.timeline-dot-retirada .timeline-dot { background: var(--negative); }
.timeline-dot-merma .timeline-dot { background: var(--warning); }
.timeline-duracion { font-size: 0.72rem; color: var(--muted); opacity: 0.75; margin-bottom: 0.3rem; }
.timeline-fecha { font-size: 0.75rem; color: var(--muted); }
.timeline-evento { font-size: 0.92rem; font-weight: 600; margin-top: 0.1rem; }
.item-card-photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--muted);
  background: var(--page-bg);
  box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light);
}

th[data-col] a { color: inherit; text-decoration: none; white-space: nowrap; }
th[data-col] a.sorted { color: var(--accent); }

/* -- botones de acciones CRUD con icono (ver/editar/borrar/guardar...) -- */
.icon-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 9px;
  background: var(--bg);
  box-shadow: 3px 3px 7px var(--shadow-dark), -3px -3px 7px var(--shadow-light);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  border: none;
  cursor: pointer;
  line-height: 1;
}
.icon-link:hover { color: var(--accent); }
.icon-link:active { box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.icon-link-danger { color: var(--negative); }
.icon-link-danger:hover { color: var(--negative); }
.icon-link-accent { color: var(--accent); }
.quick-select { max-width: 130px; font-size: 0.78rem; padding: 0.35rem 0.5rem; }

/* ---- Móvil ---- */
@media (max-width: 640px) {
  .container { padding: 1rem 0.8rem; }
  /* US-146 QA (3-ago): con brand+nav-right a flex-shrink:0, nav-menu (los 4
     dropdowns) quedaba comprimido a ~86px con overflow-x:auto SIN pista
     visual de que había más — exactamente el problema que el rediseño
     quería resolver, reaparecido en móvil. Segunda fila propia: fila 1 =
     marca + cuenta, fila 2 = los 4 dropdowns a ancho completo, siempre
     visibles sin scroll oculto. */
  .nav-inner { flex-wrap: wrap; padding: var(--space-2) 0.8rem; gap: var(--space-2) 0; }
  .nav .brand { font-size: 0.85rem; padding: var(--space-2) var(--space-1); }
  .nav-menu { order: 3; flex-basis: 100%; justify-content: space-between; gap: 0; position: relative; }
  .nav-menu .nav-dropdown { flex: 1; position: static; }
  .nav-dropdown summary { padding: var(--space-2) var(--space-1); font-size: 0.78rem; text-align: center; }
  /* con 4 disparadores estrechos repartidos en la fila, un panel anclado
     a SU disparador (el de la derecha, ej. Admin) se saldría de la
     pantalla — ancla al ancho completo de .nav-menu (position:relative
     movido aquí arriba) en vez de a cada <details> individual. Solo los
     4 dropdowns de operación, NO el menú de cuenta (nav-right sigue en
     la fila 1, anclado a su propio disparador como en desktop). */
  .nav-menu .nav-dropdown-panel { position: absolute; left: 0; right: 0; top: calc(100% + var(--space-2)); min-width: 0; width: auto; }
  .nav-right { gap: var(--space-1); }
  .nav-dropdown-right summary { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .site-footer-inner { padding: var(--space-4) 0.8rem 0; }
  h1 { font-size: 1.2rem; }
  .cards { gap: 0.6rem; }
  .card { min-width: 0; flex: 1 1 calc(50% - 0.6rem); padding: 0.8rem; }
  .chart-head { flex-wrap: wrap; }
  .sparkline { display: none; }
  .card-value { font-size: 1.3rem; }
  .form { max-width: 100%; }
  /* US-039 (1-ago): los <select> se ensanchaban a su opción más larga
     ("— por defecto: P (Por fotografiar) —") mientras los <input> de texto
     se quedaban al ancho por defecto del navegador (~55%) — todo el mundo
     al 100% del ancho disponible. */
  .lot-field { flex-basis: 100%; }
  .lot-field > input, .lot-field > select, .lot-field > textarea { width: 100%; }
  .actions-bar-sticky {
    position: sticky; bottom: 0; z-index: 5; margin: var(--space-4) -0.8rem 0; padding: 0.8rem;
    background: var(--page-bg); box-shadow: 0 -4px 12px var(--shadow-dark);
  }
  .filters { flex-wrap: wrap; }
  .filters select { flex: 1 1 auto; min-width: 140px; }
  th, td { padding: 0.5rem 0.5rem; font-size: 0.85rem; }
  .actions, .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form button { width: 100%; }
  /* objetivo tactil >=44px (Apple HIG / Material) en botones y campos */
  input, select, textarea, button, .btn { min-height: 44px; font-size: 1rem; }
  .inline-form input, .inline-form button, .photo-item button { min-height: 38px; font-size: 0.85rem; }
  .icon-link { min-height: 40px; font-size: 0.85rem; }
  .photo-item img { width: 100px; height: 100px; }
  .chart-card { padding: 0.8rem; }

  /* tablas largas/complejas (piezas, lotes): en vez de scroll horizontal
     incomodo, cada fila se convierte en una tarjeta apilada. data-label en
     cada <td> se pinta como etiqueta via ::before (sin JS). */
  .table-stack { overflow-x: visible; }
  .table-stack table, .table-stack thead, .table-stack tbody, .table-stack th, .table-stack tr {
    display: block;
  }
  .table-stack thead { display: none; }
  .table-stack tr {
    border-radius: 12px;
    margin-bottom: 0.8rem;
    padding: 0.7rem 0.8rem;
    background: var(--bg);
    box-shadow: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);
  }
  .table-stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0;
    text-align: right;
  }
  .table-stack td:not(:last-child) { box-shadow: inset 0 -1px 0 var(--shadow-dark); }
  .table-stack td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-align: left;
    flex-shrink: 0;
  }
  .table-stack td.stack-actions { flex-direction: column; align-items: stretch; }
  .table-stack td.stack-actions::before { margin-bottom: 0.3rem; }
}

/* -- ficha de pieza: foto grande arriba, precio como flujo, acciones siempre visibles -- */
.pieza-hero { display: grid; grid-template-columns: 300px 1fr; gap: var(--space-4); margin: var(--space-3) 0; }
.hero-photo { padding: var(--space-3); }
.hero-photo-main { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; display: block; }
.hero-photo-placeholder { width: 100%; aspect-ratio: 1/1; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 3rem; background: var(--page-bg); }
.hero-thumbs { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.hero-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: 0.5; }
.hero-thumb.active { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }

.avatar-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 0.4rem; }
.avatar-looks { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: 0.8rem; }
.avatar-look-card { width: 180px; }
.avatar-look-card img { width: 100%; border-radius: var(--radius); display: block; }
.avatar-look-fecha { font-size: 0.75rem; color: var(--muted); margin-top: 0.3rem; }

.hero-main { padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.hero-eyebrow { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.2rem; }
.hero-title { font-size: 1.35rem; font-weight: 800; margin: 0; line-height: 1.25; }

.money-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.money-item { display: flex; flex-direction: column; gap: 0.1rem; }
.money-item .label { font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.money-item .value { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.money-arrow { color: var(--muted); font-size: 1.05rem; }
.money-item.profit .value { color: var(--positive); }
.money-item.loss .value { color: var(--negative); }

.meta-line { font-size: 0.85rem; color: var(--muted); display: flex; gap: var(--space-4); flex-wrap: wrap; }
.meta-line strong { color: var(--text); font-weight: 700; }
.rec-price { font-size: 0.85rem; color: var(--muted); background: var(--accent-soft); padding: 0.5rem 0.8rem; border-radius: 10px; width: fit-content; }
.rec-price strong { color: var(--accent); }

.actions-bar { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; }
.actions-bar .inline-form { display: flex; gap: 0.4rem; align-items: center; }
/* US-143 (1-ago): barra de acción masiva — pegada al fondo para que no se
   pierda de vista al bajar por una tabla larga, aparece solo con >=1
   seleccionada. */
.bulk-actions-bar {
  position: sticky; bottom: 0; z-index: 6; display: flex; gap: var(--space-3); align-items: center;
  flex-wrap: wrap; margin: var(--space-3) 0; padding: var(--space-3) var(--space-4);
  background: var(--bg); border-radius: var(--radius);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
}
.bulk-actions-bar #bulkCount { font-weight: 700; color: var(--accent); }
/* US-032 (1-ago): la acción peligrosa (merma) no puede pesar igual que
   Vender/Retirar en la barra — un solo click de más y una prenda buena
   queda "perdida". Tras un disclosure: hace falta un click extra a
   propósito antes de llegar al formulario con motivo + confirm. */
.accion-peligrosa { margin-left: auto; }
.accion-peligrosa > summary { list-style: none; cursor: pointer; }
.accion-peligrosa > summary::-webkit-details-marker { display: none; }
.accion-peligrosa[open] > summary { display: none; }
.accion-peligrosa .inline-form { margin-top: 0.4rem; }
.merma-separada { margin-left: 0.6rem; padding-left: 0.6rem; border-left: 1px solid var(--shadow-dark); }

.toggle-simple > summary { cursor: pointer; font-weight: 700; color: var(--accent); list-style: none; }
.toggle-simple > summary::-webkit-details-marker { display: none; }
.toggle-simple[open] > summary { margin-bottom: 0.6rem; }
.toggle-simple form { margin-top: 0.6rem; }

.section-divider { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--shadow-dark); }
.section-divider h4 { margin: 0 0 var(--space-2); font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 800; }

@media (max-width: 640px) {
  .pieza-hero { grid-template-columns: 1fr; }
}

/* US-101 (3-ago): informe anual pensado para imprimirse (Ctrl/⌘+P) — sin
   nav/footer/tema oscuro, sin sombras neumórficas que no imprimen bien. */
@media print {
  .nav, .site-footer, .informe-anual form { display: none; }
  body { background: #fff; color: #000; }
  .chart-card, .card, table { box-shadow: none; }
  a { color: #000; text-decoration: none; }
}

/* US-048 (3-ago): hoja de etiquetas QR — grid en pantalla, una etiqueta
   por celda que no se corte a mitad al imprimir (page-break-inside). */
.etiquetas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.etiqueta-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2);
  text-align: center;
  break-inside: avoid;
  page-break-inside: avoid;
}
.etiqueta-qr { width: 100%; max-width: 120px; height: auto; }
.etiqueta-texto { margin-top: var(--space-1); }
.etiqueta-ref { display: block; font-size: 1.1rem; }
.etiqueta-detalle { display: block; color: var(--muted); font-size: 0.85rem; }
@media print {
  .etiquetas-pagina .notas { display: none; }
  .etiqueta-card { border-color: #000; }
  .etiqueta-detalle { color: #000; }
}
