:root {
  --bg: #05080f;
  --bg-2: #0a1120;
  --card: rgba(16, 26, 46, 0.62);
  --card-solid: #0f1a2e;
  --line: rgba(120, 170, 255, 0.12);
  --line-strong: rgba(120, 190, 255, 0.24);
  --text: #e8f0ff;
  --muted: #8a9bb8;
  --blue: #3b82ff;
  --cyan: #1fd1e8;
  --teal: #19e3b1;
  --grad: linear-gradient(120deg, #3b82ff 0%, #1fd1e8 55%, #19e3b1 100%);
  --danger: #ff6b81;
  --warn: #ffc56b;
  --ok: #3ee8b5;
  --radius: 18px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: #7ef0ff; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: rgba(59,130,255,.12); padding: .1em .4em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.r { text-align: right; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.warn-text { color: var(--warn); }

/* background */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 600px at 80% -10%, #0c2a57 0%, transparent 60%), radial-gradient(900px 600px at -10% 110%, #053a3e 0%, transparent 60%), var(--bg); }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; }
.orb-a { width: 420px; height: 420px; background: #1f5bff; top: -120px; right: 8%; animation: float 18s ease-in-out infinite; }
.orb-b { width: 380px; height: 380px; background: #0fbfae; bottom: -140px; left: 4%; animation: float 22s ease-in-out infinite reverse; }
.grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(120,170,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(120,170,255,.05) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 70%); }
@keyframes float { 50% { transform: translate(40px, 30px) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.main { flex: 1; padding: 32px 0 56px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); background: rgba(5, 8, 15, .65); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.2rem; letter-spacing: -0.01em; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .link-btn { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-size: .95rem; }
.nav a:hover, .link-btn:hover { color: var(--text); background: rgba(120,170,255,.08); }
.nav a.on { color: var(--text); background: rgba(59,130,255,.14); }
.nav a.btn, .nav a.btn:hover { color: #03121a; background: var(--grad); padding: 8px 14px; }
.nav .pill { display: inline-flex; align-items: center; gap: 8px; color: var(--text); border: 1px solid var(--line-strong); margin-left: 6px; font-family: var(--mono); font-size: .88rem; }
.qp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px var(--cyan); }
.link-btn { background: none; border: 0; cursor: pointer; font: inherit; }
.inline { display: inline; margin: 0; }
.nav-toggle, .burger { display: none; }

@media (max-width: 1000px) {
  .burger { display: flex; flex-direction: column; gap: 5px; cursor: pointer; padding: 10px; }
  .burger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }
  .nav:not(.nav-guest) { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 12px 16px 18px; background: rgba(5,8,15,.96); border-bottom: 1px solid var(--line); }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav .pill { margin: 6px 0 0; justify-content: center; }
}

/* cards & buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.glow { position: relative; }
.glow::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, rgba(59,130,255,.6), rgba(31,209,232,.15) 40%, rgba(25,227,177,.5)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border: 0; border-radius: 12px; background: var(--grad); color: #03121a; font-family: inherit; font-size: .98rem; font-weight: 600; line-height: 1; cursor: pointer; transition: transform .15s, box-shadow .15s, filter .15s; box-shadow: 0 8px 30px -8px rgba(31,209,232,.55); }
.btn:hover { color: #03121a; transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 12px 36px -8px rgba(31,209,232,.7); }
.btn:active { transform: none; }
.btn-ghost { background: rgba(120,170,255,.08); color: var(--text); box-shadow: none; border: 1px solid var(--line-strong); }
.btn-ghost:hover { color: var(--text); background: rgba(120,170,255,.14); box-shadow: none; }
.btn-sm { padding: 8px 14px; font-size: .88rem; border-radius: 10px; }
.btn-block { width: 100%; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .78rem; background: rgba(138,155,184,.14); color: var(--muted); white-space: nowrap; }
.badge.ok { background: rgba(62,232,181,.12); color: var(--ok); }
.badge.warn { background: rgba(255,197,107,.12); color: var(--warn); }
.badge.info { background: rgba(59,130,255,.16); color: #8fb6ff; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; border: 1px solid; }
.flash.ok { background: rgba(62,232,181,.08); border-color: rgba(62,232,181,.35); color: #b6fbe6; }
.flash.err { background: rgba(255,107,129,.08); border-color: rgba(255,107,129,.35); color: #ffc7d0; }

/* forms */
.form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
label small { font-size: .8rem; }
input:not([type=radio]):not([type=checkbox]) { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(5,10,20,.7); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s; }
input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(31,209,232,.18); }
input[readonly] { color: #bfe9ff; }
input.valid { border-color: rgba(62,232,181,.6); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

/* auth */
.auth { display: grid; place-items: center; padding: 6vh 0 20px; }
.auth-card { width: min(440px, 100%); padding: 32px; display: grid; gap: 14px; }
.auth-card .form { gap: 14px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 1.6rem; letter-spacing: -0.02em; margin: 4px 0 10px; }
.auth-brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 22px; counter-reset: s; }
.steps li { counter-increment: s; flex: 1; padding: 8px 10px; border-radius: 10px; background: rgba(120,170,255,.06); color: var(--muted); font-size: .86rem; }
.steps li::before { content: counter(s) ". "; }
.steps li.on { color: var(--text); background: rgba(59,130,255,.18); }
.steps li.done { color: var(--ok); }

/* page layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.section-title { margin: 34px 0 14px; font-size: 1.05rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.balance { display: grid; gap: 2px; min-width: 220px; padding: 16px 22px; color: var(--text); }
.balance:hover { color: var(--text); border-color: var(--line-strong); }
.balance b { font-size: 1.9rem; font-family: var(--mono); letter-spacing: -0.03em; }
.balance b span { font-size: 1rem; color: var(--cyan); }
.balance small { color: var(--muted); }

.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.svc { display: flex; flex-direction: column; gap: 6px; color: var(--text); transition: transform .2s, border-color .2s; min-height: 220px; }
a.svc:hover { color: var(--text); transform: translateY(-3px); border-color: var(--line-strong); }
.svc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.svc p { margin: 0; }
.svc-go { margin-top: auto; padding-top: 12px; color: var(--cyan); font-size: .92rem; }
.svc-soon { opacity: .6; box-shadow: none; border-style: dashed; }

progress.meter { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border: 0; border-radius: 99px; background: rgba(120,170,255,.12); overflow: hidden; margin: 10px 0 4px; }
progress.meter::-webkit-progress-bar { background: rgba(120,170,255,.12); border-radius: 99px; }
progress.meter::-webkit-progress-value { background: var(--grad); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: var(--grad); border-radius: 99px; }
progress.meter.big { height: 10px; }

/* vpn */
.vpn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.vpn-grid .devices { grid-column: 1 / -1; }
.status-card h2 { font-size: 1.6rem; margin: 6px 0 10px; }
.buy { display: grid; gap: 14px; margin-top: 18px; }
.periods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.period { cursor: pointer; }
.period input { position: absolute; opacity: 0; pointer-events: none; }
.period span { display: grid; gap: 2px; text-align: center; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(5,10,20,.5); color: var(--text); transition: border-color .15s, background .15s; }
.period small { color: var(--muted); font-family: var(--mono); }
.period input:checked + span { border-color: var(--cyan); background: rgba(31,209,232,.1); box-shadow: 0 0 0 3px rgba(31,209,232,.12); }
.period input:focus-visible + span { outline: 2px solid var(--cyan); }
.copy-box { display: flex; gap: 8px; margin: 10px 0; }
.copy-box input { flex: 1; min-width: 0; font-size: .86rem; }
.copy-box .big-code { font-size: 1.1rem; letter-spacing: .06em; }
.qr summary { cursor: pointer; color: var(--cyan); margin-top: 8px; }
.qr img { display: block; margin-top: 14px; border-radius: 14px; background: #fff; padding: 10px; width: 220px; height: 220px; }
.devices-head { display: flex; justify-content: space-between; align-items: center; }
.device-list, .ledger { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.device-list li, .ledger li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: rgba(5,10,20,.45); border: 1px solid var(--line); }
.device-list li > div, .ledger li > div { display: grid; gap: 2px; min-width: 0; }
.device-list small, .ledger small { overflow: hidden; text-overflow: ellipsis; }
.amt { font-family: var(--mono); white-space: nowrap; font-weight: 600; }
.amt.plus { color: var(--ok); }
.amt.minus { color: #ff9aaa; }
@media (max-width: 860px) { .vpn-grid { grid-template-columns: 1fr; } .periods { grid-template-columns: repeat(2, 1fr); } }

/* wallet */
.wallet-grid, .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.howto { padding-left: 20px; display: grid; gap: 12px; }
@media (max-width: 860px) { .wallet-grid, .settings-grid { grid-template-columns: 1fr; } }

/* invites */
.invite-new { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.invite-new p { margin: 0; }
.invite-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 14px; }
.invite { display: grid; gap: 8px; align-content: start; }
.invite .badge { justify-self: start; }
.invite-code { font-size: 1.25rem; letter-spacing: .08em; }

/* admin */
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { width: 140px !important; padding: 8px 10px !important; }
.table-wrap { overflow-x: auto; padding: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.table tr:last-child td { border-bottom: 0; }

.foot { display: flex; justify-content: space-between; gap: 12px; padding: 22px 0 30px; color: var(--muted); font-size: .86rem; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* icons */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 48px; height: 48px; flex: none; display: inline-grid; place-items: center; border-radius: 14px;
  background: linear-gradient(145deg, rgba(76,141,255,.16), rgba(46,230,182,.06)); border: 1px solid rgba(120,190,255,.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 24px -12px rgba(34,211,238,.6); }
.ico svg { width: 26px; height: 26px; }
.ico-dim { opacity: .75; }
.head-ico { display: flex; align-items: center; gap: 14px; }
.head-ico h1 { margin: 0; }

/* plans */
.period span { position: relative; }
.period em { position: absolute; top: -9px; right: -6px; font-style: normal; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--grad); color: #03121a; }
.narrow { max-width: 620px; }

/* hidden subscription link */
.reveal summary { list-style: none; display: inline-flex; margin-top: 6px; }
.reveal summary::-webkit-details-marker { display: none; }
.reveal[open] summary { display: none; }
.qr-img { display: block; margin-top: 14px; border-radius: 14px; background: #fff; padding: 10px; width: 220px; height: 220px; }

/* buy QP */
.qp-input { position: relative; }
.qp-input input { font-size: 1.4rem !important; font-family: var(--mono); padding-right: 60px !important; }
.qp-input span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--cyan); font-weight: 600; }
.assets { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.assets legend { color: var(--muted); font-size: .9rem; margin-bottom: 8px; padding: 0; }
.asset-net { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(5,10,20,.45); border: 1px solid var(--line); }
.net-name { font-size: .95rem; }
.net-name small { color: var(--muted); margin-left: 4px; }
.asset-tokens { display: flex; gap: 6px; }
.asset { cursor: pointer; }
.asset input { position: absolute; opacity: 0; pointer-events: none; }
.asset span { display: inline-block; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line-strong); font-size: .85rem; font-weight: 600; color: var(--muted); }
.asset input:checked + span { color: #03121a; background: var(--grad); border-color: transparent; }
.asset input:focus-visible + span { outline: 2px solid var(--cyan); }
.stack { display: grid; gap: 18px; }

/* invoice */
.invoice { display: grid; gap: 16px; }
.pay-amount .big-code { font-size: 1.6rem !important; letter-spacing: .02em; color: var(--text) !important; }
.pay-token { font-size: 1rem; font-weight: 500; }
.pay-sum { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0; }
.pay-sum span { color: var(--cyan); font-size: 1.2rem; }
.notes { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--muted); font-size: .9rem; }

/* text written by users */
.text, .chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(5,10,20,.7); color: var(--text); font: inherit; resize: vertical; min-height: 90px; }
textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(31,209,232,.18); }
mark { background: rgba(34,211,238,.25); color: var(--text); border-radius: 3px; padding: 0 2px; }
.dot-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--grad); color: #03121a; font-size: .72rem; font-weight: 700; margin-left: 4px; }
.frozen-banner b { color: #ffd0d7; }
.notice { margin: 18px 0; border-color: rgba(255,197,107,.3); background: rgba(255,197,107,.05); }
.notice p { margin: 6px 0 0; }
.row-card { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.narrow-wide { max-width: 860px; }

/* chat */
.chat { grid-column: 1 / -1; display: grid; gap: 12px; }
.chat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chat-head h2 { margin: 0; }
.chat-list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 6px; max-height: 360px; overflow-y: auto; align-content: start; }
.chat-list li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 4px 10px; align-items: baseline; padding: 8px 12px; border-radius: 12px; background: rgba(5,10,20,.45); }
.chat-user { font-weight: 600; color: var(--cyan); }
.chat-user::after { content: ":"; color: var(--muted); }
.chat-user.is-admin { color: var(--ok); }
.chat-list time { font-size: .76rem; white-space: nowrap; }
.chat-del { margin: 0; }
.chat-del .link-btn { padding: 0 6px; color: var(--muted); }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }
@media (max-width: 560px) { .chat-list li { grid-template-columns: 1fr auto; } .chat-text { grid-column: 1 / -1; } }

/* threads (tickets, forum) */
.thread { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.thread > li { padding: 14px 16px; border-radius: 14px; background: rgba(5,10,20,.45); border: 1px solid var(--line); }
.thread > li.from-admin { border-color: rgba(62,232,181,.35); background: rgba(62,232,181,.05); }
.thread-meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.thread-meta time { font-size: .82rem; }
.thread-meta .inline .link-btn { padding: 0; font-size: .82rem; color: var(--muted); }
.close-form { margin-top: 10px; }
.post { margin-bottom: 8px; }

/* forum */
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 1; }
.topic-list { display: grid; gap: 10px; }
.topic { display: grid; gap: 6px; color: var(--text); padding: 18px 20px; transition: border-color .15s, transform .15s; }
.topic:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-1px); }
.topic h3 { margin: 0; }
.snippet { margin: 0; color: #b5c3dc; font-size: .92rem; }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }

.hint { padding: 12px 14px; border-radius: 12px; background: rgba(255,197,107,.07); border: 1px solid rgba(255,197,107,.3); color: #f3dcb4; font-size: .88rem; line-height: 1.5; margin: 4px 0 12px; }
.hint b { color: #ffd89a; }

/* mobile menu: centered buttons */
@media (max-width: 1000px) {
  .nav:not(.nav-guest) { align-items: center; text-align: center; gap: 6px; }
  .nav:not(.nav-guest) > a, .nav:not(.nav-guest) > .inline { width: min(320px, 100%); }
  .nav:not(.nav-guest) > a { display: block; padding: 12px; }
  .nav:not(.nav-guest) .pill { display: flex; justify-content: center; }
  .nav:not(.nav-guest) .link-btn { width: 100%; padding: 12px; }
}
.edit-inline { margin-top: 8px; }
.edit-inline summary { list-style: none; display: inline-block; cursor: pointer; padding: 0; font-size: .82rem; color: var(--muted); }
.edit-inline summary::-webkit-details-marker { display: none; }
.edit-inline[open] summary { margin-bottom: 8px; }
.thread-meta a.link-btn { padding: 0; font-size: .82rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: #22d3ee; }
.perms { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; margin: 0; }
.perms legend { color: var(--muted); font-size: .85rem; padding: 0 6px; }
.invite form { margin: 0; }


.nav a, .nav .pill { white-space: nowrap; }

.addon { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; padding: 16px 20px; }
.addon-row { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.addon-title { display: flex; align-items: center; gap: 8px; }
.addon-buy { display: flex; gap: 8px; align-items: center; margin: 0; }
select { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(5,10,20,.7); color: var(--text); font: inherit; font-size: .9rem; }
select:focus { outline: none; border-color: var(--cyan); }
.balance-edit summary { list-style: none; cursor: pointer; color: var(--cyan); }
.balance-edit summary::-webkit-details-marker { display: none; }
.balance-edit form { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }
.balance-edit input { width: 90px !important; padding: 6px 8px !important; font-size: .85rem; }
.balance-edit input[name=note] { width: 150px !important; }

/* VPN statistics */
.stats { grid-column: 1 / -1; display: grid; gap: 14px; }
.stats-head h2 { margin: 2px 0 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: rgba(5,10,20,.45); border: 1px solid var(--line); }
.tile small { color: var(--muted); font-size: .78rem; }
.tile b { font-family: var(--mono); font-size: 1.15rem; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 140px; padding: 8px 4px 0; }
.bar-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; text-align: center; }
.bar-col small { font-size: .65rem; color: var(--muted); }
.bar { align-self: end; width: 100%; border-radius: 6px 6px 2px 2px; background: var(--grad); min-height: 2px; opacity: .9; }
.bar.h0 { background: rgba(120,170,255,.12); height: 2px; }
@media (max-width: 860px) { .stat-tiles { grid-template-columns: repeat(2, 1fr); } .bar-col small { display: none; } }

/* toast notifications: overlay, never shift the page */
.toast { position: fixed; z-index: 50; top: 76px; right: 16px; max-width: min(420px, calc(100% - 32px)); display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px 12px 16px; border-radius: 14px; border: 1px solid; backdrop-filter: blur(12px); box-shadow: var(--shadow);
  animation: toast-in .25s ease-out; }
.toast.ok { background: rgba(8,40,34,.92); border-color: rgba(62,232,181,.45); color: #c8fbe9; }
.toast.err { background: rgba(48,12,20,.92); border-color: rgba(255,107,129,.45); color: #ffd3da; }
.toast span { flex: 1; line-height: 1.45; }
.toast-x { background: none; border: 0; color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; opacity: .7; padding: 0 2px; }
.toast.hide { opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 560px) { .toast { left: 16px; right: 16px; top: 72px; max-width: none; } }
.bar.h1 { height: 5%; }
.bar.h2 { height: 10%; }
.bar.h3 { height: 15%; }
.bar.h4 { height: 20%; }
.bar.h5 { height: 25%; }
.bar.h6 { height: 30%; }
.bar.h7 { height: 35%; }
.bar.h8 { height: 40%; }
.bar.h9 { height: 45%; }
.bar.h10 { height: 50%; }
.bar.h11 { height: 55%; }
.bar.h12 { height: 60%; }
.bar.h13 { height: 65%; }
.bar.h14 { height: 70%; }
.bar.h15 { height: 75%; }
.bar.h16 { height: 80%; }
.bar.h17 { height: 85%; }
.bar.h18 { height: 90%; }
.bar.h19 { height: 95%; }
.bar.h20 { height: 100%; }

.full-card { margin-top: 4px; }
#rub-btn:disabled { opacity: .45; cursor: not-allowed; }

/* attachments */
.files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.file { display: grid; gap: 6px; max-width: 100%; }
.file-media { width: min(320px, 100%); }
.file-img img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: rgba(5,10,20,.5); }
.file-video { display: block; width: 100%; max-height: 260px; border-radius: 12px; background: #000; }
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border-radius: 12px; background: rgba(5,10,20,.45); border: 1px solid var(--line); min-width: 0; }
.file-media .file-row { padding: 4px 2px; background: none; border: 0; }
.file-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.file-name.risky { color: var(--warn); }
.file-row .link-btn { padding: 2px 6px; font-size: .85rem; }
.clip { width: 16px; height: 16px; flex: none; }
.file-pick input[type=file] { padding: 10px; cursor: pointer; }
.file-pick input[type=file]::file-selector-button { margin-right: 12px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(120,170,255,.1); color: var(--text); font: inherit; cursor: pointer; }
.thread .files { margin-bottom: 4px; }

/* AI service */
.new-key { margin-bottom: 18px; }
.key-form { margin-bottom: 6px; flex-wrap: wrap; }
.key-form input { flex: 1; width: auto !important; min-width: 180px; }
.code-sample { margin: 8px 0; }
.code-sample summary { cursor: pointer; color: var(--cyan); font-size: .92rem; }
.code-sample pre { margin: 10px 0 0; padding: 14px; border-radius: 12px; background: rgba(5,10,20,.7); border: 1px solid var(--line); overflow-x: auto; font-size: .82rem; line-height: 1.5; }
.code-sample pre code { background: none; padding: 0; white-space: pre; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-row > div { display: grid; gap: 2px; }
.stat-row b { font-family: var(--mono); font-size: 1.15rem; }
.admin-stats { margin-bottom: 18px; }
.sub-title { margin: 22px 0 6px; font-size: 1rem; color: var(--muted); }
.model-search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.model-search input { flex: 1; min-width: 200px; width: auto !important; }
.model-search select { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(5,10,20,.7); color: var(--text); font: inherit; }
.table.models td { white-space: normal; vertical-align: top; }
.table.models td.r { white-space: nowrap; }
.model-id { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.model-id code { font-size: .8rem; overflow-wrap: anywhere; }
.model-id .link-btn { padding: 2px 6px; font-size: .8rem; }
tr.hidden { display: none; }
.models .tier { display: block; margin-top: 2px; }
.copy-box .key-masked { flex: 1; min-width: 0; display: flex; align-items: center; padding: 8px 12px; border: 1px solid var(--line, #333); border-radius: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .86rem; user-select: none; }
.ai-chat { margin-top: 18px; display: grid; }
.provider-balances .low b { color: var(--warn); }
.sms-orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; margin-bottom: 18px; }
.sms-order { display: grid; gap: 10px; align-content: start; }
.sms-order-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.sms-phone { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sms-phone .mono { font-size: 1.35rem; letter-spacing: .03em; }
.sms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sms-list li { padding: 10px 12px; border-radius: 12px; background: rgba(5,10,20,.45); display: grid; gap: 4px; }
.sms-code { display: flex; align-items: baseline; gap: 10px; }
.sms-code b { font-size: 1.6rem; color: var(--teal); letter-spacing: .08em; }
.sms-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sms-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sms-actions small { margin-right: auto; }
.sms-filter { width: 100%; margin: 6px 0 10px; }
.muted-badge { opacity: .75; }
.invite-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { color: var(--danger); }
.no-match-box { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 6px 0; }
.no-match-box > div { display: grid; gap: 2px; }
.no-match-box .btn { white-space: nowrap; }
.table .no-match td { white-space: normal; }
.no-match-box { position: sticky; left: 0; max-width: calc(100vw - 72px); }
.astra-card { display: grid; gap: 12px; margin-bottom: 18px; }
.astra-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.astra-top h2 { margin: 0 0 4px; }
.astra-notes { white-space: pre-wrap; padding: 8px 0 0; }
.astra-connect { display: grid; gap: 8px; justify-items: start; padding-top: 12px; border-top: 1px solid var(--line); }
.astra-connect p { margin: 0; }
.astra-code { font-size: 1.15rem; letter-spacing: .08em; user-select: all; }
.astra-link { display: grid; gap: 10px; max-width: 640px; }
.astra-link h2, .astra-link p { margin: 0; }
.astra-actions { display: flex; gap: 10px; flex-wrap: wrap; }
