:root {
  --bg: #050505;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --text: #fff;
  --muted: #a3a3a3;
  --dim: #737373;
  --yellow: #fde047;
  --yellow-2: #facc15;
  --yellow-soft: rgba(253, 224, 71, 0.12);
  --yellow-line: rgba(253, 224, 71, 0.35);
  --green: #4ade80;
  --red: #f87171;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.glow i { position: absolute; border-radius: 50%; filter: blur(70px); }
.glow i:nth-child(1) { width: 24rem; height: 24rem; right: -8rem; top: -8rem; background: rgba(253, 224, 71, 0.18); }
.glow i:nth-child(2) { width: 18rem; height: 18rem; left: 45%; top: 35%; background: rgba(250, 204, 21, 0.07); }
.glow i:nth-child(3) { width: 20rem; height: 20rem; left: -6rem; bottom: -6rem; background: rgba(115, 115, 115, 0.1); }

.eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--dim);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 13px; background: var(--yellow); color: #000; font-size: 20px;
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.35);
}
.brand-name { white-space: nowrap; font-size: 12px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--yellow); }
.brand-event { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.currency {
  display: flex; padding: 3px; border-radius: 999px;
  border: 1px solid var(--yellow-line); background: rgba(0, 0, 0, 0.4);
}
.currency button {
  min-width: 46px; height: 36px; padding: 0 12px; border: 0; border-radius: 999px;
  background: transparent; font-weight: 900; font-size: 16px; color: var(--muted);
  transition: background .15s, color .15s;
}
.currency button.on { background: var(--yellow); color: #000; }

.sales-btn {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2);
  font-size: 13px; font-weight: 800;
}
.badge {
  min-width: 22px; padding: 2px 7px; border-radius: 999px; text-align: center;
  background: var(--yellow-soft); color: var(--yellow); font-size: 12px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.live { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot.off { background: var(--red); box-shadow: 0 0 10px var(--red); }
.dot.wait { background: var(--yellow-2); }

/* ---------- layout ---------- */
.layout {
  position: relative;
  display: grid; gap: 20px;
  width: 100%; max-width: 1500px; margin: 0 auto;
  padding: 16px 16px calc(96px + var(--safe-b));
}
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) 400px; padding: 24px; align-items: start; }
}
@media (min-width: 1280px) {
  .layout { grid-template-columns: minmax(0, 1fr) 440px; }
}

/* ---------- products ---------- */
.cat + .cat { margin-top: 26px; }
.cat-title {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px 2px;
  font-size: 13px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}
.cat-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }

.product {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  min-height: 128px; padding: 16px; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
  transition: transform .12s, border-color .15s, background .15s;
  user-select: none; -webkit-user-select: none;
}
@media (hover: hover) {
  .product:hover { border-color: var(--yellow-line); background: rgba(255, 255, 255, 0.055); transform: translateY(-2px); }
}
.product:active { transform: scale(0.97); }
.product.in { border-color: rgba(253, 224, 71, 0.75); background: var(--yellow-soft); box-shadow: 0 0 30px rgba(250, 204, 21, 0.14); }
.product.flash { animation: flash .35s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 0 rgba(253, 224, 71, .7); } to { box-shadow: 0 0 0 14px rgba(253, 224, 71, 0); } }
.product-name { font-size: 19px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; }
.product-sub { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--dim); }
.product-price { margin-top: 14px; font-size: 26px; font-weight: 900; letter-spacing: -0.03em; color: var(--yellow); white-space: nowrap; }
.product-price small { font-size: 16px; margin-left: 2px; }
.product-qty[hidden] { display: none !important; }
.product-qty {
  position: absolute; top: 10px; right: 10px; min-width: 30px; height: 30px; padding: 0 8px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--yellow); color: #000; font-weight: 900; font-size: 15px;
}

