/* =========================================================
   Mayorista — sistema visual
   Tinta oscura + amarillo "tensión" sobre papel cálido.
   ========================================================= */

:root {
  --ink: #14181f;
  --ink-2: #1e242e;
  --ink-3: #2a313c;
  --ink-line: #333b48;
  --ink-text: #c9ced6;

  --paper: #f3f2ee;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --media: #c1c1bd; /* fondo de las fotos de producto (las imágenes traen este mismo tono) */
  --line: #e2e0d9;
  --line-strong: #cfccc3;

  --text: #191c21;
  --muted: #5f6570;
  --faint: #6b717b;

  --volt: #ffcf2e;
  --volt-strong: #f5bf00;
  --volt-soft: #fff4c7;
  --volt-ink: #1d1700;

  --blue: #2350c8;
  --blue-soft: #e8eefc;
  --ok: #17804a;
  --ok-soft: #e3f4ea;
  --warn: #9a6300;
  --warn-soft: #fdf1d8;
  --bad: #b8322a;
  --bad-soft: #fbe7e5;
  --wa: #128c4a;
  --wa-hover: #0f7a40;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .05), 0 4px 14px rgba(20, 24, 31, .05);
  --shadow-lift: 0 2px 4px rgba(20, 24, 31, .06), 0 14px 32px rgba(20, 24, 31, .10);

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --gutter: clamp(16px, 3vw, 32px);
  --maxw: 1320px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%; scroll-padding-top: 90px;
  accent-color: var(--ink); caret-color: var(--ink);
  scrollbar-color: var(--line-strong) transparent;
}
::placeholder { color: var(--faint); opacity: 1; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }
body > * { flex-shrink: 0; }
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--volt); color: var(--volt-ink); }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--volt); color: var(--volt-ink); padding: 8px 14px; border-radius: 8px; font-weight: 700; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.page { padding-block: 22px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand__mark {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 10px; background: var(--volt); color: var(--volt-ink);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.brand__text { display: grid; line-height: 1.1; min-width: 0; }
.brand__name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__tag { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; opacity: .65; font-weight: 600; }
.brand__logo { max-height: 46px; width: auto; }

/* ---------- Cabecera ---------- */
.masthead {
  background: var(--ink);
  color: #fff;
  border-bottom: 3px solid var(--volt);
  position: relative;
  overflow: hidden;
}
.masthead__inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: 18px 32px; padding-block: 22px 24px;
}
.masthead .brand { color: #fff; }
.masthead__title { min-width: 0; }
.masthead h1 { font-size: clamp(24px, 3.2vw, 34px); font-weight: 800; letter-spacing: -.025em; }
.masthead .lead { color: var(--ink-text); margin-top: 6px; max-width: 60ch; font-size: 14.5px; }
.masthead__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center; }
.masthead--compact .masthead__inner { padding-block: 14px; }


/* ---------- Botones ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg);
  font-weight: 700; font-size: 14px; line-height: 1; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { --b-bd: var(--text); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn--primary { --b-bg: var(--volt); --b-fg: var(--volt-ink); --b-bd: var(--volt); }
.btn--primary:hover { --b-bg: var(--volt-strong); --b-bd: var(--volt-strong); }
.btn--dark { --b-bg: var(--ink); --b-fg: #fff; --b-bd: var(--ink); }
.btn--dark:hover { --b-bg: var(--ink-3); --b-bd: var(--ink-3); }
.btn--wa { --b-bg: var(--wa); --b-fg: #fff; --b-bd: var(--wa); }
.btn--wa:hover { --b-bg: var(--wa-hover); --b-bd: var(--wa-hover); }
.btn--ghost { --b-bg: transparent; --b-bd: transparent; }
.btn--ghost:hover { --b-bg: rgba(20,24,31,.06); --b-bd: transparent; }
.btn--danger { --b-fg: var(--bad); --b-bd: #e9c3bf; }
.btn--danger:hover { --b-bg: var(--bad-soft); --b-bd: var(--bad); }
.btn--sm { min-height: 34px; padding: 0 13px; font-size: 13px; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: 15.5px; }
.btn--block { width: 100%; }
.masthead .btn:not(.btn--primary):not(.btn--wa) { --b-bg: rgba(255,255,255,.06); --b-fg: #fff; --b-bd: rgba(255,255,255,.22); }
.masthead .btn:not(.btn--primary):not(.btn--wa):hover { --b-bg: rgba(255,255,255,.14); --b-bd: rgba(255,255,255,.5); }

.link-quiet { color: inherit; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.link-quiet:hover { text-decoration: underline; }

/* ---------- Superficies ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(16px, 2.2vw, 24px);
}
.panel--flush { padding: 0; overflow: hidden; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.panel__head h2 { font-size: 18px; font-weight: 800; }
.panel__head p { color: var(--muted); font-size: 13.5px; }
.panel--flush .panel__head { padding: 18px 20px 0; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- Avisos ---------- */
.notice {
  border-radius: var(--radius-sm); padding: 12px 16px; font-weight: 600; font-size: 14px;
  border: 1px solid; display: flex; gap: 10px; align-items: flex-start;
}
.notice--ok { background: var(--ok-soft); border-color: #b9e0c8; color: #0f5a33; }
.notice--error { background: var(--bad-soft); border-color: #efc4bf; color: #8a221b; }
.notice--warn { background: var(--warn-soft); border-color: #f0d59a; color: #6d4600; }
.notice--info { background: var(--blue-soft); border-color: #c8d5f5; color: #1b3d99; }
.notice a { color: inherit; font-weight: 800; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--text); }
.field small, .hint { color: var(--muted); font-size: 12.5px; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 207, 46, .55); }
.input--lg { min-height: 52px; font-size: 16px; padding-left: 46px; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23191c21' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; align-items: start; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 40px; }
.input-affix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }

.search { position: relative; }
.search .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ---------- Chips / filtros ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip__count { font-family: var(--mono); font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.chip[aria-pressed="true"] .chip__count { background: var(--volt); color: var(--volt-ink); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.35;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--info { background: var(--blue-soft); color: var(--blue); }
.badge--muted { background: #eeede8; color: var(--muted); }
.badge--volt { background: var(--volt); color: var(--volt-ink); }
.badge--ink { background: var(--ink); color: #fff; }
.count-pill { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--volt); color: var(--volt-ink); font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }

/* ---------- Barra de catálogo ---------- */
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.toolbar__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar__row .chips { min-width: 0; flex: 0 1 auto; }
.select--auto { width: auto; min-width: 180px; }
.toolbar__meta { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.meta-pill strong { color: var(--text); }
.results-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; font-size: 14px; color: var(--muted); padding-inline: 2px; }
.results-line strong { color: var(--text); }

/* ---------- Tarjetas de producto ---------- */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.pcard {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.pcard:hover { box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.pcard__media { position: relative; aspect-ratio: 4 / 3; background: var(--media); border-bottom: 1px solid var(--line); overflow: hidden; }
/* fotos que se dejan con fondo blanco estándar (uploads/products/catalogo-blanco/): tarjeta blanca entera */
.pcard__media:has(img[src*="/catalogo-blanco/"]) { background: #fff; }
.pcard__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.pcard__placeholder { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; color: #3f444d; text-align: center; }
.pcard__placeholder .ph-brand { font-weight: 800; font-size: 20px; color: #5f5d58; letter-spacing: -.02em; text-transform: uppercase; }
.pcard__placeholder .ph-note { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.pcard__flags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.pcard__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard__meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12px; }
.pcard__sku, .row-link.mono { white-space: nowrap; }
.pcard__sku { font-family: var(--mono); font-weight: 600; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 2px 7px; border-radius: 5px; user-select: all; }
.pcard__brand { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-size: 11.5px; text-align: right; }
.pcard__name { font-size: 14.5px; font-weight: 700; line-height: 1.3; text-transform: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard__desc { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard__price { margin-top: auto; padding-top: 6px; }
.price { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price-unit { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.pcard__locked {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.pcard__locked:hover { background: var(--volt-soft); border-color: var(--volt-strong); }
.pcard__locked .icon { flex: none; color: var(--muted); }
.price-old { color: var(--faint); text-decoration: line-through; font-size: 13px; font-weight: 600; margin-left: 6px; }
.price-note { color: var(--faint); font-size: 11.5px; }
.pcard__terms { display: flex; gap: 6px; flex-wrap: wrap; }
.term { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.term b { color: var(--text); font-variant-numeric: tabular-nums; }
.pcard__stock { font-size: 12px; font-weight: 700; color: var(--warn); }
.pcard__buy { display: grid; grid-template-columns: 118px 1fr; gap: 8px; margin-top: 4px; }
.pcard.in-cart { border-color: var(--volt-strong); box-shadow: 0 0 0 1px var(--volt-strong), var(--shadow); }
.in-cart-note { font-size: 12.5px; font-weight: 600; color: var(--ok); display: flex; gap: 6px; align-items: center; }
.in-cart-note b { font-variant-numeric: tabular-nums; }
.link-btn { margin-left: auto; border: 0; background: none; padding: 4px 2px; font-weight: 700; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--bad); }

/* Selector de cantidad */
.qty { display: grid; grid-template-columns: 34px 1fr 34px; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--surface); height: 42px; }
.qty button { border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text); }
.qty button:hover { background: var(--surface-2); }
.qty input { border: 0; text-align: center; width: 100%; min-width: 0; font-weight: 700; font-variant-numeric: tabular-nums; background: transparent; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; }
.qty:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 207, 46, .55); }

.load-more { display: flex; justify-content: center; padding-top: 8px; }

/* Resumen de pedido flotante (cabecera de catálogo) */
.order-chip {
  display: grid; gap: 2px; text-align: left; padding: 9px 16px; border-radius: 12px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); color: #fff; min-width: 150px;
}
.order-chip small { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-text); font-weight: 700; }
.order-chip strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.order-chip span { font-size: 12.5px; color: var(--ink-text); font-variant-numeric: tabular-nums; }

.cartbar {
  position: sticky; bottom: 12px; z-index: 20;
  display: none; align-items: center; gap: 14px; justify-content: space-between;
  background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 10px 10px 18px;
  box-shadow: 0 10px 30px rgba(20,24,31,.3);
}
.cartbar.is-visible { display: flex; animation: rise .25s var(--ease); }
.cartbar__info { display: grid; line-height: 1.2; }
.cartbar__info small { color: var(--ink-text); font-size: 12px; font-weight: 600; }
.cartbar__info strong { font-size: 17px; font-variant-numeric: tabular-nums; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Tablas ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfaf7; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .strong { font-weight: 700; }
.table .cell-name { min-width: 240px; }
.table .cell-name small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.table input.input { min-height: 38px; padding: 6px 10px; }
.table .thumb { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--media); object-fit: contain; padding: 1px; }
.table .thumb[src*="/catalogo-blanco/"] { background: #fff; }
.table .thumb--empty { display: grid; place-items: center; color: var(--faint); }
.row-link { color: inherit; text-decoration: none; font-weight: 700; }
.row-link:hover { text-decoration: underline; }

/* ---------- Indicadores ---------- */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 4px; align-content: start; }
.stat__label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat__sub { font-size: 12.5px; color: var(--muted); }
.stat--volt { background: var(--volt-soft); border-color: #f3df93; }
.stat--ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat--ink .stat__label, .stat--ink .stat__sub { color: var(--ink-text); }

.delta-up { color: var(--bad); font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.delta-down { color: var(--ok); font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }

/* ---------- Accesos (panel cliente) ---------- */
.tile {
  display: grid; gap: 10px; align-content: start; padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
.tile:hover { box-shadow: var(--shadow-lift); border-color: var(--line-strong); transform: translateY(-2px); }
.tile h2 { font-size: 22px; font-weight: 800; }
.tile p { color: var(--muted); }
.tile__icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.tile--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.tile--primary p { color: var(--ink-text); }
.tile--primary .tile__icon { background: var(--volt); color: var(--volt-ink); border-color: var(--volt); }
.tile__cta { display: inline-flex; gap: 8px; align-items: center; font-weight: 800; margin-top: 6px; }

/* ---------- Pedido / resumen ---------- */
.summary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.summary__row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.summary__row span:first-child { color: var(--muted); }
.summary__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.summary__total strong { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.layout-aside > aside { position: sticky; top: 16px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

.order-card { display: grid; grid-template-columns: 1.2fr auto .7fr 1fr auto; gap: 12px 20px; align-items: center; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.order-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.order-card small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.order-card strong { font-size: 15.5px; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 48px 20px; display: grid; gap: 10px; justify-items: center; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 18px; }
.empty .icon { color: var(--faint); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--paper); }
.auth__side { background: var(--ink); color: #fff; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth__side .brand { color: #fff; }
.auth__pitch h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 800; letter-spacing: -.03em; max-width: 14ch; }
.auth__pitch p { color: var(--ink-text); margin-top: 14px; max-width: 46ch; font-size: 15.5px; }
.auth__points { display: grid; gap: 10px; color: var(--ink-text); font-size: 14px; }
.auth__points li { display: flex; gap: 10px; align-items: center; }
.auth__points li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--volt); transform: rotate(45deg); flex: none; }
.auth__points { list-style: none; margin: 0; padding: 0; }
.auth__main { display: grid; place-items: center; padding: clamp(24px, 5vw, 64px) var(--gutter); }
.auth__card { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.auth__card h2 { font-size: 26px; font-weight: 800; }
.auth__card > p { color: var(--muted); }

/* ---------- Pie ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 20px; font-size: 13px; color: var(--muted); }
.site-footer .brand__mark { width: 30px; height: 30px; border-radius: 8px; }
.site-footer .brand__mark svg { width: 17px; height: 17px; }
.site-footer .brand__name { font-size: 15px; color: var(--text); }
.site-footer__note { max-width: 52ch; }

/* ---------- Administración ---------- */
body.admin { background: var(--paper); }
.admin-shell { display: grid; grid-template-columns: 258px minmax(0, 1fr); min-height: 100vh; }
.admin-nav { background: var(--ink); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.admin-nav__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-inline: 6px; }
.admin-nav .brand { color: #fff; }
.admin-nav__toggle { display: none; }
.admin-menu { display: grid; gap: 3px; }
.admin-menu__link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--ink-text); text-decoration: none; font-weight: 600; font-size: 14px; transition: background .15s var(--ease), color .15s var(--ease); }
.admin-menu__link:hover { background: var(--ink-2); color: #fff; }
.admin-menu__link.is-active { background: var(--ink-3); color: #fff; }
.admin-menu__link.is-active .icon { color: var(--volt); opacity: 1; }
.admin-menu__link .icon { flex: none; opacity: .9; }
.admin-menu__sep { height: 1px; background: var(--ink-line); margin: 10px 6px; }
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px 24px; padding: 28px clamp(18px, 3vw, 36px) 6px; }
.admin-head h1 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; letter-spacing: -.025em; }
.admin-head .lead { color: var(--muted); margin-top: 6px; max-width: 70ch; font-size: 14.5px; }
.admin-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-content { padding: 18px clamp(18px, 3vw, 36px) 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .field { min-width: 160px; }
.filters .field--grow { flex: 1; min-width: 220px; }

.bulkbar { display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 12px; position: sticky; top: 10px; z-index: 5; }
.bulkbar.is-visible { display: flex; }
.bulkbar .select { min-height: 36px; padding-block: 4px; width: auto; color: var(--text); }
.bulkbar .input { min-height: 36px; width: 110px; color: var(--text); }

.codebox { font-family: var(--mono); font-size: 13px; background: var(--ink); color: #e8ecf2; border-radius: 10px; padding: 14px 16px; overflow-x: auto; white-space: pre; line-height: 1.6; }
.codebox b { color: var(--volt); font-weight: 600; }
.steps { counter-reset: step; display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--volt); font-weight: 800; display: grid; place-items: center; font-size: 13px; }

.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; padding: 14px 16px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; }
.formula code { font-family: var(--mono); background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 6px; font-size: 14px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }

/* ---------- Toasts ---------- */
.toast-host { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { --dot: var(--volt); display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 11px 18px 11px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 10px 28px rgba(20,24,31,.28); animation: rise .22s var(--ease); transition: opacity .3s var(--ease), transform .3s var(--ease); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--dot); flex: none; }
.toast--warn { --dot: #f0a400; }
.toast--error { --dot: #ff6b5e; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .admin-content .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-aside { grid-template-columns: minmax(0, 1fr); }
  .layout-aside > aside { position: static; }
  .masthead__inner { grid-template-columns: 1fr auto; }
  .masthead__title { grid-column: 1 / -1; grid-row: 2; }
  .masthead__actions { grid-column: 2; grid-row: 1; }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { position: sticky; top: 0; z-index: 30; height: auto; padding: 12px 14px; flex-direction: column; gap: 0; border-bottom: 3px solid var(--volt); }
  .admin-nav__toggle { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--ink-line); background: var(--ink-2); color: #fff; font-weight: 700; cursor: pointer; }
  .admin-menu { display: none; padding-top: 12px; }
  .admin-nav.is-open .admin-menu { display: grid; }
  .auth { grid-template-columns: 1fr; }
  .auth__side { border-bottom: 3px solid var(--volt); gap: 22px; }
  .auth__points { display: none; }
  .order-card { grid-template-columns: 1fr auto; }
  .order-card > :nth-child(3), .order-card > :nth-child(5) { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .masthead__inner { grid-template-columns: 1fr; gap: 14px; padding-block: 16px 18px; }
  .masthead__actions { grid-column: 1; grid-row: 3; justify-content: flex-start; }
  .masthead .lead { font-size: 13.5px; }
  .masthead .order-chip { display: none; } /* en celular el resumen va en la barra inferior */
  .toolbar__row .chips { flex: 1 1 100%; }
  .toolbar__row .spacer { display: none; }
  .select--auto { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .filters .field, .filters .field--grow { flex: 1 1 100%; min-width: 0; }
  .filters > .btn { flex: 1; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard__media img { padding: 4px; }
  .pcard__meta { flex-wrap: wrap; }
  .pcard__terms .term { font-size: 11.5px; padding: 2px 6px; }
  .cartbar { bottom: 8px; }
  /* Pedido actual: cada fila se vuelve una tarjeta compacta */
  .table--cart thead { display: none; }
  .table--cart, .table--cart tbody { display: block; }
  .table--cart tr { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table--cart tbody tr:last-child { border-bottom: 0; }
  .table--cart td { padding: 0; border: 0; }
  .table--cart tbody tr:hover td { background: none; }
  .table--cart td:first-child { grid-column: 1 / -1; grid-row: 1; }
  .table--cart .cell-name { grid-column: 1 / -1; grid-row: 2; min-width: 0; margin-top: -4px; }
  .table--cart .cell-price { grid-column: 1; grid-row: 3; text-align: left; color: var(--muted); }
  .table--cart .cell-sub { grid-column: 2; grid-row: 3; }
  .table--cart .cell-qty { grid-column: 1; grid-row: 4; }
  .table--cart .cell-remove { grid-column: 2; grid-row: 4; justify-self: end; }
  .pcard__body { padding: 12px; gap: 6px; }
  .pcard__name { font-size: 13.5px; }
  .price { font-size: 18px; }
  .pcard__buy { grid-template-columns: 1fr; }
  .pcard__desc { display: none; }
  .stat__value { font-size: 21px; }
  .order-chip { min-width: 0; }
  .table th, .table td { padding: 10px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 340px) {
  .products { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .masthead, .site-footer, .admin-nav, .no-print, .cartbar { display: none !important; }
  body, .panel { background: #fff; box-shadow: none; }
}
