/* Panel HOPE — misma identidad que la tienda (vino, dorado, Cormorant + Manrope), pensado primero para el celular. */
:root {
  --paper: #FBF8F3; --ivory: #F4EEE4; --sand: #E9E0D2; --line: #E6DCCD;
  --ink: #1E1A17; --ink-2: #4A423B; --muted: #857A6F;
  --copper: #A0643A; --gold: #D9B48A; --wine: #5B1A26; --wine-2: #3A0F18; --wine-3: #7E2434; --ok: #2F6B47; --danger: #A3242C;
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

.boot { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px; }
.boot b { font: 500 46px/1 var(--serif); letter-spacing: .2em; color: var(--copper); }
.boot span { color: var(--muted); }
.boot.err span { color: var(--danger); max-width: 46ch; }

/* Encabezado */
.top { position: sticky; top: 0; z-index: 20; padding: 16px 16px 0; color: #FFF7EE; background: radial-gradient(120% 140% at 100% 0%, var(--wine-3), var(--wine) 45%, var(--wine-2)); box-shadow: 0 10px 30px -18px rgba(42, 11, 18, .8); }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand b { font: 500 26px/1 var(--serif); letter-spacing: .22em; color: var(--gold); }
.brand span { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: rgba(247, 239, 230, .72); }
.demo { margin: 10px 0 0; padding: 7px 12px; border-radius: 10px; font-size: 12.5px; color: #2A0B12; background: var(--gold); }
.tabs { display: flex; gap: 6px; margin-top: 14px; }
.tabs button { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px 13px; border-radius: 14px 14px 0 0; font-weight: 700; font-size: 14px; color: rgba(247, 239, 230, .78); transition: background .3s, color .3s; }
.tabs button[aria-selected="true"] { color: var(--wine); background: var(--paper); }
.tabs .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 138, .3); }
.tabs button[aria-selected="true"] .dot { background: var(--copper); }

/* Herramientas */
.tools { display: grid; gap: 10px; padding: 14px 16px 6px; max-width: 980px; margin: 0 auto; }
.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-radius: 99px; background: #fff; border: 1px solid var(--line); }
.search:focus-within { border-color: var(--copper); box-shadow: 0 0 0 3px rgba(160, 100, 58, .12); }
.search svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 7px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid var(--line); transition: background .25s, color .25s, border-color .25s; }
.chips button[aria-pressed="true"] { color: #fff; background: var(--wine); border-color: var(--wine); }
.chips.small button { padding: 6px 12px; font-size: 12.5px; }
.actions { display: flex; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 99px; font-weight: 700; font-size: 14px; white-space: nowrap; transition: transform .25s var(--ease), background .25s, opacity .25s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn.wine { color: #fff; background: var(--wine); }
.btn.gold { color: #2A0B12; background: linear-gradient(135deg, #F3DCBC, var(--gold) 55%, #B9844F); box-shadow: 0 10px 22px -14px rgba(185, 132, 79, .9); }
.btn.ghost { color: var(--ink); border: 1px solid var(--line); background: #fff; }

/* Lista */
.list { max-width: 980px; margin: 0 auto; padding: 4px 16px 120px; }
.gh { display: flex; align-items: baseline; gap: 10px; margin: 22px 2px 10px; font: 600 26px/1.1 var(--serif); }
.gh span { font: 700 12px var(--sans); color: var(--muted); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.card { margin-bottom: 10px; padding: 14px; border-radius: 18px; background: #fff; border: 1px solid var(--line); transition: border-color .3s, box-shadow .3s; }
.card.has-edit { border-color: rgba(160, 100, 58, .55); box-shadow: 0 10px 24px -18px rgba(160, 100, 58, .8); }
.ch { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ch img, .ch .noimg { width: 46px; height: 58px; flex: none; border-radius: 10px; object-fit: cover; background: var(--ivory); }
.ch b { display: block; font: 600 19px/1.15 var(--serif); }
.ch small { color: var(--muted); font-size: 12.5px; }

/* Precios */
.prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pf { display: grid; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--paper); border: 1px solid transparent; transition: background .25s, border-color .25s; }
.pf.k-ws { background: #F7F0EC; }
.pf.changed { background: #FFF7EA; border-color: rgba(160, 100, 58, .55); }
.pl { display: flex; align-items: baseline; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pl s { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.pin { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.pin:focus-within { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(91, 26, 38, .12); }
.pin i { font-style: normal; color: var(--muted); }
.pin input { width: 100%; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf.changed .pin input { color: var(--wine); }
.hint { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.hint.link { color: var(--ok); }
.hint svg { width: 13px; height: 13px; }

/* Barra de guardar */
.savebar { position: fixed; left: 50%; bottom: 16px; z-index: 30; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; width: min(640px, calc(100% - 24px)); padding: 8px 8px 8px 18px; border-radius: 99px; color: #fff; background: rgba(28, 20, 18, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 20px 44px -18px rgba(0, 0, 0, .6); animation: up .45s var(--ease); }
.savebar span { flex: 1; font-weight: 600; font-size: 14px; }
.savebar .ghost { color: #fff; background: transparent; border-color: rgba(255, 255, 255, .25); height: 42px; }
.savebar .wine { height: 42px; background: var(--gold); color: #2A0B12; }
@keyframes up { from { transform: translate(-50%, 120%); } to { transform: translate(-50%, 0); } }

/* Stock */
.stocks { display: grid; gap: 8px; }
.sf { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 14px; background: var(--paper); }
.sl { display: grid; font-weight: 700; font-size: 14px; }
.sl em { font-style: normal; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.sf.m-out .sl em { color: var(--danger); }
.sf.m-qty .sl em { color: var(--ok); }
.sf.low .sl em { color: var(--copper); }
.seg { display: flex; padding: 3px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.seg button { padding: 7px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); transition: background .25s, color .25s; }
.seg button[aria-pressed="true"] { color: #fff; background: var(--wine); }
.sf.m-out .seg button[aria-pressed="true"] { background: var(--danger); }
.sf.m-free .seg button[aria-pressed="true"] { background: var(--ok); }
.qty { grid-column: 1 / -1; display: flex; align-items: center; justify-self: start; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.qty button { width: 44px; height: 44px; font-size: 22px; color: var(--wine); }
.qty input { width: 64px; height: 44px; border: 0; outline: 0; text-align: center; font-size: 18px; font-weight: 800; background: none; }

/* Hoja "Subir precios" */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(20, 10, 12, 0); transition: background .25s; }
.sheet.on { background: rgba(20, 10, 12, .45); }
.sh-in { width: min(620px, 100%); max-height: 92vh; overflow: auto; padding: 20px 20px 16px; border-radius: 24px 24px 0 0; background: var(--paper); transform: translateY(100%); transition: transform .35s var(--ease); }
.sheet.on .sh-in { transform: none; }
.sh-in header { display: flex; align-items: center; justify-content: space-between; }
.sh-in h3 { margin: 0; font: 600 30px/1.1 var(--serif); }
.x { width: 38px; height: 38px; border-radius: 50%; font-size: 24px; color: var(--muted); background: #fff; border: 1px solid var(--line); }
.sh-lead { color: var(--ink-2); font-size: 14px; margin: 8px 0 14px; }
.fld { display: grid; gap: 8px; margin-bottom: 14px; }
.fld > span { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pct { display: flex; align-items: center; gap: 6px; width: max-content; padding: 4px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.pct button { width: 42px; height: 42px; border-radius: 10px; font-size: 22px; color: var(--wine); }
.pct input { width: 70px; border: 0; outline: 0; text-align: right; font-size: 26px; font-weight: 800; background: none; }
.pct b { font-size: 20px; margin-right: 6px; }
.fld select { height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.checks input { width: 18px; height: 18px; accent-color: var(--wine); }
.prev { border-radius: 16px; background: #fff; border: 1px solid var(--line); padding: 12px 14px; }
.prev-n { margin: 0 0 6px; font-size: 13.5px; }
.prev ul { list-style: none; margin: 0; padding: 0; max-height: 34vh; overflow: auto; }
.prev li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.prev li span { display: grid; min-width: 0; }
.prev li small { color: var(--muted); font-size: 11.5px; }
.prev li em { font-style: normal; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.prev li em b { color: var(--wine); }
.sh-in footer { position: sticky; bottom: -16px; display: flex; gap: 8px; justify-content: flex-end; margin: 14px -20px -16px; padding: 12px 20px 16px; background: var(--paper); border-top: 1px solid var(--line); }

#toast { position: fixed; left: 50%; bottom: 84px; z-index: 60; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; font-size: 14px; color: #fff; background: rgba(28, 20, 18, .92); transition: transform .35s var(--ease), opacity .35s; }
#toast.on { transform: translate(-50%, 0); opacity: 1; }
#toast.err { background: var(--danger); }

@media (min-width: 760px) {
  .top { padding: 20px 28px 0; }
  .tools { padding: 18px 28px 6px; grid-template-columns: minmax(260px, 1fr) auto; align-items: center; }
  .tools .chips { grid-column: 1 / -1; grid-row: 2; }
  .list { padding: 4px 28px 120px; }
  .card { display: grid; grid-template-columns: 260px 1fr; align-items: center; gap: 16px; }
  .ch { margin: 0; }
  .sheet { align-items: center; }
  .sh-in { border-radius: 24px; }
}
@media (max-width: 560px) {
  .prices { grid-template-columns: 1fr 1fr; }
  .pf.k-ws { grid-column: 1 / -1; }
  .sf { grid-template-columns: 1fr; }
  .seg { justify-self: stretch; }
  .seg button { flex: 1; }
  .savebar { gap: 6px; padding: 8px; bottom: 12px; }
  .savebar span { padding-left: 8px; font-size: 12.5px; line-height: 1.2; }
  .savebar .btn { padding: 0 14px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Avisos de error y barra de guardar por encima del asistente del admin */
.errbar { max-width: 980px; margin: 8px auto 0; padding: 12px 16px; border-radius: 14px; font-size: 13.5px; color: #fff; background: var(--danger); }
.embedded .savebar { bottom: 74px; }
.embedded #toast { bottom: 140px; }
