:root {
  --bg: #f4f5f0; --surface: #ffffff; --surface-2: #eceee6; --ink: #121612; --muted: #5d665d; --line: #dfe2d8;
  --accent: #b8f25c; --accent-ink: #10200a; --brand: #0f1512; --ok: #1a7f47; --warn: #a15c00; --bad: #c23b2b;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 24px rgba(0,0,0,.05);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0f0c; --surface: #131915; --surface-2: #1b231d; --ink: #eef3ea; --muted: #97a395; --line: #263028; --ok: #5fd38d; --warn: #f0b252; --bad: #ff7a6b; --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
main { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; flex: 1; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--brand); color: #eef3ea; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand b { font-weight: 400; opacity: .6; margin: 0 1px; }
.brand em { font-style: normal; background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 1px 6px; font-size: 12px; font-weight: 700; margin-left: 4px; vertical-align: 2px; }
#nav { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.1); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.accent { background: var(--accent); color: var(--accent-ink); }
.menu-btn { background: none; border: 0; padding: 6px; cursor: pointer; color: inherit; }
.dropdown { position: absolute; right: 12px; top: 56px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); min-width: 190px; padding: 6px; display: none; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; text-decoration: none; background: none; border: 0; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); }

/* type */
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin: 8px 0 6px; }
h2 { font-size: 19px; margin: 24px 0 10px; letter-spacing: -.01em; }
.lead { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }

/* hero tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 14px; margin: 14px 0 16px; }
.tabs a { text-align: center; padding: 10px; border-radius: 10px; text-decoration: none; font-weight: 600; color: var(--muted); }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* inputs */
.search { position: relative; margin-bottom: 12px; }
.search input, .field input, .field select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.search input:focus, .field input:focus { border-color: var(--ink); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px; border: 1px solid transparent; background: var(--ink); color: var(--bg); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.svc { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.svc:hover { border-color: var(--ink); }
.svc .n { font-weight: 600; line-height: 1.25; }
.svc .p { font-size: 13px; color: var(--muted); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); text-decoration: none; }
.item:first-child { border-top: 0; }
.item .flag { font-size: 24px; width: 30px; text-align: center; flex: none; }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--muted); }
.item .price { font-weight: 700; white-space: nowrap; }
.ops { padding: 0 14px 12px 56px; display: none; }
.ops.open { display: block; }
.ops .item { padding: 8px 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; }

/* plans */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.plan { display: flex; flex-direction: column; gap: 6px; }
.plan .big { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.plan .big small { font-size: 15px; font-weight: 600; color: var(--muted); }

/* order screens */
.number { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: .01em; word-break: break-all; }
.code { font-family: var(--mono); font-size: 40px; font-weight: 800; letter-spacing: .08em; background: var(--accent); color: var(--accent-ink); border-radius: 12px; padding: 8px 14px; display: inline-block; }
.copy { cursor: pointer; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); text-transform: uppercase; letter-spacing: .03em; }
.status.ok { color: var(--ok); } .status.warn { color: var(--warn); } .status.bad { color: var(--bad); }
.wait { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px; background: var(--surface-2); margin-top: 14px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: s 1s linear infinite; flex: none; }
@keyframes s { to { transform: rotate(360deg); } }
.sms { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin-top: 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.qr { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 8px; display: block; margin: 12px 0; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; margin: 12px 0; }
.note.warn { border-left: 4px solid var(--warn); }

/* wallet */
.balance { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.amounts button { padding: 12px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; }
.amounts button.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.pos { color: var(--ok); } .neg { color: var(--ink); }

/* table (admin) */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; border-top: 0; }
.scroll { overflow-x: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 22px; font-weight: 800; }

.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(120px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; transition: transform .25s; max-width: calc(100% - 32px); z-index: 50; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); color: #fff; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 20px 0 8px; }
@media (max-width: 420px) { h1 { font-size: 23px; } .brand span { font-size: 15px; } .code { font-size: 34px; } }

.admin-tabs { grid-template-columns: repeat(6, 1fr); gap: 2px; }
.admin-tabs a { padding: 9px 2px; font-size: 13px; }
