/* =========================================================================
   STUDIO ROBOT HOUSE — Sistema de diseño de la tienda
   "Taller retro" — neo-brutalismo ligero: papel viejo, tinta carbón,
   rojo vintage y acero. Bordes y sombras duras, botones táctiles.
   Titulares/datos: Space Mono · Cuerpo: Inter
   ========================================================================= */

:root {
  /* --- Marca (paleta retro) --- */
  --ink:        #2B2D42;   /* tinta / carbón: texto, encabezados, nav, bordes */
  --ink-2:      #22243a;   /* variante profunda para bandas oscuras */
  --red:        #B73239;   /* rojo vintage: CTA, etiquetas, alertas */
  --red-2:      #9a2a30;   /* rojo hover/pressed */
  --steel:      #7A8B99;   /* acero metálico: secundarios, íconos, footer */
  --steel-d:    #5f6e7b;
  --bone:       #F4F1EA;   /* crema / papel viejo: fondo de página */
  --paper:      #FCFBF7;   /* superficie de tarjetas (un punto más claro) */
  --cream:      #EAE4D6;   /* crema profunda: fondos de imagen, cabeceras de tabla */

  /* --- Neutros derivados --- */
  --text:       #2B2D42;
  --muted:      #6a7180;
  --border:     #2B2D42;   /* color del borde duro (2px) */
  --line:       rgba(43,45,66,.16);
  --line-2:     rgba(43,45,66,.09);
  --line-dark:  rgba(244,241,234,.20);
  --muted-dark: rgba(244,241,234,.66);

  /* --- Estados funcionales (mate, nada fluorescente) --- */
  --ok:   #4f7a5c;
  --warn: #b5852f;

  /* --- Aliases de compatibilidad (clases que ya existían) --- */
  --ember: var(--red);
  --ember-dark: var(--red-2);
  --red-bright: var(--red-2);
  --flare: var(--ink);     /* anillo de foco */

  /* --- Tipografía --- */
  --font-display: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* --- Forma (angular) --- */
  --r-lg: 6px;
  --r-md: 5px;
  --r-sm: 4px;
  /* Sombras DURAS (sin desenfoque): la firma neo-brutalista */
  --shadow-sm: 3px 3px 0 var(--border);
  --shadow-md: 4px 4px 0 var(--border);
  --shadow-lg: 6px 6px 0 var(--border);

  /* Casa-pentágono (firma visual, derivada del isotipo) */
  --house: polygon(50% 0, 100% 26%, 100% 100%, 0 100%, 0 26%);
}

/* ----------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bone);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}
/* Textura de semitono (halftone) muy sutil sobre el papel: ecos de las
   revistas de electrónica antiguas. Fija, detrás del contenido; las bandas
   oscuras la cubren, así que solo se ve sobre el crema. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--ink) 0.5px, transparent 0.6px);
  background-size: 5px 5px; opacity: .045;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
ul { list-style: none; padding: 0; }

/* ---------------------------------------------------------- Tipografía */
h1,h2,h3,h4,h5 { font-family: var(--font-display); line-height: 1.12; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.4rem); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--red); font-weight: 700; display: inline-flex; gap: .5rem; align-items: center;
}
.eyebrow--light { color: var(--steel); }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; display: inline-block; }

.lead { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }

/* Etiqueta técnica monoespaciada — el gesto de firma */
.spec {
  font-family: var(--font-mono);
  font-size: .74rem; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted);
}
.spec b { color: var(--ink); font-weight: 700; }

/* --------------------------------------------------------------- Layout */
.container { width: min(1160px, 92vw); margin-inline: auto; }
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }

/* Banda oscura (hero, footer, divisores de sección) */
.band {
  background:
    radial-gradient(120% 90% at 18% 0%, rgba(122,139,153,.22), transparent 55%),
    var(--ink);
  color: var(--bone);
}
.band h1, .band h2, .band h3 { color: var(--bone); }
.band .muted { color: var(--muted-dark); }

