/* Mostrador — sistema visual.
   Base fría y tranquila (papel gris verdoso + tinta petróleo). El color de cada negocio
   entra como --accent y solo marca lo importante: la acción principal y el progreso. */

@font-face { font-family: 'Instrument Sans'; src: url('/fonts/instrument.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('/fonts/bricolage.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --paper: #ECEFED;
  --surface: #FFFFFF;
  --sunken: #E1E7E4;
  --ink: #12262B;
  --ink-2: #47595E;
  --ink-3: #74868A;
  --line: #D2DAD7;
  --accent: #0E6B62;
  --on-accent: #FFFFFF;
  --accent-soft: #E3EFEC;
  --accent-ink: #0B5750;
  --ok: #1B7447;
  --ok-soft: #E0F0E6;
  --warn: #8F5200;
  --warn-soft: #FBEBD0;
  --bad: #AC2F28;
  --bad-soft: #F9E1DE;
  --ui: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --r-s: 8px;
  --r-m: 14px;
  --r-l: 24px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.45 var(--ui); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .num { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.12; }
h1 { font-size: 28px; font-weight: 650; }
h2 { font-size: 21px; font-weight: 620; }
h3 { font-size: 16px; font-weight: 620; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
a { color: var(--accent-ink); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, white); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.boot { padding: 40vh 24px 0; text-align: center; color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ───────── Estructura ───────── */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.shell-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
.shell.owner .shell-main { max-width: 1120px; padding-bottom: 56px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.demo-bar { background: #2B3F45; color: #F4E3B8; font-size: 13px; text-align: center; padding: 5px 12px; }

.topbar { position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff; }
.topbar-in { max-width: 560px; margin: 0 auto; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 8px; min-height: 56px; }
.owner .topbar-in { max-width: 1120px; }
.brand { font-family: var(--display); font-weight: 680; font-size: 19px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,255,255,.16); flex: none; }
.biz-pick { background: none; border: 0; color: #fff; padding: 6px 8px 6px 0; display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 650; font-size: 19px; letter-spacing: -0.02em; min-width: 0; }
.biz-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; color: inherit; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: #F2B33D; border: 2px solid var(--ink); }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Pestañas de negocio (propietario) */
.biz-tabs { background: var(--ink); border-top: 1px solid rgba(255,255,255,.1); position: sticky; top: 56px; z-index: 19; }
.biz-tabs-in { max-width: 1120px; margin: 0 auto; display: flex; gap: 2px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.biz-tabs-in::-webkit-scrollbar { display: none; }
.biz-tab { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 14px; color: rgba(255,255,255,.72); text-decoration: none; font-weight: 550; font-size: 15px; border-bottom: 3px solid transparent; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; }
.biz-tab i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #fff); flex: none; }
.biz-tab[aria-current="page"] { color: #fff; border-bottom-color: var(--c, #fff); }
.biz-tab.add { color: #BFE3DC; }
.sections { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 14px; }
.sections::-webkit-scrollbar { display: none; }

/* Navegación inferior (empleado) */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--nav-h); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink-3); font-size: 12.5px; font-weight: 550; }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] .icon { stroke: var(--accent); stroke-width: 2.3; }

/* ───────── Piezas ───────── */
.panel { background: var(--surface); border-radius: var(--r-m); padding: 16px; }
.panel.flat { padding: 0; overflow: hidden; }
.panel-head { padding: 14px 16px 6px; }
.note { border-radius: var(--r-m); padding: 14px 16px; background: var(--accent-soft); color: var(--ink); }
.note.warn { background: var(--warn-soft); }
.note.bad-note { background: var(--bad-soft); }
ul.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.list.flat-list > li { padding-left: 0; padding-right: 0; }
.list.sunk { background: var(--sunken); }
.list > li.wrap { flex-wrap: wrap; }
.list > li.wrap > .grow { flex: 1 1 180px; }
.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 16px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(.95); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent-ink); padding: 0 10px; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, white); }
.btn.sm { min-height: 38px; font-size: 14.5px; padding: 0 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 13px; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--surface); font-size: 16px; }
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, white); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--bad); background: var(--bad-soft); border-radius: var(--r-s); padding: 10px 12px; font-size: 14.5px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

