:root {
  --bg: #16141c;
  --panel: #2a2633;
  --ink: #f6f5f8;
  --muted: #a8a2b5;
  --line: #3e3950;
  --brand: #5c5470;
  --brand-ink: #ffffff;
  --ok: #7dba7a;
  --bad: #e07a5f;
  --tap: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
a { color: #c8c2d6; text-decoration: none; }
button, input, select, textarea { font: inherit; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.demo-switch {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); right: 8px; z-index: 40;
  display: none; gap: 0; border: 1px solid var(--line); border-radius: 999px;
  background: #110f16; overflow: hidden; font-size: 11px;
}
body.on-login .demo-switch { display: flex; }
.demo-switch button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 10px; min-height: 0; cursor: pointer; font-weight: 650;
}
.demo-switch button.on { background: var(--brand); color: var(--brand-ink); }
header.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px;
  padding: 8px 12px; background: rgba(22, 20, 28, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
header.top .nav-side { display: flex; align-items: center; min-height: 40px; }
header.top .nav-side.right { justify-content: flex-end; }
header.top .brand-logo {
  display: block; height: 36px; width: 36px;
  object-fit: contain; border-radius: 50%;
}
header.top .title {
  margin: 0; font-size: 16px; font-weight: 650; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); cursor: pointer; font-size: 22px; line-height: 1;
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  font-size: 13px; font-weight: 700; text-transform: uppercase;
}
.splash { text-align: center; padding: 28px 8px 8px; }
.splash .brand-logo-lg {
  display: block; width: 128px; height: 128px; margin: 0 auto 16px;
  object-fit: contain; border-radius: 50%;
}
main { flex: 1; padding: 12px 16px 108px; }
nav.tabs {
  position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: #110f16; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a { color: var(--muted); text-align: center; padding: 8px 2px 10px; font-size: 11px; font-weight: 600; }
nav.tabs a.on { color: #e8e4f0; }
h1 { font-size: 22px; font-weight: 650; margin: 4px 0 12px; }
h2 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 18px 0 8px; letter-spacing: 0.02em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 10px; }
a.card { display: block; color: inherit; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.price { font-variant-numeric: tabular-nums; color: #d4cfe0; }
.err { background: #3a221c; color: #ffc9b8; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.okmsg { background: #1c2a1c; color: #c8e6c4; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.ok { color: var(--ok); }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); }
.field { margin: 0 0 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; background: #110f16; color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin: 0;
}
.field input, .field select, .field textarea { margin: 0; }
textarea { min-height: 72px; }
.search-row { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0 0 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 10px; -webkit-overflow-scrolling: touch; }
.chips button {
  flex: 0 0 auto; border: 1px solid var(--line); background: #110f16; color: var(--muted);
  border-radius: 999px; padding: 8px 12px; min-height: 36px; font-size: 13px; font-weight: 650; cursor: pointer;
}
.chips button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.rail { display: flex; gap: 10px; overflow-x: auto; padding: 0 0 12px; -webkit-overflow-scrolling: touch; }
.rail-card {
  flex: 0 0 148px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; color: inherit; min-height: 118px; display: flex; flex-direction: column; justify-content: flex-end;
}
.rail-card .thumb {
  width: 100%; height: 72px; margin: 0 0 8px; border-radius: 10px;
}
.rail-card strong { font-size: 14px; line-height: 1.25; display: block; margin: 0 0 4px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 6px; }
.section-h h2 { margin: 0; }
.thumb.ph { display: flex; align-items: center; justify-content: center; font-size: 22px; color: #8a8498; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
.btn {
  display: block; width: 100%; min-height: var(--tap); border: 0; border-radius: 12px;
  background: var(--brand); color: var(--brand-ink); font-weight: 650; margin: 8px 0; cursor: pointer;
}
.btn.ghost { background: transparent; color: #d8d4e0; border: 1px solid var(--brand); }
.btn.danger { background: var(--bad); color: #1c1914; }
.btn:disabled { opacity: 0.5; }
.btn.tiny { width: auto; min-height: 40px; padding: 0 12px; margin: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.split3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.list-item { display: flex; gap: 12px; align-items: flex-start; }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #110f16; flex-shrink: 0; }
.hero { width: 100%; height: 180px; object-fit: cover; border-radius: 14px; background: #110f16; margin: 0 0 12px; }
.qrbox { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 12px; }
.qrbox canvas { width: 220px; height: 220px; }
#scan-video { width: 100%; border-radius: 12px; background: #000; }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.track-dot { width: 10px; height: 10px; border-radius: 50%; background: #c8c2d6; display: inline-block; margin-right: 6px; }
.track-dot.wait { background: var(--muted); }
.track-dot.here { background: var(--ok); }
.pill.dim { background: #3e3950; color: var(--muted); }
.pill.go { background: #2d4a32; color: #c8e6c4; }
.switch-card { display: flex; gap: 12px; align-items: center; }
.switch {
  flex: 0 0 auto; width: 48px; height: 28px; border: 0; border-radius: 999px;
  background: #3e3950; position: relative; cursor: pointer; padding: 0;
}
.switch.on { background: var(--ok); }
.switch i {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; display: block; transition: left 0.12s;
}
.switch.on i { left: 23px; }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0 0 12px; }
.seg button { border: 0; background: transparent; color: var(--muted); min-height: 44px; font-weight: 650; cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