/* --------------------------------------------------------------- Botones */
.btn {
  --btn-bg: var(--red); --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font-family: var(--font-display); font-weight: 700; font-size: .92rem; letter-spacing: .01em;
  padding: .8rem 1.4rem; border-radius: var(--r-sm); border: 2px solid var(--border);
  background: var(--btn-bg); color: var(--btn-fg); line-height: 1;
  box-shadow: var(--shadow-md);
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease, color .15s ease;
  min-height: 46px;
}
/* Táctil: al pasar levanta, al presionar se hunde sobre su propia sombra */
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--border); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--border); }
.btn:focus-visible { outline: 3px solid var(--flare); outline-offset: 3px; }
.btn--primary { --btn-bg: var(--red); }
.btn--primary:hover { background: var(--red-2); }
.btn--dark { --btn-bg: var(--ink); --btn-fg: var(--bone); }
.btn--red  { --btn-bg: var(--red); --btn-fg: #fff; }
.btn--red:hover { background: var(--red-2); }
.btn--ghost { --btn-bg: var(--paper); --btn-fg: var(--ink); }
.btn--light { --btn-bg: var(--bone); --btn-fg: var(--ink); }
.btn--danger { --btn-bg: var(--paper); --btn-fg: var(--red); }
.btn--danger:hover { --btn-bg: var(--red); --btn-fg: #fff; }
.btn--sm { padding: .5rem .85rem; font-size: .8rem; min-height: 38px; box-shadow: var(--shadow-sm); }
.btn--sm:hover { box-shadow: 4px 4px 0 var(--border); }
.btn--block { width: 100%; }
.btn--lg { padding: 1rem 1.8rem; font-size: 1rem; min-height: 54px; }
.btn[disabled] { opacity: .5; pointer-events: none; box-shadow: none; }
.btn-link { background: none; border: 0; box-shadow: none; color: var(--red); font-family: var(--font-display); font-weight: 700; padding: .4rem 0; }
.btn-link:hover { color: var(--red-2); transform: none; }

/* Micro-interacción "Añadir al carrito" */
.btn--cart { position: relative; }
.btn--cart .btn__done { display: none; }
.btn--cart.is-loading { pointer-events: none; }
.btn--cart.is-loading .btn__label { opacity: .35; }
.btn--cart.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .6s linear infinite;
}
.btn--cart.is-done { background: var(--ok); }
.btn--cart.is-done .btn__label { display: none; }
.btn--cart.is-done .btn__done { display: inline-flex; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- Navegación */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bone);
  border-bottom: 2px solid var(--border);
}
.topbar__inner { display: flex; align-items: center; gap: 1.4rem; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand__mark { width: auto; height: 48px; }
.brand__name { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: 1.02rem; color: var(--ink); line-height: 1; }
.brand__sub { font-family: var(--font-mono); font-size: .56rem; letter-spacing: .28em; text-transform: uppercase; color: var(--red); }
.nav { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.nav a, .nav button.navlink {
  font-family: var(--font-body); font-weight: 600; font-size: .9rem; color: var(--text);
  padding: .55rem .8rem; border-radius: var(--r-sm); background: none; border: 0;
  position: relative; transition: color .15s ease, background .15s ease;
}
.nav a:hover, .nav button.navlink:hover { color: var(--red); }
.nav a.is-active { color: var(--red); }
.nav a.is-active::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: 4px; height: 2px; background: var(--red); }
.nav__cart { position: relative; }
.badge-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center; background: var(--red); color: #fff;
  font-family: var(--font-mono); font-size: .64rem; font-weight: 700; border-radius: var(--r-sm);
  border: 2px solid var(--bone);
}
.nav-desktop { display: flex; }

/* Barra inferior fija (thumb zone) — reemplaza al menú hamburguesa en móvil */
.tabbar { display: none; }
@media (max-width: 860px) {
  .nav-desktop { display: none; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--ink);
    border-top: 2px solid var(--border);
    padding: .4rem .4rem calc(.4rem + env(safe-area-inset-bottom));
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted-dark); font-family: var(--font-mono); font-size: .6rem;
    letter-spacing: .06em; text-transform: uppercase; padding: .35rem 0; border-radius: var(--r-sm);
    position: relative;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.is-active { color: var(--bone); }
  .tabbar a.is-active::before {
    content: ""; position: absolute; top: 0; width: 26px; height: 3px; background: var(--red);
  }
  .tabbar .badge-count { top: -2px; right: calc(50% - 22px); border-color: var(--ink); }
  body { padding-bottom: 74px; }
}