.chip { flex: none; min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1.5px solid var(--line); background: var(--surface); font-size: 14.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.chip[aria-pressed="true"], .chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--sunken); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { min-height: 42px; border: 0; background: none; border-radius: 9px; font-weight: 600; font-size: 15px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(18,38,43,.14); }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list > li.tap { cursor: pointer; }
.list > li.tap:hover { background: #F6F8F7; }
.list .grow { flex: 1; min-width: 0; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--sunken); flex: none; }
.thumb.lg { width: 72px; height: 72px; border-radius: 12px; }
.thumb.ph { display: grid; place-items: center; color: var(--ink-3); }

.bar { height: 10px; border-radius: 5px; background: var(--sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 5px; background: var(--accent); transition: width .5s ease; }

/* ───────── Empleado: inicio ───────── */
.hello { padding: 6px 2px 0; }
.sell-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 92px; padding: 18px 20px; border: 0; border-radius: var(--r-l); background: var(--accent); color: var(--on-accent); text-align: left; text-decoration: none; }
.sell-cta strong { font-family: var(--display); font-size: 26px; font-weight: 650; letter-spacing: -0.02em; display: block; line-height: 1.1; }
.sell-cta span { font-size: 14.5px; opacity: .9; }
.sell-cta .plus { width: 52px; height: 52px; border-radius: 50%; background: color-mix(in srgb, var(--on-accent) 20%, transparent); display: grid; place-items: center; flex: none; }
.sell-cta .plus .icon { width: 28px; height: 28px; stroke-width: 2.4; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-m); overflow: hidden; }
.stats > div { background: var(--surface); padding: 12px 14px; }
.stats b { display: block; font-family: var(--display); font-size: 24px; font-weight: 640; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stats span { font-size: 13px; color: var(--ink-2); }
.stats.four { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .stats.four { grid-template-columns: repeat(4, 1fr); } }

.level-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.emblem { --size: 64px; width: var(--size); height: var(--size); border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; flex: none; position: relative; }
.emblem svg.art { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.emblem svg.ring { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); transform: rotate(-90deg); }
.emblem.locked { background: var(--sunken); color: var(--ink-3); }
.emblem.lit { background: var(--accent); color: var(--on-accent); }

.slow-strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 0 16px 2px; }
.slow-strip::-webkit-scrollbar { display: none; }
.slow-item { flex: none; width: 116px; background: none; border: 0; padding: 0; text-align: left; }
.slow-item img, .slow-item .ph { width: 116px; height: 116px; border-radius: 12px; object-fit: cover; background: var(--sunken); }
.slow-item b { display: block; font-size: 14px; font-weight: 600; margin-top: 6px; line-height: 1.25; }
.slow-item span { font-size: 13px; color: var(--ink-2); }