/* ---------- pay panel ---------- */
.pay {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 18px; border-radius: 28px;
  border: 1px solid rgba(253, 224, 71, 0.22); background: rgba(16, 16, 16, 0.96);
  box-shadow: 0 0 70px rgba(250, 204, 21, 0.1);
}
.pay > * { flex-shrink: 0; }
.pay::before {
  content: ''; position: absolute; left: 32px; right: 32px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(253, 224, 71, .8), transparent);
}
@media (min-width: 960px) {
  .pay { position: sticky; top: 88px; max-height: calc(100svh - 108px); overflow-y: auto; }
  .mobile-only, .mobile-bar { display: none !important; }
}
.pay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pay-total { margin-top: 2px; font-size: 40px; font-weight: 900; letter-spacing: -0.05em; line-height: 1; color: var(--yellow); }
.icon-btn {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-2); font-size: 16px; font-weight: 800;
}

.cart { display: flex; flex-direction: column; gap: 6px; }
.cart:empty { display: none; }
.line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--panel-2);
}
.line-name { font-weight: 800; font-size: 14px; line-height: 1.2; }
.line-name .size { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 6px; background: var(--yellow); color: #000; font-size: 11px; font-weight: 900; }
.line-sum { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35); font-size: 18px; font-weight: 800; line-height: 1;
}
.stepper span { min-width: 22px; text-align: center; font-weight: 900; }
.line-total { font-weight: 900; font-size: 14px; white-space: nowrap; min-width: 64px; text-align: right; }

.qr-box {
  position: relative; display: grid; place-items: center;
  width: 100%; aspect-ratio: 1 / 1; max-height: 360px; margin: 0 auto; padding: 14px;
  border: 0; border-radius: 22px; background: #fff;
}
.qr { width: 100%; height: 100%; display: grid; place-items: center; }
.qr svg { width: 100%; height: 100%; max-width: 330px; max-height: 330px; display: block; }
.qr-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; color: #737373; font-weight: 700; font-size: 15px; text-align: center; }
.hint { text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }

.details { display: grid; gap: 6px; }
.detail {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
}
.detail-k { font-size: 10px; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.detail-v { font-size: 14px; font-weight: 700; word-break: break-all; }
.copy {
  flex: none; padding: 5px 10px; border-radius: 9px; border: 1px solid rgba(253, 224, 71, .2);
  background: var(--yellow-soft); color: var(--yellow); font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase;
}

.actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.btn {
  height: 56px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 900; font-size: 16px;
  transition: transform .1s, opacity .15s, background .15s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.primary { background: var(--yellow); color: #000; border-color: var(--yellow); box-shadow: 0 0 30px rgba(250, 204, 21, 0.25); }
.btn.ghost { background: transparent; }
.btn.small { height: 40px; font-size: 13px; border-radius: 14px; }

/* ---------- mobile ---------- */
.mobile-bar {
  position: fixed; z-index: 15; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 8px 0 18px;
  border-radius: 22px; border: 1px solid var(--yellow-line); background: rgba(17, 17, 17, 0.96);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6), 0 0 40px rgba(250, 204, 21, 0.15);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  text-align: left;
}
.mobile-bar #mobileBarInfo { flex: 1; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-bar strong { font-size: 20px; font-weight: 900; color: var(--yellow); white-space: nowrap; }
.mobile-bar-cta { height: 48px; padding: 0 16px; display: grid; place-items: center; border-radius: 16px; background: var(--yellow); color: #000; font-weight: 900; }
.mobile-bar.empty .mobile-bar-cta { opacity: .35; }

@media (max-width: 959.98px) {
  .pay {
    position: fixed; inset: 0; z-index: 30; border-radius: 0; border: 0; background: #0c0c0c;
    padding: max(16px, env(safe-area-inset-top)) 16px calc(16px + var(--safe-b));
    overflow-y: auto; overscroll-behavior: contain;
    transform: translateY(100%); transition: transform .25s ease;
    visibility: hidden;
  }
  .pay.open { transform: none; visibility: visible; }
  .pay::before { display: none; }
  body.lock { overflow: hidden; }
}

/* ---------- modal / drawer ---------- */
.modal, .drawer {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.modal-card {
  display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 420px; padding: 22px;
  border-radius: 28px; border: 1px solid rgba(253, 224, 71, 0.22); background: #101010;
  box-shadow: 0 0 70px rgba(250, 204, 21, 0.15);
}
.modal-card h2, .drawer-card h2 { font-size: 28px; font-weight: 900; letter-spacing: -0.04em; }
.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sizes button {
  height: 64px; border-radius: 18px; border: 1px solid var(--yellow-line); background: var(--yellow-soft);
  color: var(--yellow); font-size: 20px; font-weight: 900;
}
.sizes button:active { background: var(--yellow); color: #000; }
.sizes button .n { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
#pinInput {
  height: 58px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line); background: #000;
  font-size: 24px; font-weight: 800; letter-spacing: 0.3em; text-align: center;
}
.error { color: var(--red); font-weight: 700; font-size: 14px; }

.drawer { place-items: stretch end; padding: 0; }
.drawer-card {
  width: 100%; max-width: 560px; height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(24px + var(--safe-b));
  background: #0c0c0c; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 16px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.filters { display: flex; gap: 6px; }
.filters button {
  height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; font-weight: 800; font-size: 13px; color: var(--muted);
}
.filters button.on { background: var(--yellow); border-color: var(--yellow); color: #000; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); }
.stat-v { margin-top: 4px; font-size: 24px; font-weight: 900; letter-spacing: -0.03em; color: var(--yellow); }
.stat-s { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.breakdown { display: grid; gap: 6px; }
.bd-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--panel); font-size: 14px; font-weight: 700; }
.bd-row .sizes-sum { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.bd-row strong { color: var(--yellow); font-size: 16px; }
.list-head { display: flex; align-items: center; justify-content: space-between; }
.list-head h3 { font-size: 13px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.list-head .btn { width: auto; }
.sale-list { display: flex; flex-direction: column; gap: 6px; }
.sale { padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); }
.sale.voided { opacity: .45; }
.sale.voided .sale-total { text-decoration: line-through; }
.sale.pending { border-style: dashed; border-color: var(--yellow-line); }
.sale-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sale-total { font-size: 18px; font-weight: 900; color: var(--yellow); white-space: nowrap; }
.sale-meta { font-size: 12px; font-weight: 600; color: var(--dim); }
.sale-items { margin-top: 6px; font-size: 13px; font-weight: 700; color: #e5e5e5; }
.sale-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.tag { padding: 3px 8px; border-radius: 7px; font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; background: var(--panel-2); color: var(--muted); }
.tag.qr { background: var(--yellow-soft); color: var(--yellow); }
.tag.cash { background: rgba(74, 222, 128, .12); color: var(--green); }
.tag.void { background: rgba(248, 113, 113, .14); color: var(--red); }
.void-btn { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: transparent; font-size: 11px; font-weight: 800; color: var(--muted); }
.empty { padding: 24px; text-align: center; color: var(--dim); font-weight: 600; }
.device { display: grid; gap: 6px; margin-top: 8px; }
.device label { font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.device input { height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: #000; font-weight: 700; }

/* ---------- fullscreen QR ---------- */
.qr-full { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #fff; color: #000; padding: 20px; }
.qr-full-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(92vw, 78svh); }
.qr-full .qr svg { max-width: none; max-height: none; }
.qr-full .qr { aspect-ratio: 1 / 1; }
.qr-full-total { font-size: clamp(36px, 8vw, 64px); font-weight: 900; letter-spacing: -0.05em; }
.qr-full-hint { font-size: 15px; font-weight: 700; color: #525252; text-align: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px));
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 999px; background: var(--yellow); color: #000;
  font-weight: 900; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); }

@media (max-width: 420px) {
  .brand > div:last-child { display: none; }
  .sales-btn > span:nth-child(2) { display: none; }
  .product { min-height: 116px; padding: 14px; }
  .product-name { font-size: 17px; }
  .product-price { font-size: 23px; }
}