/* --------------------------------------------------------------- Hero */
.hero { position: relative; overflow: hidden; }
.hero__inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2.5rem; align-items: center; padding-block: clamp(3rem, 7vw, 5.5rem); }
.hero__mark { width: min(340px, 70%); aspect-ratio: 382/395; margin-inline: auto; }
.hero__house {
  aspect-ratio: 1; width: min(360px, 78%); margin-inline: auto;
  background: linear-gradient(160deg, #8a99a6, var(--steel-d));
  clip-path: var(--house); display: grid; place-items: center;
}
.hero__house img { width: 62%; }
.hero__img { display: block; width: min(400px, 82%); margin-inline: auto; }
.hero__img img { width: 100%; height: auto; filter: drop-shadow(0 14px 30px rgba(0,0,0,.4)); }
.hero h1 { margin-bottom: .3rem; }
.hero__meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.6rem; }
.chip {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .4rem .7rem; border-radius: var(--r-sm); border: 1.5px solid var(--line-dark); color: var(--bone);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.8rem; }
@media (max-width: 780px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; gap: 1.6rem; }
  .hero__meta, .hero__cta { justify-content: center; }
  .hero__order { order: -1; }
}

/* ------------------------------------------------- Grid de productos / Bento */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section-head p { max-width: 46ch; }

.grid-products {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
/* Bento: destacados ocupan más espacio en pantallas amplias */
.bento { display: grid; gap: 1.2rem; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; }
.bento .pcard--feature { grid-column: span 2; grid-row: span 2; }
.bento .pcard--feature .pcard__media { aspect-ratio: auto; flex: 1 1 auto; min-height: 260px; }
.bento .pcard--feature .pcard__body { padding: 1.2rem 1.3rem 1.4rem; flex: 0 0 auto; }
.pcard.is-hidden { display: none; }
/* Trío de tarjetas (propuesta de valor): 3 → 1 columna en móvil */
.trio { display: grid; gap: 1.2rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .trio { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .bento { grid-template-columns: repeat(2, 1fr); } .bento .pcard--feature { grid-column: span 2; grid-row: span 1; } .bento .pcard--feature .pcard__media { aspect-ratio: 16/10; flex: 0 0 auto; min-height: 0; } }
@media (max-width: 520px) { .bento { grid-template-columns: 1fr; } .bento .pcard--feature { grid-column: span 1; } }

/* Tarjeta de producto */
.pcard {
  position: relative; background: var(--paper); border: 2px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
  transition: transform .12s ease, box-shadow .12s ease;
}
.pcard:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--border); }
.pcard__media { position: relative; aspect-ratio: 1; background: var(--cream); overflow: hidden; border-bottom: 2px solid var(--border); }
.pcard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.pcard:hover .pcard__media img { transform: scale(1.04); }
.pcard__cat {
  position: absolute; top: .7rem; left: .7rem; font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: var(--bone);
  padding: .3rem .55rem; border-radius: var(--r-sm); font-weight: 700;
}
.pcard__body { padding: 1rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.pcard__title { font-family: var(--font-display); font-weight: 700; font-size: .98rem; color: var(--ink); line-height: 1.25; }
.pcard--feature .pcard__title { font-size: 1.25rem; }
.pcard__spec { margin-top: auto; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .2rem; }
.price { font-family: var(--font-mono); font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.price small { font-size: .68rem; color: var(--muted); font-weight: 400; }
.pcard__actions { margin-top: .7rem; display: flex; gap: .5rem; }
.stock-dot { display: inline-flex; align-items: center; gap: .35rem; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.stock-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.stock-dot.ok::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(79,122,92,.18); }
.stock-dot.low::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(181,133,47,.2); }
.stock-dot.out::before { background: var(--red); }

/* Chips de filtro (categorías) */
.filters { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: 1.5rem; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { height: 0; }

/* Barra de búsqueda + filtros del catálogo */
.cat-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-bottom: 1.2rem; }
.cat-toolbar .filters { margin-bottom: 0; flex: 1 1 auto; }
.cat-search { display: flex; gap: .5rem; flex: 0 0 auto; }
.cat-search input[type=search] {
  width: min(280px, 60vw); padding: .55rem .8rem; border: 2px solid var(--border); border-radius: var(--r-sm);
  background: var(--bone); font-family: var(--font-body);
}
.cat-search input[type=search]:focus { outline: none; border-color: var(--red); box-shadow: 3px 3px 0 var(--red); }
.cat-search .btn { flex: 0 0 auto; }

/* Paginación */
.pager { display: flex; align-items: center; justify-content: center; gap: 1.2rem; margin-top: 2.5rem; }
.pager__btn {
  font-family: var(--font-display); font-weight: 700; font-size: .85rem; padding: .6rem 1rem;
  border: 2px solid var(--border); border-radius: var(--r-sm); background: var(--paper); color: var(--ink);
  box-shadow: 3px 3px 0 var(--border); transition: transform .08s ease, box-shadow .08s ease;
}
.pager__btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--border); }
.pager__btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--border); }
.pager__btn.is-disabled { opacity: .4; pointer-events: none; box-shadow: none; }
.pager__status { white-space: nowrap; }
@media (max-width: 480px) { .pager { gap: .7rem; } .pager__btn { padding: .5rem .7rem; font-size: .78rem; } }

