/* ═══════════════════════════════════════════════════════════════════
 * Coronel Sur — componentes reusables
 *
 * Sistema unificado para reemplazar inline styles dispersos en
 * templates. Cada componente esta scoped con prefijo `.cs-` para
 * coexistir con CSS legado sin colisiones.
 *
 * Variables CSS heredadas de admin-design-tokens.css. Si falta el
 * token (template legado sin tokens cargados), cada regla usa
 * fallback hardcoded para no romper.
 *
 * Uso: agregar `<link rel="stylesheet" href="/static/cs-components.css">`
 * al <head> del template. Despues usar las clases:
 *
 *   <button class="cs-btn cs-btn--primary cs-btn--lg">Comprar</button>
 *   <span class="cs-badge cs-badge--success">Activo</span>
 *   <div class="cs-card cs-card--elev">...</div>
 * ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
 * Dark mode support
 *
 * Activacion en cascada:
 *   1. `[data-theme="dark"]` en <html> o <body> — explicito (toggle)
 *   2. `@media (prefers-color-scheme: dark)` cuando no hay data-theme
 *      — usuario del SO en modo oscuro y la pagina respeta
 *   3. `[data-theme="light"]` fuerza light incluso si SO es dark
 *
 * Templates light-only (tienda_publica, mayorista) NO necesitan optar
 * in — los componentes .cs-* siguen viendose bien en dark si el
 * cliente tiene el SO en dark mode (.cs-card cambia el fondo a oscuro,
 * los textos a claro, los inputs no quedan blanco brillante quemando
 * la retina).
 *
 * Para optar OUT (forzar light siempre): <body data-theme="light">.
 * ═══════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #161b22;
    --surface-2: #22272e;
    --border: #30363d;
    --border-2: #444c56;
    --ink: #e6edf3;
    --ink-2: #b1bac4;
    --ink-3: #6e7681;
    --bg-soft: #0d1117;
  }
}
[data-theme="dark"] {
  --surface: #161b22;
  --surface-2: #22272e;
  --border: #30363d;
  --border-2: #444c56;
  --ink: #e6edf3;
  --ink-2: #b1bac4;
  --ink-3: #6e7681;
  --bg-soft: #0d1117;
}
/* Toggle: <button class="cs-theme-toggle" onclick="csToggleTheme()">. */
.cs-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
  color: var(--ink-2, #475569);
  cursor: pointer;
  transition: background .12s, color .12s, transform .12s;
}
.cs-theme-toggle:hover {
  background: var(--surface-2, #f3f4f6);
  color: var(--ink, #111827);
}
.cs-theme-toggle .cs-theme-toggle__moon { display: inline; }
.cs-theme-toggle .cs-theme-toggle__sun  { display: none; }
[data-theme="dark"] .cs-theme-toggle .cs-theme-toggle__moon { display: none; }
[data-theme="dark"] .cs-theme-toggle .cs-theme-toggle__sun  { display: inline; }


/* ─── Iconos (sprite SVG cargado 1 vez desde /static/cs-icons.svg) ──
 * Uso:
 *   <svg class="cs-icon"><use href="/static/cs-icons.svg#truck"/></svg>
 *
 * Por default 16x16 + stroke heredada de currentColor. Para tamanos
 * distintos usar .cs-icon--lg (24) o .cs-icon--xl (32) o setear
 * width/height inline. */
.cs-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
}
.cs-icon--sm { width: 12px; height: 12px; }
.cs-icon--lg { width: 24px; height: 24px; }
.cs-icon--xl { width: 32px; height: 32px; }

/* ─── Card (contenedor base con borde y radius) ─────────────────── */
.cs-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 18px;
}
.cs-card--elev {
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
}
.cs-card--padded {
  padding: 28px;
}
.cs-card--compact {
  padding: 12px 14px;
}

