:root {
  --bg: #0b1d24;
  --bg-2: #0f2730;
  --card: rgba(255, 255, 255, 0.045);
  --card-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(94, 234, 212, 0.35);
  --text: #eef6f5;
  --muted: #8fa7aa;
  --dim: #5f7a7e;
  --accent: #3fd1bf;
  --accent-2: #2aa597;
  --accent-ink: #052a2a;
  --gold: #f4c76b;
  --danger: #ff6b7a;
  --radius: 22px;
  --radius-sm: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(60% 40% at 30% 12%, rgba(63, 209, 191, 0.13), transparent 70%),
    radial-gradient(50% 40% at 85% 55%, rgba(80, 110, 200, 0.10), transparent 70%),
    linear-gradient(180deg, #0c222a 0%, #0a1a20 100%);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

/* ───────── top bar ───────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(11, 29, 36, 0.96), rgba(11, 29, 36, 0.82));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -0.2px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn, .lang-btn {
  position: relative; height: 42px; min-width: 42px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--card);
  font-weight: 600; font-size: 14px;
}
.icon-btn svg { width: 20px; height: 20px; }
.lang-btn svg { width: 16px; height: 16px; color: var(--muted); }
.dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }

/* ───────── layout ───────── */
.view { position: relative; z-index: 1; padding: 22px 18px calc(120px + var(--safe-bottom)); max-width: 560px; margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
h1 { font-size: 28px; line-height: 1.15; margin: 0 0 6px; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 20px; margin: 0 0 14px; font-weight: 800; letter-spacing: -0.2px; }
.sub { color: var(--muted); font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.small { font-size: 13px; }
.mt { margin-top: 18px; }
.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card.glass {
  background: linear-gradient(160deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025));
  box-shadow: 0 20px 60px -30px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}
.card.accent { border-color: var(--border-strong); background: linear-gradient(160deg, rgba(63,209,191,0.10), rgba(63,209,191,0.02)); }
.card-label { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700;
  border: 1px solid var(--border-strong); color: var(--accent); background: rgba(63,209,191,0.08);
}
.pill.gold { color: var(--gold); border-color: rgba(244,199,107,.35); background: rgba(244,199,107,.08); }
.pill.red { color: var(--danger); border-color: rgba(255,107,122,.35); background: rgba(255,107,122,.08); }
.tag { font-size: 11px; letter-spacing: 1px; font-weight: 800; text-transform: uppercase; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.status-dot.off { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

.progress { height: 14px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.progress > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2aa597, #8ff0e2 60%, #5eead4); box-shadow: 0 0 18px rgba(94,234,212,.45); transition: width .6s ease; }

.big-num { font-size: 40px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.infinity { font-size: 30px; color: var(--accent); font-weight: 800; line-height: 1; }

.tile { padding: 18px; }
.tile .value { font-size: 17px; font-weight: 800; margin-top: 8px; line-height: 1.25; }
.tile .value.gold { color: var(--gold); font-size: 28px; }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(244,199,107,.1); color: var(--gold); }

.action-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 16px; border-radius: 18px; border: 1px solid var(--border-strong);
  background: rgba(63,209,191,0.05);
}
.action-row .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(63,209,191,0.12); color: var(--accent); flex-shrink: 0; }
.action-row .t { font-weight: 700; font-size: 16px; }
.action-row .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.action-row .chev { margin-left: auto; color: var(--muted); }
.dots { margin-left: auto; display: flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.18); }
.dots i.on { background: var(--accent); }

.link { color: var(--accent); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 20px; border-radius: 16px; width: 100%;
  font-weight: 700; font-size: 16px;
  background: linear-gradient(180deg, #49dcc9, #2bb3a3); color: var(--accent-ink);
  box-shadow: 0 10px 30px -12px rgba(63,209,191,.7);
  transition: transform .1s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.secondary { background: var(--card-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; border: 1px solid var(--border-strong); }
.btn.small { height: 40px; width: auto; font-size: 14px; border-radius: 12px; padding: 0 16px; }
.btn.danger { background: rgba(255,107,122,.12); color: var(--danger); box-shadow: none; border: 1px solid rgba(255,107,122,.3); }

.input {
  width: 100%; height: 54px; padding: 0 18px; border-radius: 16px;
  border: 1px solid var(--border); background: rgba(0,0,0,.18); outline: none;
  font-size: 16px; transition: border-color .2s;
}
textarea.input { height: 120px; padding: 14px 18px; resize: none; }
.input:focus { border-color: var(--border-strong); }
.input::placeholder { color: var(--dim); }

.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: 18px; background: rgba(0,0,0,.14); border: 1px solid var(--border);
}
.list-item .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--card-2); color: var(--muted); flex-shrink: 0; }
.list-item .t { font-weight: 700; }
.list-item .s { font-size: 13px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.list-item .actions { margin-left: auto; display: flex; gap: 4px; }
.list-item .actions button { width: 38px; height: 38px; border-radius: 10px; color: var(--muted); display: grid; place-items: center; }
.list-item .actions button:active { background: var(--card-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--border); font-size: 14px; font-weight: 600; }

.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty .ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; background: var(--card-2); color: var(--dim); }

.copy-field { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 16px; height: 54px; border-radius: 16px; background: rgba(0,0,0,.18); border: 1px solid var(--border); }
.copy-field span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 14px; }

.tx { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tx:last-child { border-bottom: 0; }
.tx .amt { font-weight: 800; font-family: var(--mono); }
.tx .amt.plus { color: var(--accent); }
.tx .amt.minus { color: var(--text); }

/* план и периоды */
.plan-opt, .period-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 16px; border-radius: 18px; border: 1.5px solid var(--border); background: rgba(0,0,0,.12);
  transition: border-color .2s, background .2s;
}
.plan-opt.on, .period-opt.on { border-color: var(--accent); background: rgba(63,209,191,0.08); }
.plan-opt .emoji { font-size: 26px; }
.period-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.period-opt { flex-direction: column; align-items: flex-start; gap: 4px; }
.period-opt .price { font-size: 20px; font-weight: 800; }
.period-opt .per { font-size: 12px; color: var(--muted); }
.save { font-size: 11px; font-weight: 800; color: var(--accent-ink); background: var(--accent); padding: 2px 7px; border-radius: 6px; }

/* платформы */
.seg { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.2); border: 1px solid var(--border); overflow-x: auto; }
.seg button { flex: 1; padding: 9px 10px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--card-2); color: var(--text); }
.step { display: flex; gap: 14px; }
.step-n { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(63,209,191,.12); color: var(--accent); font-weight: 800; flex-shrink: 0; }
.qr { background: #fff; border-radius: 16px; padding: 12px; width: 200px; height: 200px; margin: 0 auto; display: grid; place-items: center; }
.qr img, .qr svg { width: 100% !important; height: 100% !important; }

/* тикеты */
.msg { max-width: 85%; padding: 12px 14px; border-radius: 16px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: rgba(63,209,191,.14); border: 1px solid var(--border-strong); border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; background: var(--card-2); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg .time { display: block; font-size: 11px; color: var(--dim); margin-top: 6px; }
.status { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.status.open { color: var(--gold); background: rgba(244,199,107,.1); }
.status.answered { color: var(--accent); background: rgba(63,209,191,.1); }
.status.closed { color: var(--dim); background: var(--card-2); }

/* ───────── tab bar ───────── */
.tabbar {
  position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(34px + var(--safe-bottom));
  max-width: 540px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px;
  border-radius: 24px; border: 1px solid var(--border);
  background: rgba(17, 38, 46, 0.88); backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.8);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 2px; border-radius: 18px; font-size: 12px; font-weight: 600; color: var(--muted);
  transition: background .2s, color .2s;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.on { background: rgba(63,209,191,0.16); color: var(--text); }
.tabbar a.on svg { color: var(--accent); }
.footer-handle { position: fixed; z-index: 29; left: 0; right: 0; bottom: calc(8px + var(--safe-bottom)); text-align: center; color: var(--dim); font-size: 13px; font-weight: 600; }

/* ───────── sheet / toast ───────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); animation: fade .2s; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto;
  max-width: 560px; margin: 0 auto; padding: 10px 20px calc(24px + var(--safe-bottom));
  background: #10262e; border-top-left-radius: 26px; border-top-right-radius: 26px; border: 1px solid var(--border);
  animation: up .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 42px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.18); margin: 0 auto 16px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 6px; font-weight: 600; border-bottom: 1px solid var(--border); width: 100%; text-align: left; }
.menu-item:last-child { border-bottom: 0; }
.menu-item svg { color: var(--accent); }

.toast {
  position: fixed; z-index: 60; left: 50%; top: 78px; transform: translateX(-50%);
  padding: 12px 18px; border-radius: 14px; background: #183a43; border: 1px solid var(--border-strong);
  font-weight: 600; font-size: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5); max-width: 90vw; text-align: center;
  animation: fade .2s;
}
.toast.error { border-color: rgba(255,107,122,.5); background: #3a1d24; }

.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

.gate { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.gate img { width: 84px; height: 84px; border-radius: 22px; }
