/* ═══════════════════════════════════════════════════════════════════════════
   shopCELL — Base compartida (tienda + gestión): accesibilidad, estados y
   skeletons. Solo tokens. Se carga siempre después de tokens.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Accesibilidad (WCAG 2.2 AA) ────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-sm); }
::selection { background: var(--color-action); color: var(--color-on-action); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: var(--space-6); z-index: var(--z-skip);
  background: var(--color-action); color: var(--color-on-action);
  padding: var(--space-4) var(--space-6); border-radius: var(--radius-md); font-weight: var(--weight-semibold); text-decoration: none;
}
.skip-link:focus { top: var(--space-4); }

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

/* ── Tipografía utilitaria ──────────────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ── Estados: nunca solo color (siempre texto o ícono + color) ───────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: var(--weight-medium);
  padding: 3px 10px; border-radius: var(--radius-sm); white-space: nowrap;
  background: var(--color-surface-muted); color: var(--color-text);
}
.tag-accent  { background: var(--color-action); color: var(--color-on-action); }
.tag-neutral { background: var(--color-surface-muted); color: var(--color-text); }
.tag-outline { background: transparent; border: 1px solid var(--color-border-strong); color: var(--color-text); }
.tag-success { background: var(--color-success-bg); color: var(--color-success-fg); }
.tag-warning { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.tag-danger  { background: var(--color-danger-bg);  color: var(--color-danger-fg); }
.tag-info    { background: var(--color-info-bg);    color: var(--color-info-fg); }

.field-error { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-danger-fg); display: flex; gap: 6px; align-items: center; }
.field-error::before { content: "⚠"; }

.notice { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-4) var(--space-6); border-radius: var(--radius-md); font-size: var(--text-sm); }
.notice-success { background: var(--color-success-bg); color: var(--color-success-fg); }
.notice-warning { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.notice-danger  { background: var(--color-danger-bg);  color: var(--color-danger-fg); }
.notice-info    { background: var(--color-info-bg);    color: var(--color-info-fg); }

/* ═══ Skeletons: estados de carga ═════════════════════════════════════════
   Se anuncian con un único role="status" (texto .sr-only); el resto va
   aria-hidden="true". Sin shimmer cuando se prefiere movimiento reducido. */
.skeleton {
  display: block; border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-skeleton-base) 25%, var(--color-skeleton-shine) 50%, var(--color-skeleton-base) 75%);
  background-size: 200% 100%; animation: skeleton-shimmer 1.4s linear infinite;
}
.skeleton-line { height: 12px; margin-bottom: var(--space-3); }
.skeleton-line.w-25 { width: 25%; } .skeleton-line.w-40 { width: 40%; } .skeleton-line.w-60 { width: 60%; } .skeleton-line.w-80 { width: 80%; }
.skeleton-title { height: 28px; width: 45%; margin-bottom: var(--space-6); }
.skeleton-kpi { height: 92px; }
.skeleton-chart { height: 210px; }
.skeleton-row { height: 44px; margin-bottom: var(--space-3); }
.skeleton-card-img { height: 190px; margin-bottom: var(--space-3); }
.skeleton-circle { border-radius: 50%; width: 32px; height: 32px; }
.skeleton-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.skeleton-kpis { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); margin-bottom: var(--space-6); }
.skeleton-panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-8); }
@keyframes skeleton-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; background: var(--color-skeleton-base); } }

/* Contenido ya visible que se está actualizando (wire:loading) */
.is-loading { opacity: .55; pointer-events: none; transition: opacity var(--duration-base); }

/* ── Utilidades de composición compartidas (tienda + gestión) ───────────── */
.h2 { font-size: var(--text-2xl); } .h4 { font-size: var(--text-lg); } .h5 { font-size: var(--text-base); }
.h2, .h4, .h5 { font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: -.015em; margin: 0 0 var(--space-4); }
.field-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); }
.field-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.fieldset { border: 0; margin: 0 0 var(--space-6); padding: 0; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: var(--space-3); }
.lista-limpia { list-style: none; margin: 0; padding: 0; }
.resumen-dl { margin: 0; } .resumen-dl dd { margin: 0; }
.estado-vacio { align-items: center; text-align: center; padding: var(--space-12) var(--space-8); }
.girar { display: inline-block; animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .girar { animation: none; } }
.table-wrap { overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: 2px; }
.mas-opciones { margin-top: var(--space-3); }
.mas-opciones > summary { cursor: pointer; min-height: var(--target-min); display: flex; align-items: center; font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: underline; text-underline-offset: 3px; }
.mas-opciones[open] > summary { margin-bottom: var(--space-3); }
.enlace-tarjeta { text-decoration: none; color: inherit; }
.enlace-tarjeta:hover { box-shadow: var(--shadow-md); }
.fila-accion { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.fila-etiqueta-normal { font-weight: var(--weight-regular); text-transform: none; letter-spacing: 0; font-size: inherit; color: inherit; }
.leyenda { display: flex; gap: var(--space-6); margin: var(--space-4) 0 0; font-size: var(--text-xs); }
.leyenda-serie { display: inline-flex; align-items: center; gap: 6px; }
.leyenda-serie i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid var(--color-border-strong); }

/* ── Tablas apiladas en pantallas estrechas ──────────────────────────────────
   public/js/tablas-apilables.js copia el título de cada columna a data-label.
   En móvil cada fila pasa a ser una tarjeta «etiqueta: valor». */
@media (max-width: 767.98px) {
  .tabla-apilable, .tabla-apilable tbody, .tabla-apilable tr, .tabla-apilable td, .tabla-apilable th { display: block; width: 100%; }
  .tabla-apilable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tabla-apilable tbody tr { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); margin-bottom: var(--space-3); padding: var(--space-2) var(--space-4); }
  .tabla-apilable tbody td, .tabla-apilable tbody th { position: relative; text-align: right; border: 0; padding: var(--space-2) 0 var(--space-2) 42%; min-height: 36px; }
  .tabla-apilable tbody td + td, .tabla-apilable tbody th + td { border-top: 1px dashed var(--color-border); }
  .tabla-apilable tbody td:not([data-label]), .tabla-apilable tbody th:not([data-label]) { padding-left: 0; text-align: left; }
  .tabla-apilable tbody td[data-label]::before, .tabla-apilable tbody th[data-label]::before {
    content: attr(data-label); position: absolute; left: 0; top: var(--space-2); width: 38%; text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold);
    color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em; line-height: 1.6;
  }
  .tabla-apilable tbody td[colspan] { padding-left: 0; text-align: left; }
  .tabla-apilable tbody td:empty { display: none; }
}
