/* Phone-first: one column, big touch targets (min 52px), sticky action bar. Plate-blue accent. */
:root {
  --bg: #f3f4f6; --surface: #ffffff; --surface-2: #eceef2; --line: #d9dce3;
  --fg: #16191f; --muted: #5d6472; --accent: #1d4fa3; --accent-fg: #ffffff; --accent-soft: #e3ebf8;
  --ok: #1f7a4a; --ok-soft: #e1f2e8; --warn: #9a5b00; --warn-soft: #fbefd9;
  --bad: #b3261e; --bad-soft: #fae3e1; --off: #7a808c; --off-soft: #e7e8ec;
  --shadow: 0 10px 30px rgba(16, 24, 40, .16);
  --f-display: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tap: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1217; --surface: #171b22; --surface-2: #1f242d; --line: #2c323d;
    --fg: #e8eaee; --muted: #9aa2b1; --accent: #6f9cf0; --accent-fg: #0b1220; --accent-soft: #1b2a45;
    --ok: #5cc58b; --ok-soft: #173326; --warn: #e6a94a; --warn-soft: #3a2a12;
    --bad: #f08a80; --bad-soft: #3d1c1a; --off: #8a909c; --off-soft: #252a33;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 17px; line-height: 1.4; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--muted); }
.wrap { max-width: 720px; margin: 0 auto; padding-inline: 16px; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding-top: env(safe-area-inset-top, 0px); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 720px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-height: 60px; }
.bar h1 { font-size: 24px; flex: 1; min-width: 0; }
.bar .back { width: 44px; height: 44px; border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; margin-left: -8px; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; cursor: pointer; font-size: 20px; }

/* buttons */
.btn { min-height: var(--tap); padding: 0 20px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.big { min-height: 64px; font-size: 20px; font-family: var(--f-display); letter-spacing: .02em; width: 100%; }
.btn.ghost { background: none; border-color: transparent; color: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.fab { position: fixed; left: 16px; right: 16px; width: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 688px; margin: 0 auto; z-index: 9; box-shadow: var(--shadow); }

/* filters */
.filters { display: flex; flex-direction: column; gap: 10px; padding-block: 14px 10px; }
.search { width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .7; margin-left: 4px; }

/* cards */
.cards { display: flex; flex-direction: column; gap: 12px; padding-bottom: 110px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: grid; grid-template-columns: 112px 1fr; }
.card.agotado { opacity: .62; }
.card .ph { position: relative; background: var(--surface-2); min-height: 112px; cursor: pointer; border: 0; padding: 0; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.card .ph .nofoto { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }
.ph-wrap { position: relative; min-height: 112px; }
.ph-wrap .ph { position: absolute; inset: 0; width: 100%; }
.star { position: absolute; top: 6px; left: 6px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: var(--off); font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.star[aria-pressed="true"] { color: #e0a100; }
.btn.share { border-color: var(--accent); color: var(--accent); }
.chip.warn[aria-pressed="true"] { background: var(--warn); border-color: var(--warn); color: #fff; }
.falta { font-size: 14px; font-weight: 600; color: var(--warn); }
.card .ph .nfotos { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 99px; }
.card .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card .top { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.card .title { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; flex: 1; min-width: 0; }
.card .meta { color: var(--muted); font-size: 15px; }
.card .price { font-family: var(--f-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.card .price.none { font-family: var(--f-body); font-weight: 500; font-size: 15px; color: var(--muted); }
.card .actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.card .actions .btn { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn.sold { border-color: var(--bad); color: var(--bad); }
.btn.unsold { border-color: var(--ok); color: var(--ok); }
.cond { flex: none; font-family: var(--f-display); font-weight: 700; font-size: 13px; letter-spacing: .08em; padding: 2px 7px; border-radius: 5px; }
.cond.cero { background: var(--accent); color: var(--accent-fg); }
.cond.usado { border: 1.5px solid var(--fg); }
.tag { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .06em; padding: 2px 8px; border-radius: 6px; }
.tag.agotado { background: var(--bad-soft); color: var(--bad); }
.tag.reservado { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; color: var(--muted); padding: 48px 12px; }
.empty h2 { color: var(--fg); font-size: 22px; margin-bottom: 6px; }

/* form */
.form { display: flex; flex-direction: column; gap: 22px; padding-block: 18px 130px; }
.step { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.form h2 { font-size: 28px; }
.hint { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
.group { display: flex; flex-direction: column; gap: 8px; }
.group > label, .lbl { font-weight: 600; font-size: 16px; }
.group input, .group textarea, .group select { width: 100%; min-height: var(--tap); padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 18px; }
.group textarea { padding: 12px 14px; min-height: 110px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 > * { min-width: 0; }
.toggle2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle2 button { min-height: 64px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: .06em; cursor: pointer; }
.toggle2 button[aria-pressed="true"].cero, .toggle2 button[aria-pressed="true"].on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.toggle2 button[aria-pressed="true"].usado { border-color: var(--fg); box-shadow: inset 0 0 0 2px var(--fg); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; }
.opt[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.price-in { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.price-in .cur { display: flex; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.price-in .cur button { min-width: 64px; border: 0; background: var(--surface); font-weight: 700; cursor: pointer; }
.price-in .cur button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
details.more { border-top: 1px solid var(--line); padding-top: 14px; }
details.more summary { font-weight: 600; color: var(--accent); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
details.more[open] summary { margin-bottom: 16px; }
details.more .inner { display: flex; flex-direction: column; gap: 18px; }

/* photos */
.shoot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shoot label { min-height: 120px; border-radius: 16px; border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 18px; cursor: pointer; text-align: center; padding: 10px; }
.shoot label .ico { font-size: 34px; line-height: 1; }
.shoot label.disabled { opacity: .4; pointer-events: none; }
.shoot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-2); max-width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge { position: absolute; left: 6px; top: 6px; background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.thumb .tb { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 6px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.thumb .tb button { min-width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255,255,255,.92); color: #16191f; font-weight: 700; cursor: pointer; font-size: 13px; padding: 0 8px; }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* sticky footer for forms */
.foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; background: var(--bg); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
.foot-in { max-width: 688px; margin: 0 auto; display: flex; gap: 10px; }
.foot-in .btn { flex: 1; }
.foot-in .btn.primary { flex: 2; }

/* login */
.login { max-width: 420px; margin: 0 auto; padding: calc(12vh + env(safe-area-inset-top, 0px)) 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.login h1 { font-size: 34px; }
.msg { padding: 12px 14px; border-radius: 12px; font-weight: 500; font-size: 15px; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }

/* menu sheet */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--surface); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; max-width: 720px; margin: 0 auto; }
.sheet .btn { width: 100%; justify-content: flex-start; }
.sheet .who { color: var(--muted); font-size: 14px; padding: 4px 4px 8px; overflow-wrap: anywhere; }

/* import */
.drop { border: 2px dashed var(--line); border-radius: 16px; padding: 24px 16px; text-align: center; color: var(--muted); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 50vh; overflow-y: auto; }
table.prev { border-collapse: collapse; font-size: 14px; width: 100%; }
table.prev th, table.prev td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.prev th { background: var(--surface-2); position: sticky; top: 0; }
table.prev tr.dup td { color: var(--off); text-decoration: line-through; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input { width: 22px; height: 22px; }

/* progress + toast */
.progress { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 20, .55); display: grid; place-items: center; padding: 16px; }
.progress .box { background: var(--surface); border-radius: 18px; padding: 24px; width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.progress .track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 520px; margin: 0 auto; z-index: 60; background: var(--fg); color: var(--bg); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; font-weight: 600; box-shadow: var(--shadow); }
.toast span { flex: 1; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 40px; padding: 0 6px; }

@media (min-width: 560px) {
  .card { grid-template-columns: 160px 1fr; }
  .card .ph, .ph-wrap { min-height: 140px; }
  .thumbs { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
