:root {
  --ink: #111214;
  --ink-2: #1E2125;
  --line-dark: #2C3036;
  --bg: #F2F3F5;
  --card: #FFFFFF;
  --line: #E3E5E9;
  --muted: #5B616B;
  --yellow: #F4C244;
  --gold-text: #7A5A1E;
  --green: #1F7A4D;
  --red: #B3261E;
  --orange: #9A4F00;
  --radius: 18px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--gold-text); }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid #D5D8DD; background: var(--card); font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink); cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-yellow { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--gold-text); min-height: 44px; padding: 0 8px; }
.btn-block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* formularios */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.input { min-height: 48px; border-radius: 14px; border: 1px solid #D5D8DD; background: var(--card); padding: 0 14px; font-size: 16px; color: var(--ink); width: 100%; }
.input:focus, .btn:focus-visible, .chip:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.chip { flex-shrink: 0; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #D5D8DD; background: var(--card); font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; z-index: 100; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.muted { color: var(--muted); }
.price { font-variant-numeric: tabular-nums; }

/* ===== App de administración ===== */
.auth { min-height: 100vh; background: var(--ink); color: #fff; display: flex; flex-direction: column; align-items: center; padding: 56px 24px 24px; }
.auth form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; margin-top: 40px; }
.auth .field { color: #D5D8DD; }
.auth .input { background: var(--ink-2); border-color: var(--line-dark); color: #fff; }
.auth .error { color: #FFB4AB; font-size: 14px; min-height: 20px; }
.auth footer { margin-top: auto; padding-top: 32px; font-size: 12px; color: #8A9099; }

.shell { max-width: 720px; margin: 0 auto; padding: 24px 18px 110px; display: flex; flex-direction: column; gap: 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.topbar h1 { margin: 0; font-size: 26px; font-weight: 800; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--muted); }
.hero { background: var(--ink); color: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.hero .big { font-size: 42px; font-weight: 800; line-height: 1; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.action { border-radius: 18px; padding: 16px; min-height: 100px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; text-decoration: none; font-weight: 800; font-size: 15px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.action.primary { background: var(--yellow); border-color: var(--yellow); }
.action svg { width: 26px; height: 26px; }
.list { display: flex; flex-direction: column; }
.list > * { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid #EEF0F2; }
.list > *:first-child { border-top: none; }
.thumb { width: 52px; height: 52px; border-radius: 12px; background: #F7F7F8; object-fit: contain; flex-shrink: 0; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { border-radius: 16px; padding: 12px; min-height: 84px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.stat strong { font-size: 26px; }
.stat span { font-size: 12px; font-weight: 700; }
.stat.green { color: var(--green); } .stat.red { color: var(--red); } .stat.orange { color: var(--orange); }
.stat[aria-pressed="true"].green { background: #E5F4E4; border: 2px solid var(--green); }
.stat[aria-pressed="true"].red { background: #FBEBEB; border: 2px solid var(--red); }
.stat[aria-pressed="true"].orange { background: #F9ECE7; border: 2px solid var(--orange); }
.drop { border: 2px dashed #C9CDD3; border-radius: 20px; padding: 28px 18px; text-align: center; background: var(--card); display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; }
.drop.over { border-color: var(--ink); background: #FBF6E8; }
.progress { height: 8px; border-radius: 4px; background: #E3E5E9; overflow: hidden; }
.progress > div { height: 100%; background: var(--yellow); width: 0; transition: width .2s; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 20; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 800; }
.tabbar svg { width: 22px; height: 22px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; }
.badge.warn { background: #F9EEDA; color: #6B4F1A; }
.badge.ok { background: #E5F4E4; color: var(--green); }
.linkbox { background: var(--ink); color: #fff; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 8px; word-break: break-all; }
.linkbox a { color: var(--yellow); font-weight: 700; }

/* ===== Catálogo para clientes ===== */
.cat-header { background: var(--ink); color: #fff; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; z-index: 10; }
.cat-header .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1200px; width: 100%; margin: 0 auto; }
.cat-header .logo { height: 64px; width: auto; }
.view-badge { font-size: 12px; font-weight: 800; padding: 6px 10px; border-radius: 10px; background: var(--line-dark); color: var(--yellow); }
.search { display: flex; align-items: center; gap: 10px; min-height: 46px; border-radius: 14px; background: var(--ink-2); border: 1px solid var(--line-dark); padding: 0 14px; flex: 1; }
.search input { flex: 1; border: none; background: transparent; color: #fff; font-size: 16px; outline: none; min-width: 0; }
.cat-main { max-width: 1200px; margin: 0 auto; padding: 14px 16px 120px; display: flex; flex-direction: column; gap: 14px; }
.featured { background: #F6EEDC; border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: none; text-align: left; cursor: pointer; width: 100%; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.brand-title { font-size: 20px; font-weight: 800; margin: 12px 0 0; letter-spacing: .5px; }
.products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .products { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1050px) { .products { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer; }
.pcard .ph { aspect-ratio: 1 / 1; background: #F7F7F8; display: flex; align-items: center; justify-content: center; }
.pcard .ph img { width: 100%; height: 100%; object-fit: contain; }
.pcard .ph img.lowres { width: 70%; height: 70%; }
.pcard .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.pcard .brandline { font-size: 11px; font-weight: 800; color: var(--gold-text); letter-spacing: .5px; }
.pcard .model { font-size: 15px; font-weight: 800; }
.pcard .upc { font-size: 11px; color: var(--muted); }
.prow { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.prow small { font-size: 11px; color: var(--muted); font-weight: 600; }
.prow b { font-size: 15px; }
.prow .sec { font-size: 13px; font-weight: 600; color: var(--muted); }
.fab { position: fixed; right: 18px; bottom: calc(24px + env(safe-area-inset-bottom)); min-height: 54px; padding: 0 20px; border-radius: 27px; background: var(--green); color: #fff; display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; box-shadow: 0 6px 18px rgba(17,18,20,.25); z-index: 15; }
.fab svg { width: 20px; height: 20px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

dialog.sheet { border: none; padding: 0; width: min(560px, 100vw); max-height: 92vh; border-radius: 24px; background: var(--card); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(17,18,20,.55); }
.sheet .gallery { background: #F7F7F8; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; position: relative; }
.sheet .gallery img { width: 100%; height: 100%; object-fit: contain; }
.sheet .thumbs { display: flex; gap: 8px; padding: 10px 16px 0; overflow-x: auto; }
.sheet .thumbs button { width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 2px; cursor: pointer; flex-shrink: 0; }
.sheet .thumbs button[aria-pressed="true"] { border: 2px solid var(--ink); }
.sheet .thumbs img { width: 100%; height: 100%; object-fit: contain; }
.sheet .body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.close-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 22px; border: none; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prices > div { border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.prices > div.dark { background: var(--ink); color: #fff; }
.prices small { font-size: 12px; font-weight: 600; opacity: .8; }
.prices b { font-size: 22px; }
.qty { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 8px 16px; font-weight: 700; }
.qty button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid #D5D8DD; background: #fff; font-size: 20px; font-weight: 700; cursor: pointer; }
.qty input { width: 64px; text-align: center; border: none; font-size: 18px; font-weight: 800; }

/* ===== Impresión / PDF ===== */
#print-area { display: none; }
@media print {
  @page { size: letter; margin: 12mm; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  .pp-cover { height: 240mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10mm; background: var(--ink); color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; page-break-after: always; }
  .pp-cover img { width: 90mm; }
  .pp-slide { height: 240mm; page-break-after: always; display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 10mm; }
  .pp-slide .img { display: flex; align-items: center; justify-content: center; height: 200mm; }
  .pp-slide .img img { width: 100%; height: 200mm; object-fit: contain; }
  .pp-slide h2 { font-size: 26pt; margin: 0 0 4mm; }
  .pp-slide .brand { font-size: 13pt; font-weight: 800; color: var(--gold-text); letter-spacing: 1px; }
  .pp-slide p { margin: 2mm 0; font-size: 12pt; }
  .pp-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .pp-table th { background: var(--ink); color: #fff; text-align: left; padding: 2mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pp-table td { border-bottom: 1px solid #ddd; padding: 1.5mm 2mm; vertical-align: middle; }
  .pp-table img { width: 22mm; height: 22mm; object-fit: contain; }
  .pp-table tr { page-break-inside: avoid; }
  .pp-brand { font-size: 14pt; font-weight: 800; margin: 6mm 0 2mm; }
}