/* ───────── Vender ───────── */
.search { position: relative; display: flex; gap: 8px; }
.search .input { padding-left: 44px; border-radius: 12px; }
.search > .icon { position: absolute; left: 14px; top: 13px; color: var(--ink-3); pointer-events: none; }
.tool { width: 48px; height: 48px; flex: none; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 480px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.owner .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { position: relative; background: var(--surface); border-radius: var(--r-m); border: 2px solid transparent; padding: 0; text-align: left; overflow: hidden; display: flex; flex-direction: column; }
.tile img, .tile .ph { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--sunken); }
.tile .ph { display: grid; place-items: center; color: var(--ink-3); font-family: var(--display); font-size: 34px; font-weight: 600; }
.tile-body { padding: 9px 11px 11px; }
.tile-body b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.tile-body .price { font-family: var(--display); font-size: 17px; font-weight: 640; font-variant-numeric: tabular-nums; }
.tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 3px; }
.tile .flag { position: absolute; top: 8px; left: 8px; }
.tile.in-cart { border-color: var(--accent); }
.tile .qty { position: absolute; top: 8px; right: 8px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px; background: var(--accent); color: var(--on-accent); font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.tile.out img { opacity: .55; }
.cart-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 18; padding: 10px 12px; pointer-events: none; }
.owner .cart-bar { bottom: 0; }
.cart-bar-in { pointer-events: auto; max-width: 536px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 16px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 24px rgba(18,38,43,.28); }
.cart-bar-in b { font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; background: var(--sunken); border-radius: 12px; }
.stepper button { width: 42px; height: 42px; border: 0; background: none; font-size: 22px; font-weight: 500; line-height: 1; border-radius: 12px; }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ───────── Hojas (diálogos) ───────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(18,38,43,.5); display: flex; align-items: flex-end; justify-content: center; animation: fade .16s ease; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; max-height: 92dvh; border-radius: var(--r-l) var(--r-l) 0 0; display: flex; flex-direction: column; animation: rise .22s cubic-bezier(.2,.8,.2,1); }
.sheet.wide { max-width: 720px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 12px 8px 20px; }
.sheet-head .icon-btn:hover { background: var(--sunken); }
.sheet-body { padding: 8px 20px calc(20px + var(--safe-b)); overflow-y: auto; }
@media (min-width: 640px) { .sheet-wrap { align-items: center; padding: 24px; } .sheet { border-radius: var(--r-l); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(28px); opacity: 0; } }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; max-width: 480px; box-shadow: 0 6px 20px rgba(18,38,43,.3); animation: rise .2s ease; }
.toast.bad { background: var(--bad); }

.done-mark { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 4px auto 10px; }
.done-mark .icon { width: 36px; height: 36px; stroke-width: 2.6; }
.center { text-align: center; }
.big { font-family: var(--display); font-size: 40px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }

/* ───────── Acceso ───────── */
.gate { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--ink); }
.gate-top { color: #fff; padding: 44px 24px 30px; max-width: 480px; width: 100%; margin: 0 auto; }
.gate-top h1 { font-size: clamp(30px, 9.5vw, 40px); font-weight: 680; letter-spacing: -0.03em; }
.gate-top p { color: rgba(255,255,255,.74); margin-top: 6px; max-width: 30ch; }
.gate-card { background: var(--paper); border-radius: var(--r-l) var(--r-l) 0 0; padding: 26px 24px 36px; }
.gate-card > div { max-width: 432px; margin: 0 auto; }
.lamp-mark { width: 54px; height: 54px; margin-bottom: 18px; }

/* ───────── Propietario ───────── */
.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.biz-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border-radius: var(--r-m); padding: 16px; border-left: 6px solid var(--c); }
.biz-card:hover { box-shadow: 0 2px 10px rgba(18,38,43,.08); }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.kv b { display: block; font-family: var(--display); font-size: 21px; font-weight: 640; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kv span { font-size: 13px; color: var(--ink-2); }
.cols { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .cols { grid-template-columns: 1.4fr 1fr; } .cols.even { grid-template-columns: 1fr 1fr; } }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.chart { max-width: 100%; display: block; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 13px; padding: 6px 9px; border-radius: 8px; pointer-events: none; white-space: nowrap; z-index: 2; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); background: var(--c); padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.level-row { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); align-items: start; }
.level-row:first-of-type { border-top: 0; }
.level-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 720px) { .level-fields { grid-template-columns: 1.4fr 1fr 1fr 1.6fr 44px; align-items: end; } }
.emblem-pick { background: none; border: 0; padding: 0; border-radius: 50%; }
.emblem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px; }
.photo-drop { display: flex; align-items: center; gap: 14px; }
.photo-drop img, .photo-drop .ph { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; background: var(--sunken); display: grid; place-items: center; color: var(--ink-3); flex: none; }
.day-head { font-size: 13px; font-weight: 650; color: var(--ink-2); padding: 14px 16px 6px; background: var(--paper); }
.strike { text-decoration: line-through; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
