:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #15201d;
  --muted: #5d6b67;
  --line: #dfe5e3;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3f0;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1f7a3a;
  --ok-soft: #e5f5ea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 22, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513;
    --card: #17201e;
    --text: #e8efed;
    --muted: #9aaba6;
    --line: #2a3633;
    --accent: #2dd4bf;
    --accent-ink: #062b26;
    --accent-soft: #123a35;
    --warn: #f5b950;
    --warn-soft: #3a2a10;
    --danger: #ff8a80;
    --danger-soft: #3d1715;
    --ok: #6fd99a;
    --ok-soft: #133222;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.brand img { border-radius: 8px; }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 22px 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 4px; font-size: 17px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 12px; }
.price { font-size: 22px; font-weight: 700; }
.price small { font-size: 14px; font-weight: 500; color: var(--muted); }
.specs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.badge { font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-muted { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; font-size: 15px;
  padding: 11px 16px; border-radius: 12px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns .btn { flex: 1; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 20px; min-height: 20px; }
.pay-box { white-space: pre-wrap; background: var(--accent-soft); border-radius: 12px; padding: 14px; font-size: 15px; }
.amount { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.kv { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: center; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.copy { background: none; border: 0; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px; }
.proof { width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); cursor: zoom-in; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.seg { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 14px; padding-bottom: 2px; }
.seg button {
  flex: none; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.seg button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 12px; font-weight: 600; padding: 9px 4px 10px; position: relative;
}
.tabs a svg { display: block; margin: 0 auto 2px; width: 24px; height: 24px; }
.tabs a.on { color: var(--accent); }
.tabs .dot {
  position: absolute; top: 5px; left: 50%; margin-left: 8px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 18px;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast.err { background: var(--danger); color: #fff; }
dialog {
  border: 0; border-radius: 18px; padding: 18px; width: min(520px, calc(100% - 24px));
  background: var(--card); color: var(--text); max-height: 90vh;
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin: 0 0 8px; }
.auth { max-width: 400px; margin: 24px auto 0; }
.auth .switch { text-align: center; margin-top: 16px; font-size: 15px; }
a { color: var(--accent); }
.err-msg { color: var(--danger); font-size: 14px; margin-top: 8px; }
.note { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.note.danger { background: var(--danger-soft); color: var(--danger); }
.line { height: 1px; background: var(--line); margin: 14px 0; }