/* ─── Botones ───────────────────────────────────────────────────── */
.cs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .12s;
  text-decoration: none;
  line-height: 1.25;
}
.cs-btn:disabled { opacity: .55; cursor: not-allowed; }
.cs-btn--primary {
  background: var(--accent, #f5b51d);
  color: var(--accent-ink, #0c0c0e);
}
.cs-btn--primary:hover:not(:disabled) {
  background: var(--accent-dark, #d99700);
}
.cs-btn--secondary {
  background: transparent;
  color: var(--ink, #111827);
  border-color: var(--border, #e5e7eb);
}
.cs-btn--secondary:hover:not(:disabled) {
  background: var(--surface-2, #f3f4f6);
}
.cs-btn--whatsapp {
  background: #25D366;
  color: #fff;
}
.cs-btn--whatsapp:hover:not(:disabled) { background: #1ebe5a; }
.cs-btn--ghost {
  background: transparent;
  color: var(--ink-2, #475569);
  border-color: transparent;
}
.cs-btn--ghost:hover:not(:disabled) { background: var(--surface-2, #f3f4f6); }
.cs-btn--danger {
  background: var(--err, #dc2626);
  color: #fff;
}
.cs-btn--danger:hover:not(:disabled) { background: #b91c1c; }
.cs-btn--lg { padding: 12px 22px; font-size: 14.5px; }
.cs-btn--sm { padding: 6px 11px; font-size: 12px; }
.cs-btn--full { width: 100%; }

/* ─── Badges (chips inline) ─────────────────────────────────────── */
.cs-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  line-height: 1.4;
}
.cs-badge--neutral { background: var(--surface-2, #f3f4f6); color: var(--ink-2, #475569); }
.cs-badge--success { background: #dcfce7; color: #166534; }
.cs-badge--warning { background: #fef3c7; color: #92400e; }
.cs-badge--error   { background: #fee2e2; color: #991b1b; }
.cs-badge--info    { background: #dbeafe; color: #1e40af; }
.cs-badge--nuevo   { background: #3b82f6; color: #fff; padding: 3px 9px; letter-spacing: .04em; }
.cs-badge--oferta  { background: var(--accent, #f5b51d); color: #fff; padding: 3px 9px; }
.cs-badge--outlet  { background: #1f2937; color: #fff; padding: 3px 9px; letter-spacing: .05em; }

/* ─── Inputs / labels (form-friendly) ────────────────────────────── */
.cs-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2, #475569);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cs-label__optional {
  font-weight: 400;
  color: var(--ink-3, #94a3b8);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}
.cs-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface, #fff);
  color: var(--ink, #111827);
  transition: border-color .12s;
}
.cs-input:focus {
  outline: none;
  border-color: var(--accent, #f5b51d);
}
.cs-input--invalid {
  border-color: var(--err, #dc2626);
}

/* ─── Form rows (vertical y split de 2 cols) ─────────────────────── */
/* Estilos heredan a `label` y `input` directos por defecto — asi los
 * templates no tienen que escribir `class="cs-label cs-input"` en cada
 * campo. Si necesitas escapar, declara las clases explicitamente o usa
 * un selector mas especifico en el template. */
.cs-form-row { margin-bottom: 14px; }
.cs-form-row--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cs-form-row label,
.cs-form-row > div > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2, #475569);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cs-form-row input:not([type="checkbox"]):not([type="radio"]),
.cs-form-row > div > input:not([type="checkbox"]):not([type="radio"]),
.cs-form-row textarea,
.cs-form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface, #fff);
  color: var(--ink, #111827);
  transition: border-color .12s;
}
.cs-form-row input:focus,
.cs-form-row textarea:focus,
.cs-form-row select:focus {
  outline: none;
  border-color: var(--accent, #f5b51d);
}

/* ─── Mensajes inline (success/error tras submit) ───────────────── */
.cs-msg {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 14px;
}
.cs-msg--ok  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.cs-msg--err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ─── Stat (numero grande + label) ──────────────────────────────── */
.cs-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cs-stat__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink, #111827);
  font-family: var(--FM, 'JetBrains Mono', ui-monospace, monospace);
  line-height: 1.1;
}
.cs-stat__label {
  font-size: 11px;
  color: var(--ink-3, #94a3b8);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ─── Divider horizontal ────────────────────────────────────────── */
.cs-divider {
  height: 1px;
  background: var(--border, #e5e7eb);
  margin: 16px 0;
  border: 0;
}

/* ─── Helpers de layout ─────────────────────────────────────────── */
.cs-flex { display: flex; }
.cs-flex--col { flex-direction: column; }
.cs-flex--center { align-items: center; justify-content: center; }
.cs-flex--gap-sm { gap: 6px; }
.cs-flex--gap-md { gap: 12px; }
.cs-flex--gap-lg { gap: 20px; }
.cs-mt-sm { margin-top: 6px; }
.cs-mt-md { margin-top: 14px; }
.cs-mt-lg { margin-top: 24px; }

/* ─── Banner CTA (top bar dismissible) ──────────────────────────── */
.cs-banner-cta {
  background: linear-gradient(90deg, var(--accent, #f5b51d) 0%, #ffc94a 100%);
  color: var(--accent-ink, #0c0c0e);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  position: relative;
}
.cs-banner-cta__close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: inherit;
  opacity: .6;
  padding: 4px 8px;
  background: none;
  border: 0;
}
.cs-banner-cta__close:hover { opacity: 1; }
.cs-banner-cta__action {
  margin-left: 10px;
  padding: 5px 12px;
  background: #0c0c0e;
  color: var(--accent, #f5b51d);
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════════
 * PR D8 — Accesibilidad (a11y)
 *
 * Reglas mínimas pero efectivas:
 * 1) Focus visible siempre (browsers modernos lo ocultan en :focus normal,
 *    solo lo muestran en :focus-visible — keyboard nav, no mouse).
 * 2) Skip link al main para usuarios de screen reader.
 * 3) Reduced motion: respetar prefers-reduced-motion (skeletons, slides).
 * 4) Tamaño mínimo de touch target 44x44 en mobile (WCAG 2.5.5).
 * 5) Contraste de outline visible.
 * 6) `.sr-only` para texto solo para screen reader (sin display:none).
 * ═══════════════════════════════════════════════════════════════════ */

/* Focus visible — solo cuando el usuario navega con teclado. */
.cs-btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent, #f5b51d);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link — invisible hasta tab. Permite saltar el sidebar/topbar
   y ir directo al contenido. Uso: `<a href="#main" class="cs-skip-link">Saltar al contenido</a>` */
.cs-skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--accent, #f5b51d);
  color: var(--accent-ink, #0c0c0e);
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 700;
  z-index: 99999;
  text-decoration: none;
  transition: top 0.15s;
}
.cs-skip-link:focus {
  top: 8px;
}

/* Screen reader only — texto que NO se ve pero el screen reader lo lee.
   Uso: `<button class="cs-btn"><svg .../><span class="sr-only">Editar producto</span></button>` */
.sr-only,
.cs-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Reduced motion: parar shimmer del skeleton y reducir animaciones a 0. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .cs-skeleton-bar {
    animation: none !important;
    background: var(--surface-2, #f3f4f6) !important;
  }
}

/* Touch target minimo 44x44 en mobile (WCAG 2.5.5 / Apple HIG).
 * Solo botones de icon-only en mobile. */
@media (max-width: 720px) {
  .cs-btn[aria-label]:not(:has(span)),
  button[aria-label]:not(:has(span:not(.sr-only))) {
    min-width: 44px;
    min-height: 44px;
  }
}


/* ═══════════════════════════════════════════════════════════════════
 * PR D11 — Modales unificados (.cs-modal)
 *
 * Reemplazo del CSS de modal duplicado en ~30 templates. Cada uno
 * tenia su modal-overlay, modal-bg, modal-box, etc. con backdrops de
 * opacidad distinta, animaciones inconsistentes, sin focus trap.
 *
 * **Estructura HTML**
 * ```
 * <div class="cs-modal" id="mi-modal" hidden>
 *   <div class="cs-modal__backdrop" data-cs-modal-close></div>
 *   <div class="cs-modal__box" role="dialog" aria-modal="true" aria-labelledby="mi-titulo">
 *     <button class="cs-modal__close" data-cs-modal-close aria-label="Cerrar">×</button>
 *     <h2 class="cs-modal__title" id="mi-titulo">Titulo</h2>
 *     <div class="cs-modal__body">Contenido</div>
 *     <div class="cs-modal__foot">
 *       <button class="cs-btn cs-btn--secondary" data-cs-modal-close>Cancelar</button>
 *       <button class="cs-btn cs-btn--primary">Confirmar</button>
 *     </div>
 *   </div>
 * </div>
 * ```
 *
 * **Apertura/cierre desde JS**
 * ```
 * csModalOpen('mi-modal')  // mostrar
 * csModalClose('mi-modal') // ocultar
 * ```
 * O click en cualquier elemento con `data-cs-modal-close` cierra el padre.
 * Tecla Escape tambien cierra (el JS lo maneja automaticamente).
 * ═══════════════════════════════════════════════════════════════════ */
.cs-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: cs-modal-fade 120ms ease-out;
}
.cs-modal[hidden] { display: none; }
.cs-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
.cs-modal__box {
  position: relative;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  max-width: 540px;
  width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: cs-modal-slide 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cs-modal__box--lg { max-width: 800px; }
.cs-modal__box--xl { max-width: 1100px; }
.cs-modal__box--sm { max-width: 420px; }
.cs-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink-3, #94a3b8);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  z-index: 1;
}
.cs-modal__close:hover {
  background: var(--surface-2, #f3f4f6);
  color: var(--ink, #111827);
}
.cs-modal__title {
  padding: 22px 56px 12px 24px;
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink, #111827);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.cs-modal__body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  color: var(--ink-2, #475569);
  font-size: 14px;
  line-height: 1.55;
}
.cs-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border, #e5e7eb);
}
@keyframes cs-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes cs-modal-slide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* PR D13: aliases para modales legacy (modal-overlay, modal-box,
 * modal-bg, modal-head, modal-body, modal-foot, modal-close). Los
 * ~30 templates legacy adoptan automaticamente el look de .cs-modal
 * sin tocar HTML. Funciones JS de cada template siguen iguales
 * (csModalOpen/Close NO se aplica — los legacy usan toggle .open
 * o display:none/block manuales).
 */
.modal-overlay,
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  animation: cs-modal-fade 120ms ease-out;
}
.modal-overlay.open,
.modal-scrim.open,
.modal-overlay[aria-hidden="false"] {
  display: flex;
}
.modal-bg {
  position: absolute;
  inset: 0;
  cursor: pointer;
}
.modal-box,
.modal-body-wrapper {
  position: relative;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  max-width: 540px;
  width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: cs-modal-slide 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink-3, #94a3b8);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.modal-close:hover {
  background: var(--surface-2, #f3f4f6);
  color: var(--ink, #111827);
}
.modal-head {
  padding: 22px 56px 12px 24px;
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink, #111827);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border, #e5e7eb);
}

/* ═══════════════════════════════════════════════════════════════════
 * PR D9 — Print stylesheet
 *
 * Aplica a CUALQUIER pagina que linkee cs-components.css cuando el
 * usuario hace Ctrl+P o "Imprimir como PDF". Sin esto, las paginas
 * admin (dark theme) imprimian fondo oscuro con texto invisible y
 * 50% de la hoja ocupada por el sidebar/topbar.
 *
 * Para opt-out en una pagina especifica (ej: si quieren imprimir el
 * sidebar con el menu): override con `.no-print-override` en el body.
 * ═══════════════════════════════════════════════════════════════════ */
@media print {
  /* Forzar fondo blanco / texto negro, sin importar dark mode. */
  body:not(.no-print-override),
  body:not(.no-print-override) * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Ocultar chrome de la app (sidebar, topbar, botones de accion,
   * banners, modales abiertos, toasts, FABs). El contenido principal
   * queda solo en la hoja. */
  .cs-sidebar, #cs-sidebar,
  .cs-topbar, #cs-topbar,
  .cs-mobile-bottom-nav,
  .cs-mobile-cart-bar,
  .cs-banner-cta,
  .cs-mobile-topbar,
  #wa-fab,
  .toast, #toast,
  .modal-overlay, .modal-scrim,
  .cs-skeleton-bar,
  .cs-skeleton-card,
  .cs-skeleton-row,
  .au-filters,
  .au-pag,
  .bd-filter,
  nav, header, footer,
  button:not(.print-keep),
  .cs-btn:not(.print-keep),
  .au-btn:not(.print-keep),
  [aria-hidden="true"] {
    display: none !important;
  }

  /* Quitar margins del shell para usar toda la hoja. */
  body, html, main, .cs-main, .au-wrap, .bd-wrap {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    position: static !important;
  }

  /* Headers de pagina con page break despues, util en reportes largos. */
  h1, h2 { page-break-after: avoid; }
  h3, h4 { page-break-after: avoid; }
  table, .cs-card { page-break-inside: avoid; }
  tr { page-break-inside: avoid; }

  /* Tablas con borde claro para print. Sin esto, el dark-style con
   * borders var(--line) era invisible. */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  th, td {
    border: 1px solid #999 !important;
    padding: 6px 8px !important;
    font-size: 11pt !important;
  }
  th {
    background: #f0f0f0 !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
  }

  /* Links: mostrar URL entre parentesis para que sirva en papel.
   * Salvo si tiene .no-print-url (links de navegacion).
   * Exclusion para `mailto:` y `tel:` (la URL pelada es fea). */
  a[href]:not(.no-print-url):after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
  a[href^="javascript:"]:after,
  a[href^="#"]:after,
  a[href^="mailto:"]:after,
  a[href^="tel:"]:after {
    content: "";
  }

  /* Tipografia print: serif estandar, sin webfonts (no se cargan en
   * algunos browsers por privacy). */
  body { font-family: 'Times New Roman', Georgia, serif !important; font-size: 11pt; }
  h1 { font-size: 18pt; }
  h2 { font-size: 14pt; }
  h3 { font-size: 12pt; }

  /* Margenes de pagina razonables. */
  @page {
    margin: 1.5cm;
    size: A4;
  }
}

/* ═══════════════════════════════════════════════════════════════════
 * PR D16 — Componentes nuevos: Toast + Tooltip + Tabs
 *
 * **Toast** — notificacion flotante temporal
 *   `<div class="cs-toast cs-toast--ok">Pedido guardado</div>`
 *   JS: csToast("texto", "ok|err|warn|info", duracion_ms)
 *
 * **Tooltip** — info al hover sin tomar espacio
 *   `<span class="cs-tooltip" data-tooltip="Texto aclaratorio">i</span>`
 *
 * **Tabs** — switching de paneles en una pagina
 *   `<div class="cs-tabs"><button class="cs-tab cs-tab--active">A</button>
 *    <button class="cs-tab">B</button></div>`
 * ═══════════════════════════════════════════════════════════════════ */

/* ─── Toast ──────────────────────────────────────────────────────── */
.cs-toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.cs-toast {
  background: var(--ink, #111827);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
  min-width: 240px;
  max-width: 380px;
  pointer-events: auto;
  animation: cs-toast-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cs-toast--ok   { background: #166534; }
.cs-toast--err  { background: #991b1b; }
.cs-toast--warn { background: #92400e; }
.cs-toast--info { background: #1e40af; }
.cs-toast.cs-toast--out {
  animation: cs-toast-out 200ms ease-in forwards;
}
@keyframes cs-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes cs-toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ─── Tooltip ─────────────────────────────────────────────────────── */
.cs-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  font-size: 11px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-2, #f3f4f6);
  color: var(--ink-3, #6b7280);
  font-weight: 700;
}
.cs-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink, #111827);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 240px;
  white-space: normal;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.cs-tooltip:hover::after,
.cs-tooltip:focus::after {
  opacity: 1;
}

/* ─── Tabs ────────────────────────────────────────────────────────── */
.cs-tabs {
  display: flex;
  border-bottom: 1px solid var(--border, #e5e7eb);
  gap: 4px;
  overflow-x: auto;
}
.cs-tab {
  background: transparent;
  border: 0;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-3, #94a3b8);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.cs-tab:hover {
  color: var(--ink, #111827);
}
.cs-tab--active {
  color: var(--accent, #f5b51d);
  border-bottom-color: var(--accent, #f5b51d);
}
.cs-tab-panel {
  display: none;
  padding: 20px 0;
}
.cs-tab-panel--active {
  display: block;
}
