:root {
  --bg: #0D0E12;
  --surface: #1C1D22;
  --surface-2: #25262D;
  --nav: #14151A;
  --line: #2E3038;
  --text: #F2F2F4;
  --text-2: #D6D7DC;
  --muted: #A1A3AD;
  --faint: #8A8C96;
  --amber: #FF9F0A;
  --amber-line: #5C3A06;
  --amber-bg: #1A140A;
  --green: #30D158;
  --green-line: #1F4D2C;
  --green-bg: #0E1A12;
  --red: #FF453A;
  --red-line: #5C1A16;
  --red-bg: #2A0F0E;
  --display: 'Space Grotesk', ui-rounded, system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-text-size-adjust: 100%; }
body { display: flex; justify-content: center; }
.app { width: 100%; max-width: 480px; height: 100dvh; display: flex; flex-direction: column; position: relative; background: var(--bg); }
@media (min-width: 520px) { .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.top { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px 12px; border-bottom: 1px solid var(--line); min-height: 56px; }
.top h1 { margin: 0; font: 700 20px/1.2 var(--display); flex: 1; }
.top .sub { color: var(--faint); font-size: 13px; }
.back { width: 44px; height: 44px; display: grid; place-items: center; color: var(--text); text-decoration: none; border-radius: 12px; }
.back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wordmark { font: 700 15px/1 var(--display); letter-spacing: .14em; color: var(--amber); }
h2 { margin: 0; font: 700 22px/1.2 var(--display); }
h3 { margin: 0; font: 600 13px/1.2 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
p { margin: 0; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.amber { background: var(--amber-bg); border-color: var(--amber-line); }
.card.green { background: var(--green-bg); border-color: var(--green-line); }
.card.red { background: var(--red-bg); border-color: var(--red-line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .04em; }
.big-id { font: 700 28px/1.1 var(--display); letter-spacing: .04em; }
.code { font: 700 17px/1.3 ui-monospace, 'SF Mono', Menlo, monospace; color: var(--amber); background: var(--bg); border-radius: 10px; padding: 12px; text-align: center; word-break: break-all; }

label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: 400 16px/1.3 var(--body); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px; width: 100%; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.4; }
.check input { width: 24px; height: 24px; min-height: 0; margin: 0; accent-color: var(--amber); flex-shrink: 0; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: 14px; font: 600 16px/1 var(--body); text-decoration: none; border: 1px solid transparent; cursor: pointer; width: 100%; }
.btn-primary { background: var(--amber); color: #1A1204; }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--red-line); color: var(--red); }
.btn-green { background: var(--green); color: #04210C; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .tab:focus-visible, .pill:focus-visible, .back:focus-visible, .listing:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.link { color: var(--amber); background: none; border: 0; font: inherit; padding: 8px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.foot { padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex-shrink: 0; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: 600 14px/1 var(--body); cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #1A1204; }

.listing { display: flex; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.listing .ph { width: 56px; height: 56px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--faint); font-size: 22px; flex-shrink: 0; }
.listing .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.listing .title { font-weight: 600; font-size: 16px; }
.listing .price { color: var(--amber); font-weight: 700; font-size: 15px; }
.listing .meta { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font: 700 11px/1.4 var(--body); letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.amber { color: var(--amber); border-color: var(--amber-line); background: var(--amber-bg); }
.badge.green { color: var(--green); border-color: var(--green-line); background: var(--green-bg); }
.badge.red { color: var(--red); border-color: var(--red-line); background: var(--red-bg); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.kv .k { font-size: 12px; color: var(--faint); }
.kv .v { font-weight: 600; }
.side { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.item .val { color: var(--muted); white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { text-align: center; width: 96px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 22px; cursor: pointer; flex-shrink: 0; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter > div { height: 100%; background: var(--amber); border-radius: 4px; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; line-height: 1.5; }
.err { color: var(--red); font-size: 14px; line-height: 1.4; }
.offline { background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid var(--amber-line); font-size: 13px; padding: 8px 16px; text-align: center; }

.tabbar { display: flex; border-top: 1px solid var(--line); background: var(--nav); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 10px; color: var(--faint); text-decoration: none; font-size: 11px; font-weight: 600; position: relative; min-height: 56px; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--amber); }
.tab-count { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--amber); color: #1A1204; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.toast { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 50; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.scroll > * { flex-shrink: 0; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
