/* =====================================================================
   Celestial B2B — Sistema de diseño
   Estética Apple: blanco y negro, mucho aire, tipografía de sistema.
   El COLOR se reserva para datos y estados (verde/rojo/ámbar).
   Animaciones premium: spring easing, entradas suaves, hover con elevación.
   ===================================================================== */

:root {
  /* Escala de grises (Apple-like) */
  --ink:        #1d1d1f;   /* texto principal, casi negro */
  --ink-2:      #4b4b4f;   /* texto secundario */
  --ink-3:      #86868b;   /* texto terciario / captions */
  --line:       #e6e6e9;   /* bordes hairline */
  --line-2:     #f0f0f2;   /* separadores muy suaves */
  --surface:    #ffffff;   /* tarjetas */
  --surface-2:  #f5f5f7;   /* fondo de página (gris Apple) */
  --surface-3:  #fafafa;   /* hover sutil */
  --black:      #000000;
  --white:      #ffffff;

  /* Estados (único color permitido, solo en datos/estados) */
  --ok:      #1a8f4c;  --ok-bg:   #e7f6ec;
  --warn:    #b25e00;  --warn-bg: #fdf1e3;
  --bad:     #c0362c;  --bad-bg:  #fceceb;
  --info:    #2f6df0;  --info-bg: #eaf1fe;

  /* Radios */
  --r-xs: 8px;  --r-sm: 12px;  --r-md: 16px;  --r-lg: 20px;  --r-xl: 28px;  --r-full: 999px;

  /* Sombras (suaves, en capas) */
  --sh-1: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.03);
  --sh-2: 0 4px 16px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --sh-3: 0 12px 40px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);
  --sh-pop: 0 20px 60px rgba(0,0,0,.16);

  /* Curvas de animación */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);   /* rebote sutil */
  --ease-out:    cubic-bezier(.22, 1, .36, 1);      /* deceleración Apple */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Segoe UI", Roboto, "Helvetica Neue", Inter, system-ui, sans-serif;
}

/* ---------- Reset base ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* Tamaño por defecto de todos los iconos SVG (evita que se estiren). */
svg.ico { width: 18px; height: 18px; flex: none; }
.empty svg.ico { width: 40px; height: 40px; }
.stat svg.ico, .timeline svg.ico { width: 16px; height: 16px; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface-2);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p  { margin: 0; }
a  { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }
::selection { background: rgba(0,0,0,.10); }