.fchip {
  white-space: nowrap; font-family: var(--font-mono); font-size: .76rem; letter-spacing: .03em; font-weight: 700;
  padding: .5rem .9rem; border-radius: var(--r-sm); border: 2px solid var(--border); color: var(--ink); background: var(--paper);
  transition: transform .1s ease, background .12s ease, color .12s ease; text-transform: uppercase;
}
.fchip:hover { transform: translate(-1px, -1px); }
.fchip.is-active { background: var(--red); color: #fff; }

/* --------------------------------------------------- Detalle de producto */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
.pdp__gallery { position: sticky; top: 88px; }
.pdp__main {
  aspect-ratio: 1; background: var(--cream); border-radius: var(--r-md); overflow: hidden;
  border: 2px solid var(--border); box-shadow: var(--shadow-md);
}
.pdp__main img { width: 100%; height: 100%; object-fit: cover; }
.pdp__thumbs { display: flex; gap: .6rem; margin-top: 1rem; }
.pdp__thumb { width: 68px; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; border: 2px solid var(--border); background: var(--cream); box-shadow: 2px 2px 0 var(--border); transition: transform .1s ease; }
.pdp__thumb.is-active { border-color: var(--red); }
.pdp__thumb:hover { transform: translate(-1px, -1px); }
.pdp__thumb img { width: 100%; height: 100%; object-fit: cover; }

.pdp__buy { display: flex; flex-direction: column; gap: 1.1rem; }
.pdp__price { font-family: var(--font-mono); font-weight: 700; font-size: 1.9rem; color: var(--ink); letter-spacing: -.01em; }
.pdp__desc { color: var(--muted); font-size: 1.02rem; }

/* Ficha técnica (spec sheet) — firma de marca */
.specsheet { border: 2px solid var(--border); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.specsheet__row { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; font-family: var(--font-mono); font-size: .8rem; background: var(--paper); }
.specsheet__row + .specsheet__row { border-top: 1px solid var(--line); }
.specsheet__row span:first-child { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.specsheet__row span:last-child { color: var(--ink); font-weight: 700; text-align: right; }

/* Transparencia de precio */
.trust { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; font-family: var(--font-mono); font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.trust span { display: inline-flex; align-items: center; gap: .4rem; }
.trust svg { width: 15px; height: 15px; color: var(--red); }

.qty { display: inline-flex; align-items: stretch; border: 2px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.qty button { width: 42px; background: var(--paper); border: 0; color: var(--ink); font-size: 1.2rem; }
.qty button:hover { background: var(--cream); }
.qty input { width: 54px; text-align: center; border: 0; border-inline: 2px solid var(--border); font-family: var(--font-mono); background: var(--bone); }

@media (max-width: 820px) {
  .pdp { grid-template-columns: 1fr; gap: 1.5rem; }
  .pdp__gallery { position: static; }
}

/* --------------------------------------------------------------- Carrito */
.cart { display: grid; grid-template-columns: 1.6fr .9fr; gap: 2rem; align-items: start; }
.cart__items { display: flex; flex-direction: column; gap: .9rem; }
.citem { display: grid; grid-template-columns: 84px 1fr auto; gap: 1rem; align-items: center; background: var(--paper); border: 2px solid var(--border); border-radius: var(--r-md); padding: .8rem; box-shadow: var(--shadow-sm); }
.citem__img { width: 84px; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--cream); border: 2px solid var(--border); }
.citem__img img { width: 100%; height: 100%; object-fit: cover; }
.citem__title { font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.citem__ctrl { display: flex; align-items: center; gap: .8rem; margin-top: .5rem; flex-wrap: wrap; }
.citem__price { font-family: var(--font-mono); font-weight: 700; color: var(--ink); white-space: nowrap; }

.summary { position: sticky; top: 88px; background: var(--paper); border: 2px solid var(--border); border-radius: var(--r-md); padding: 1.4rem; box-shadow: var(--shadow-md); }
.summary h3 { margin-bottom: 1rem; }
.summary__row { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .9rem; padding: .5rem 0; color: var(--muted); }
.summary__row b { color: var(--ink); }
.summary__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: .9rem; margin-top: .5rem; border-top: 2px solid var(--border); }
.summary__total .price { font-size: 1.5rem; }
.summary__note { font-family: var(--font-mono); font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: .8rem; }
.summary__ship { padding: .9rem 0 .2rem; border-top: 1px solid var(--line); }
@media (max-width: 820px) {
  .cart { grid-template-columns: 1fr; }
  .summary { position: static; }
  .citem { grid-template-columns: 64px 1fr; }
  .citem__img { width: 64px; }
  .citem__price { grid-column: 2; justify-self: end; }
}

/* --------------------------------------------------------------- Formularios */
.form-card { max-width: 460px; margin-inline: auto; background: var(--paper); border: 2px solid var(--border); border-radius: var(--r-md); padding: clamp(1.4rem, 4vw, 2.2rem); box-shadow: var(--shadow-lg); }
.form-card--wide { max-width: 620px; }
.field { margin-bottom: 1.1rem; }
.field label, form p label { display: block; font-family: var(--font-body); font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: var(--ink); }
.form-control, form input[type=text], form input[type=email], form input[type=password], form input[type=number], form input[type=url], form select, form textarea {
  width: 100%; padding: .72rem .85rem; border: 2px solid var(--border); border-radius: var(--r-sm);
  background: var(--bone); color: var(--text); transition: border-color .15s ease, box-shadow .15s ease;
  font-family: var(--font-body);
}
form input:focus, form select:focus, form textarea:focus, .form-control:focus {
  outline: none; border-color: var(--red); box-shadow: 3px 3px 0 var(--red);
}
form input[type=file] { width: 100%; padding: .5rem; border: 2px dashed var(--border); border-radius: var(--r-sm); background: var(--bone); }
.helptext, form .helptext, ul.errorlist { font-size: .82rem; color: var(--muted); margin-top: .3rem; padding-left: 1rem; }
ul.errorlist { color: var(--red); list-style: disc; }
form p { margin-bottom: 1.1rem; }
form p:has(input[type=checkbox]) { display: flex; align-items: center; gap: .5rem; }
form p:has(input[type=checkbox]) label { margin: 0; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--red); }

/* Gestor de imágenes múltiples (formset en el panel) */
.imgset { display: flex; flex-direction: column; gap: .7rem; margin-bottom: .6rem; }
.imgset__row { display: grid; grid-template-columns: 68px 1fr; gap: .9rem; align-items: start; border: 2px solid var(--border); border-radius: var(--r-sm); padding: .7rem; background: var(--bone); }
.imgset__thumb { width: 68px; height: 68px; border-radius: var(--r-sm); overflow: hidden; border: 2px solid var(--border); background: var(--cream); }
.imgset__thumb img { width: 100%; height: 100%; object-fit: cover; }
.imgset__thumb--empty { display: grid; place-items: center; font-family: var(--font-mono); font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.imgset__fields { display: flex; flex-direction: column; gap: .4rem; }
.imgset__fields > label { font-family: var(--font-body); font-weight: 600; font-size: .82rem; }
.imgset__meta { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; }
.imgset__meta label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; font-size: .82rem; margin: 0; }
.imgset__alt { flex: 1 1 200px; }
.imgset__alt input { margin-top: .2rem; }
.imgset__del { color: var(--red); }

/* --------------------------------------------------------------- Tablas */
.table-wrap { overflow-x: auto; border: 2px solid var(--border); border-radius: var(--r-md); background: var(--paper); box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); padding: .85rem 1rem; border-bottom: 2px solid var(--border); background: var(--cream); font-weight: 700; }
table.tbl td { padding: .85rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tfoot td, table.tbl tfoot th { border-top: 2px solid var(--border); font-weight: 700; }

/* --------------------------------------------------------------- Badges */
.badge { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .04em; padding: .28rem .55rem; border-radius: var(--r-sm); text-transform: uppercase; display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; border: 1.5px solid currentColor; }
.badge--ok { background: rgba(79,122,92,.12); color: var(--ok); }
.badge--warn { background: rgba(181,133,47,.14); color: #8a6420; }
.badge--info { background: rgba(122,139,153,.16); color: var(--steel-d); }
.badge--muted { background: var(--line-2); color: var(--muted); }
.badge--red { background: rgba(183,50,57,.1); color: var(--red); }

/* Línea de estado del pedido */
.timeline { display: flex; gap: 0; margin: 1.4rem 0; }
.tstep { flex: 1; text-align: center; position: relative; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tstep::before { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--bone); margin: 0 auto .5rem; border: 2px solid var(--border); position: relative; z-index: 1; }
.tstep::after { content: ""; position: absolute; top: 7px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.tstep:first-child::after { display: none; }
.tstep.done { color: var(--ink); }
.tstep.done::before { background: var(--red); border-color: var(--red); }
.tstep.done::after { background: var(--red); }

/* --------------------------------------------------------------- Toasts */
.toasts { position: fixed; top: 82px; right: 4vw; z-index: 60; display: flex; flex-direction: column; gap: .6rem; width: min(360px, 90vw); }
.toast { display: flex; align-items: flex-start; gap: .7rem; background: var(--paper); border: 2px solid var(--border); border-left-width: 6px; border-radius: var(--r-sm); padding: .85rem 1rem; box-shadow: var(--shadow-md); animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2); }
.toast--success { border-left-color: var(--ok); }
.toast--error, .toast--danger { border-left-color: var(--red); }
.toast--warning { border-left-color: var(--warn); }
.toast--info { border-left-color: var(--steel); }
.toast__msg { font-size: .9rem; color: var(--text); flex: 1; }
.toast__x { background: none; border: 0; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: 0 .2rem; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
@media (max-width: 860px) { .toasts { top: auto; bottom: 84px; right: 4vw; left: 4vw; width: auto; } }

/* --------------------------------------------------------------- Footer */
.footer { padding-block: 3rem 2rem; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.footer a { color: var(--muted-dark); font-size: .92rem; }
.footer a:hover { color: var(--bone); }
.footer h4 { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); margin-bottom: .9rem; }
.footer__links { display: flex; flex-direction: column; gap: .5rem; }
.footer__social { display: flex; flex-direction: column; gap: .5rem; }
.footer__social a { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted-dark); font-family: var(--font-mono); font-size: .8rem; }
.footer__social a:hover { color: var(--bone); }
.footer__social svg { color: var(--steel); flex: 0 0 auto; }
.footer__social a:hover svg { color: var(--bone); }
.footer__bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid var(--line-dark); font-family: var(--font-mono); font-size: .72rem; color: var(--muted-dark); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 720px) { .footer__grid { grid-template-columns: 1fr 1fr; } .footer__brand { grid-column: 1 / -1; } }

/* --------------------------------------------------------------- Empty state */
.empty { text-align: center; padding: clamp(2.5rem, 8vw, 5rem) 1rem; }
.empty__mark { width: 90px; margin: 0 auto 1.2rem; opacity: .5; }
.empty h2 { margin-bottom: .5rem; }

/* --------------------------------------------------------------- Utilidades */
.flex { display: flex; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.gap-sm { gap: .5rem; } .gap { gap: 1rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.6rem; } .mt-4 { margin-top: 2.4rem; }
.mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.6rem; }
.wrap { flex-wrap: wrap; }
.d-inline { display: inline; }
.grow { flex: 1; }

/* --------------------------------------------------------------- Motion */
.js .reveal { opacity: 0; transform: translateY(18px); }
.js .reveal.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
:focus-visible { outline: 3px solid var(--flare); outline-offset: 2px; border-radius: 4px; }
