/* ===== RWM Service — магазин для клиентов ===== */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #12151c;
  --ink-2: #4a5263;
  --muted: #7a8294;
  --line: #e4e7ee;
  --line-2: #d3d8e2;
  --accent: #1f4fff;
  --accent-ink: #ffffff;
  --accent-soft: #e9eeff;
  --ok: #0f9d58;
  --ok-soft: #e6f6ee;
  --warn: #b25e00;
  --warn-soft: #fff4e5;
  --err: #d93025;
  --err-soft: #fdecea;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1016;
    --surface: #151922;
    --surface-2: #1b202b;
    --ink: #eef1f6;
    --ink-2: #b7bfcd;
    --muted: #8590a3;
    --line: #262c39;
    --line-2: #323a4a;
    --accent: #5b7cff;
    --accent-soft: #1c2647;
    --ok: #3ccf86;
    --ok-soft: #12291f;
    --warn: #f0a646;
    --warn-soft: #2b2112;
    --err: #ff6b5e;
    --err-soft: #331816;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 750; }
.h2 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
p { margin: 0 0 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.offscreen { position: fixed; left: -9999px; top: 0; }
.ico { width: 18px; height: 18px; flex: none; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 48px; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12.5px; letter-spacing: .02em;
}
.nav { display: flex; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px;
  color: var(--ink-2); font-weight: 560; font-size: 14.5px; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 8px; }
.bal {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15;
  padding: 5px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink);
}
.bal:hover { border-color: var(--line-2); text-decoration: none; }
.bal-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bal b { font-family: var(--mono); font-size: 14.5px; }
.lang { position: relative; }
.lang summary {
  list-style: none; cursor: pointer; padding: 8px 10px; border-radius: 9px; font-size: 13px; font-weight: 650;
  color: var(--ink-2); border: 1px solid var(--line); user-select: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 150px; display: grid;
}
.lang-menu a { padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.lang-menu a:hover { background: var(--surface-2); text-decoration: none; }
.lang-menu a.on { color: var(--accent); font-weight: 650; }

/* ---------- кнопки, поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: 600 14.5px/1 var(--sans);
  cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:focus-visible, input:focus-visible, .chip:focus-visible, summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 48px; font-size: 15.5px; padding: 0 22px; }
.btn-block { width: 100%; }
.btn.busy { opacity: .7; pointer-events: none; }
.btn.copied { color: var(--ok); border-color: var(--ok); }

input, select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 15px var(--sans);
}
input:focus { border-color: var(--accent); }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
label.lbl input { margin-top: 6px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.warn { font-size: 13px; color: var(--warn); margin: 8px 0 0; }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.stack > * + * { margin-top: 10px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.row-btns form { margin: 0; }

/* ---------- блоки ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.narrow { max-width: 560px; margin: 0 auto; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.title-lg { font-size: 24px; }
.note { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14.5px; border: 1px solid transparent; }
.note-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.note-err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.note-info { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head form { margin: 0; }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); font-weight: 600; white-space: nowrap;
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; margin: 14px 0 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; text-align: right; font-weight: 560; }
.ok-line { color: var(--ok); font-weight: 600; }

/* ---------- каталог ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.hero h1 { font-size: 30px; }
.hero p { margin: 0; }
.search { position: relative; display: block; width: 320px; max-width: 100%; }
.search .ico { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.search input { padding-left: 38px; height: 42px; }
.group { margin-bottom: 26px; }
.group-title { font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px 2px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: grid; grid-template-columns: minmax(200px, 1fr) auto; gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.item-name { font-weight: 650; font-size: 15.5px; }
.fmts { display: grid; gap: 8px; }
.fmt {
  display: grid; grid-template-columns: 130px 80px 70px auto; align-items: center; gap: 14px; margin: 0;
}
.fmt-name { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.fmt-price { font-family: var(--mono); font-weight: 700; font-size: 15px; text-align: right; }
.fmt-stock { color: var(--ok); font-size: 13.5px; font-weight: 600; text-align: right; white-space: nowrap; }
.fmt-buy { display: flex; gap: 8px; justify-content: flex-end; }
.fmt-buy .qty { width: 76px; height: 34px; text-align: center; font-family: var(--mono); padding: 0 6px; }
.sep { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* ---------- покупка ---------- */
.qty-row { display: grid; grid-template-columns: 1fr 110px max-content; gap: 10px; align-items: center; margin: 18px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.qty-row label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.qty-row .qty { text-align: center; font-family: var(--mono); }
.sum { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 16px; }
.sum > div { display: flex; flex-direction: column; }
.sum .right { text-align: right; }
.sum b { font-family: var(--mono); font-size: 16px; }
.sum .big { font-size: 28px; letter-spacing: -.02em; }

/* ---------- заказы ---------- */
.orders { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.order { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.order:first-child { border-top: 0; }
.order-main { min-width: 0; }
.order-title { font-weight: 620; overflow-wrap: anywhere; }
.order-new { background: var(--ok-soft); }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.pager a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- пополнение ---------- */
.dep-form { max-width: 560px; }
.dep-form .lbl:first-of-type { margin-top: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); }
.seg-opt small { color: var(--muted); font-size: 12.5px; }
.seg-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.seg-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.amount-in { position: relative; }
.amount-in span { position: absolute; left: 14px; top: 11px; font-weight: 700; color: var(--muted); }
.amount-in input { padding-left: 28px; font-family: var(--mono); font-size: 18px; height: 48px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 13.5px var(--mono); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.dep-form .btn-block { margin-top: 18px; }

.pay-grid { display: grid; grid-template-columns: 1fr 230px; gap: 26px; align-items: start; }
.field-copy { margin-bottom: 18px; }
.field-copy .lbl { margin-top: 0; }
.copy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.amount { font-size: 30px; letter-spacing: -.01em; }
.cur { font-weight: 700; color: var(--muted); }
.addr { display: block; flex: 1 1 260px; min-width: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }
.pay-status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }
.timer { margin-left: auto; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.qr { background: #fff; border-radius: 12px; padding: 8px; border: 1px solid var(--line); line-height: 0; }
.qr img { width: 200px; height: 200px; image-rendering: pixelated; }
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tr { display: grid; grid-template-columns: 1.3fr .8fr 1fr auto; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); align-items: center; }
.tr:first-child { border-top: 0; }
.st { font-size: 12.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.st-paid { background: var(--ok-soft); color: var(--ok); }
.st-new { background: var(--warn-soft); color: var(--warn); }
.h2 + .table, .card + .h2 { margin-top: 26px; }

/* ---------- вход / аккаунт ---------- */
.auth { display: grid; place-items: start center; padding-top: 12px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .btn-block { margin-top: 18px; }
.auth-card .btn-ghost.btn-block { margin-top: 8px; }
.auth-card p.center { margin: 14px 0 0; }
.code-in { font-family: var(--mono); font-size: 26px; letter-spacing: .4em; text-align: center; height: 56px; margin-top: 10px; }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.recovery { max-width: 620px; margin: 0 auto; }
.big-code { margin: 18px 0 6px; }
.big-code code { font-size: 22px; font-weight: 700; padding: 12px 16px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); letter-spacing: .04em; }
.recovery form { margin-top: 18px; }
.twofa-setup { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.twofa-setup .qr img { width: 160px; height: 160px; }

/* ---------- подвал ---------- */
.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-in { display: flex; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 18px; color: var(--muted); font-size: 13.5px; }

/* ---------- телефоны ---------- */
@media (max-width: 860px) {
  .item { grid-template-columns: 1fr; gap: 10px; }
  .pay-grid { grid-template-columns: 1fr; }
  .qr-box { order: -1; }
  .acc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { padding-bottom: 64px; }
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .top-in { height: 56px; gap: 10px; }
  .brand-name { display: none; }
  .top-right { margin-left: auto; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .nav a { flex-direction: column; gap: 3px; font-size: 11.5px; padding: 6px 8px; flex: 1; text-align: center; }
  .nav a.on { background: transparent; }
  .ico { width: 20px; height: 20px; }
  .hero h1 { font-size: 24px; }
  .search { width: 100%; }
  .fmt { grid-template-columns: 1fr auto auto; column-gap: 12px; grid-template-areas: "n p s" "b b b"; row-gap: 8px; }
  .fmt-name { grid-area: n; } .fmt-price { grid-area: p; } .fmt-stock { grid-area: s; }
  .fmt-buy { grid-area: b; justify-content: stretch; }
  .fmt-buy .qty { width: 90px; }
  .fmt-buy .btn { flex: 1; }
  .card { padding: 18px; }
  .tr { grid-template-columns: 1fr auto; }
  .tr span:nth-child(2) { display: none; }
  .tr span:nth-child(3) { text-align: right; }
  .order { flex-wrap: wrap; }
}