/* ---------- Scrollbar discreta ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b8b8bd; background-clip: content-box; }

/* =====================================================================
   LAYOUT: sidebar (desktop) + contenido. En móvil, tab bar inferior.
   ===================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 20px;
}
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--black); color: var(--white);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  box-shadow: var(--sh-2);
}
.brand .name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand .role { font-size: 11px; color: var(--ink-3); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* Workspace switcher (superadmin, estilo Figma) */
.ws { position: relative; }
.ws-current {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; text-align: left;
  transition: background .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.ws-current:hover { background: var(--surface-3); box-shadow: var(--sh-1); }
.ws-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; flex: 0 0 30px; }
.ws-ico svg { width: 16px; height: 16px; }
.ws-ico.sm { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; background: var(--surface-2); color: var(--ink-2); }
.ws-ico.sm svg { width: 13px; height: 13px; }
.ws-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.ws-meta b { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.ws-meta span { font-size: 11px; color: var(--ink-3); }
.ws-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-pop); padding: 6px; display: none;
  animation: scaleIn .18s var(--ease-out) both;
}
.ws-menu.open { display: block; }
.ws-menu-head { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px 8px; }
.ws-item { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: var(--r-xs); font-size: 13px; font-weight: 500; color: var(--ink); }
.ws-item:hover { background: var(--surface-2); }
.ws-item.active { background: var(--surface-2); }
.ws-item .ws-check { margin-left: auto; color: var(--ok); }
.ws-item .ws-check svg { width: 15px; height: 15px; }
.ws-item.soon { color: var(--ink-3); cursor: default; }
.ws-item.soon:hover { background: transparent; }
.ws-soon { margin-left: auto; font-size: 10px; font-weight: 600; background: var(--surface-2); color: var(--ink-3); padding: 2px 7px; border-radius: 999px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; font-size: 14px;
  transition: background .18s var(--ease-out), color .18s var(--ease-out), transform .1s var(--ease-out);
}
.nav a .ico { width: 18px; height: 18px; opacity: .8; flex: 0 0 18px; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a:active { transform: scale(.98); }
.nav a.active { background: var(--ink); color: var(--white); box-shadow: var(--sh-2); }
.nav a.active .ico { opacity: 1; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-2); }
.userchip {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  transition: background .18s var(--ease-out);
}
.userchip:hover { background: var(--surface-3); }
.userchip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--ink-2);
}
.userchip .meta { min-width: 0; }
.userchip .meta b { font-size: 13px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip .meta span { font-size: 11px; color: var(--ink-3); }

/* ---------- Contenido ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar .title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 32px; max-width: 1200px; width: 100%; margin: 0 auto; }
.content > * { animation: fadeUp .5s var(--ease-out) both; }
.page-head { margin-bottom: 24px; }
.page-head .sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }

/* =====================================================================
   COMPONENTES
   ===================================================================== */

/* Tarjeta */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--sh-1);
  transition: box-shadow .3s var(--ease-out), transform .3s var(--ease-out), border-color .3s var(--ease-out);
}
.card.hover:hover { box-shadow: var(--sh-3); transform: translateY(-2px); border-color: #dcdce0; }
.card-pad-lg { padding: 28px; }

/* Rejilla utilitaria */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-sm { gap: 8px; } .gap-lg { gap: 24px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap;
  transition: transform .12s var(--ease-out), box-shadow .2s var(--ease-out), background .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn:hover { background: var(--surface-3); box-shadow: var(--sh-1); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--black); color: var(--white); border-color: var(--black); }
.btn-primary:hover { background: #2a2a2c; box-shadow: var(--sh-2); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--bad); border-color: var(--line); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad-bg); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: var(--r-xs); }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Chips / etiquetas de estado (AQUÍ vive el color) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; letter-spacing: -0.01em;
  background: var(--surface-2); color: var(--ink-2);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok   { background: var(--ok-bg);   color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad  { background: var(--bad-bg);  color: var(--bad); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-ink  { background: var(--ink); color: var(--white); }

/* Stat / KPI */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; font-weight: 600; }
.stat .delta.up { color: var(--ok); } .stat .delta.down { color: var(--bad); }

/* Tablas */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .15s var(--ease-out); }
table.tbl tbody tr:hover { background: var(--surface-3); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* Campos de formulario */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 15px; font-family: inherit;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out), background .18s var(--ease-out);
}
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(0,0,0,.06);
}
.field .hint { font-size: 12px; color: var(--ink-3); }

/* Botón con aspecto de enlace (para acciones inline en tablas) */
.linklike {
  display: inline-flex; align-items: center; gap: 5px; padding: 0;
  background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  color: var(--ink); text-align: left;
}
.linklike:hover { text-decoration: underline; }
.linklike .ico { width: 14px; height: 14px; color: var(--ink-3); }

/* Secciones bloqueadas (comercial sin contrato) */
.nav a.locked, .tabbar a.locked { opacity: .5; }
.lockbadge { margin-left: auto; font-size: 11px; }
.tabbar a.locked .lockbadge { position: absolute; top: 4px; right: 50%; transform: translateX(14px); margin: 0; }
.lockbanner {
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
  padding: 13px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500;
  color: #7a4a00; background: rgba(224,138,0,.1); border: 1px solid rgba(224,138,0,.35);
}
.lockbanner b { font-weight: 700; }
.lockbanner span[aria-hidden] { margin-left: auto; }
.lockbanner:hover { background: rgba(224,138,0,.16); }

/* Tour de bienvenida */
.onbo { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; animation: fadeIn .2s var(--ease-out) both; }
.onbo-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-pop); padding: 30px 26px 24px; text-align: center; animation: scaleIn .22s var(--ease-out) both; }
.onbo-ico { font-size: 40px; line-height: 1; margin-bottom: 14px; }
.onbo-card h2 { font-size: 21px; letter-spacing: -.02em; margin-bottom: 8px; }
.onbo-card p { color: var(--ink-2); font-size: 15px; line-height: 1.55; min-height: 66px; }
.onbo-dots { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }
.onbo-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .2s, width .2s; }
.onbo-dots span.on { background: var(--ink); width: 20px; border-radius: 4px; }

/* Toggle switch */
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 44px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: #d1d1d6; border-radius: 999px;
  transition: background .25s var(--ease-out);
}
.switch .thumb {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--white); box-shadow: var(--sh-2);
  transition: transform .28s var(--ease-spring);
}
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track + .thumb { transform: translateX(18px); }

/* Timeline (seguimiento de pedido) */
.timeline { display: flex; flex-direction: column; }
.timeline .step { display: flex; gap: 14px; padding-bottom: 22px; position: relative; }
.timeline .step:last-child { padding-bottom: 0; }
.timeline .step::before {
  content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line);
}
.timeline .step:last-child::before { display: none; }
.timeline .node {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px; z-index: 1;
  border: 2px solid var(--line); background: var(--surface);
  display: grid; place-items: center;
}
.timeline .step.done .node { background: var(--ink); border-color: var(--ink); color: var(--white); }
.timeline .step.current .node { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(0,0,0,.08); }
.timeline .step .body b { font-size: 14px; font-weight: 600; }
.timeline .step .body span { font-size: 12px; color: var(--ink-3); display: block; margin-top: 2px; }

/* Segmented control (filtros tipo iOS) */
.segmented { display: inline-flex; background: var(--surface-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.segmented button {
  border: none; background: transparent; padding: 7px 15px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  transition: background .2s var(--ease-out), color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* Empty state */
.empty { text-align: center; padding: 56px 24px; color: var(--ink-3); }
.empty .ico { width: 40px; height: 40px; margin: 0 auto 14px; opacity: .35; }
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }

/* Divider */
.hr { height: 1px; background: var(--line); border: none; margin: 20px 0; }

/* Utilidades de texto */
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tabnum { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* =====================================================================
   TAB BAR INFERIOR (móvil) — panel comercial en la calle
   ===================================================================== */
.tabbar { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 16px 96px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: rgba(255,255,255,.82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0));
    justify-content: space-around;
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 4px 10px; border-radius: var(--r-sm); color: var(--ink-3);
    font-size: 10px; font-weight: 600; flex: 1; max-width: 90px;
    transition: color .2s var(--ease-out), transform .12s var(--ease-out);
  }
  .tabbar a .ico { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--ink); }
  .tabbar a:active { transform: scale(.9); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}

/* =====================================================================
   MODAL / POPUP
   ===================================================================== */
/* Basado en visibility/opacity → anima al ABRIR y al CERRAR (no salto seco). */
.modal {
  position: fixed; inset: 0; z-index: 100; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,.34);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .28s var(--ease-out), visibility .28s var(--ease-out), backdrop-filter .28s;
}
.modal.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-card {
  background: var(--surface); border-radius: var(--r-xl);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sh-pop); padding: 28px;
  transform: translateY(24px) scale(.96); opacity: 0;
  transition: transform .42s var(--ease-spring), opacity .3s var(--ease-out);
}
.modal.open .modal-card { transform: none; opacity: 1; }
.modal-card.wide { max-width: 620px; }
.modal-close {
  position: absolute; top: 16px; right: 18px; width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--surface-2); color: var(--ink-2); font-size: 18px; cursor: pointer; line-height: 1;
  display: grid; place-items: center; transition: background .2s var(--ease-out);
}
.modal-close:hover { background: var(--line); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.qty button { border: none; background: var(--surface); width: 40px; height: 42px; font-size: 20px; cursor: pointer; color: var(--ink); transition: background .15s var(--ease-out); }
.qty button:hover { background: var(--surface-2); }
.qty input { border: none; width: 60px; height: 42px; text-align: center; font-size: 16px; font-weight: 600; font-family: inherit; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* =====================================================================
   ANIMACIONES
   ===================================================================== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Entradas escalonadas para listas/tarjetas */
.stagger > * { animation: fadeUp .5s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; }
.stagger > *:nth-child(8) { animation-delay: .30s; }

/* Skeleton loading (shimmer) */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  animation: shimmer 1.4s infinite;
}

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(0,0,0,.15); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
.btn-primary .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }

/* Toast (avisos flotantes, se autoocultan) */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--ink); color: var(--white);
  padding: 12px 18px; border-radius: var(--r-full); font-size: 14px; font-weight: 600;
  box-shadow: var(--sh-3); pointer-events: auto;
  animation: toastIn .45s var(--ease-spring) both;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.bad::before { background: #ff6b6b; }
.toast.out { animation: toastOut .3s var(--ease-in-out) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px) scale(.95); } }

/* Foco accesible y consistente (teclado). */
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,0,0,.14); border-radius: var(--r-xs); }
.btn:focus-visible { box-shadow: 0 0 0 4px rgba(0,0,0,.12); }

/* Respeta usuarios que reducen movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* =====================================================================
   PANTALLA DE LOGIN
   ===================================================================== */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, #ffffff, transparent),
    var(--surface-2);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl); padding: 40px 34px;
  box-shadow: var(--sh-3); animation: scaleIn .55s var(--ease-out) both;
}
.auth-logo {
  width: 52px; height: 52px; border-radius: 15px; background: var(--black); color: var(--white);
  display: grid; place-items: center; font-weight: 700; font-size: 24px; margin: 0 auto 20px;
  box-shadow: var(--sh-3);
}
.auth h1 { text-align: center; font-size: 23px; margin-bottom: 4px; }
.auth .tagline { text-align: center; color: var(--ink-3); font-size: 14px; margin-bottom: 28px; }
.auth .error {
  background: var(--bad-bg); color: var(--bad); font-size: 13px; font-weight: 500;
  padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 18px; text-align: center;
  animation: fadeUp .3s var(--ease-out) both;
}
.auth .foot { text-align: center; margin-top: 22px; font-size: 13px; color: var(--ink-3); }

/* ===== Tema TIENDA — clon del dashboard celestialflowers.es (Poppins, redondeado, sombras suaves) ===== */
body.retail { font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif; background: #f5f5f7; }
body.retail h1, body.retail h2, body.retail h3, body.retail .page-head h1, body.retail .stat .value { font-family: 'Poppins', sans-serif; letter-spacing: -.02em; }
body.retail .page-head h1 { font-weight: 700; }
body.retail .stat .value { font-weight: 700; }
body.retail .card { border-radius: 24px; box-shadow: 0 2px 8px rgba(0,0,0,.03), 0 14px 40px rgba(0,0,0,.05); border: 1px solid #ededf0; }
body.retail .modal-card { border-radius: 24px; box-shadow: 0 24px 60px rgba(0,0,0,.18); }
body.retail .ws-current { border-radius: 16px; }
body.retail .ws-menu { border-radius: 18px; }
body.retail .btn { border-radius: 14px; }
body.retail .btn-sm { border-radius: 11px; }
body.retail .chip { border-radius: 999px; }
body.retail .nav a { border-radius: 12px; }
body.retail .input, body.retail .select, body.retail textarea.input { border-radius: 12px; }
body.retail .tbl th { font-family: 'Poppins', sans-serif; font-weight: 600; }
body.retail .tbl { border-radius: 20px; overflow: hidden; }
body.retail .ws-ico { border-radius: 10px; }
