/* rent-tg — визуальная система в стиле MAX-аренды (тёмная, градиент #5c66ff→#ab49ff).
   Публичная страница поставщика (Telegram Web App) + админка. Самодостаточно, без внешних ассетов. */
:root {
  --accent1: #5c66ff;
  --accent2: #ab49ff;
  --grad: linear-gradient(90deg, #2b7fff 0%, #a855f7 100%);
  --grad2: linear-gradient(135deg, #5c66ff, #ab49ff);
  --card: #151922;
  --field: #0a0c10;
  --text: #ffffff;
  --muted: #7a839a;
  --muted2: #5a6478;
  --border: rgba(92, 102, 255, 0.18);
  --ok: #36d784;
  --warn: #e3b341;
  --err: #ff5f5f;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; min-height: 100vh;
  color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5;
  background-color: #05060a;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.25), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,.18), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,.15), transparent),
    radial-gradient(1200px 600px at 50% -10%, rgba(92,102,255,.10), transparent);
  -webkit-font-smoothing: antialiased;
}
@supports (-webkit-touch-callout: none) { body { min-height: -webkit-fill-available; } }
a { color: var(--accent1); text-decoration: none; }
input[type="tel"], input[type="text"], input[type="password"], input[type="number"] {
  font-size: 16px !important; -webkit-appearance: none; appearance: none;
}

/* ---- Header pill ---- */
.site-header { display: flex; justify-content: center; padding: 20px 16px 4px; }
.header-logo { display: inline-flex; align-items: center; gap: 9px;
  background: #1e1a2e; border-radius: 50px; padding: 8px 18px 8px 10px; }
.header-logo-icon { width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad2); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.header-logo-text { font-weight: 700; letter-spacing: .3px; }

/* ---- Auth card ---- */
.wrap { display: flex; align-items: flex-start; justify-content: center; padding: 22px 16px 40px; }
.auth-card { position: relative; width: 100%; max-width: 420px; background: var(--card);
  border-radius: 20px; padding: 26px 22px; }
.auth-card::before { content: ""; position: absolute; inset: 0; border-radius: 20px; padding: 1px;
  background: linear-gradient(135deg, rgba(92,102,255,.3), rgba(171,73,255,.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }

/* Step progress */
.step-progress { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; font-size: 12px; }
.step-pill { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--grad2); color: #fff; font-weight: 600; font-size: 12px;
  box-shadow: 0 2px 8px rgba(92,102,255,.35); flex-shrink: 0; }
.step-label { color: #fff; font-weight: 500; }
.step-bar { flex: 1; height: 2px; background: #232830; border-radius: 1px; }
.step-label-next { color: #4d5266; flex-shrink: 0; }

.auth-title { font-size: 21px; font-weight: 650; margin: 0 0 4px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

/* Phone + generic input */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.phone-input-wrapper { display: flex; align-items: center; background: var(--field);
  border: 1px solid transparent; border-radius: 14px; overflow: hidden; transition: border-color .2s; }
.phone-input-wrapper:focus-within { border-color: var(--accent1); }
.phone-prefix { display: inline-flex; align-items: center; padding: 0 2px 0 16px; color: #fff; font-size: 16px; line-height: 1; white-space: nowrap; }
.inp { width: 100%; padding: 14px 16px; background: var(--field); color: #fff;
  border: 1px solid transparent; border-radius: 14px; outline: none; transition: border-color .2s; font-size: 16px; }
.inp:focus { border-color: var(--accent1); }
.phone-input { flex: 1; padding: 14px 16px 14px 6px; background: transparent; color: #fff; border: none; outline: none; line-height: 1; }
.phone-input::placeholder, .inp::placeholder { color: #4d5468; }
.phone-row { display: flex; gap: 8px; align-items: stretch; }
.country-select { width: 138px; flex: 0 0 138px; padding: 14px 6px; border-radius: 14px; background: var(--field); border: 1px solid transparent; color: #fff; font-size: 14px !important; }
.country-select:focus { border-color: var(--accent1); outline: none; }
.phone-num { flex: 1; min-width: 0; }
.custom-dial { width: 34px; background: transparent; border: none; color: #fff; font-size: 16px !important; line-height: 1; outline: none; padding: 0 0 0 1px; height: 22px; text-align: left; }
.custom-dial::placeholder { color: #4d5468; }

/* Channels card */
.channels-card { background: linear-gradient(135deg, rgba(92,102,255,.06), rgba(171,73,255,.06));
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 14px 0 18px; }
.channels-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.channel-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: #d4dae6; }
.channel-row + .channel-row { border-top: 1px solid rgba(92,102,255,.12); }
.channel-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 8px; background: rgba(92,102,255,.15); flex-shrink: 0; font-size: 14px; }
.channel-text { flex: 1; line-height: 1.35; }
.channel-text b { color: #fff; font-weight: 600; }
.channel-text small { color: var(--muted2); font-size: 11px; display: block; margin-top: 1px; }

/* Button */
.btn { width: 100%; padding: 15px; border: none; border-radius: 14px; font-size: 16px; font-weight: 650;
  color: #fff; background: var(--grad); cursor: pointer; transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: transparent; border: 1px solid #2a323d; margin-top: 10px; }
.btn.secondary:hover { background: rgba(255,255,255,.04); filter: none; }

.spinner { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg { color: var(--err); font-size: 13px; min-height: 4px; margin: 4px 2px 0; }
.msg { padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg.err { background: rgba(255,95,95,.1); border: 1px solid rgba(255,95,95,.35); color: #ff9d96; }
.msg.ok { background: rgba(54,215,132,.1); border: 1px solid rgba(54,215,132,.35); color: #7ee7a8; }
.msg.info { background: rgba(92,102,255,.1); border: 1px solid rgba(92,102,255,.3); color: #9ec5ff; }

.trust-strip { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 6px;
  font-size: 11px; color: var(--muted2); }
.terms { font-size: 11px; color: var(--muted2); text-align: center; margin: 6px 0 0; line-height: 1.5; }

.step { display: none; }
.step.active { display: block; }
.center { text-align: center; }
.success-icon { width: 66px; height: 66px; margin: 6px auto 18px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(54,215,132,.22), rgba(92,102,255,.10));
  display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--ok); }
.phone-echo { color: #fff; font-weight: 600; }

/* ---- Admin ---- */
.admin-shell { max-width: 1280px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.topbar h1 { font-size: 20px; margin: 0; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid rgba(92,102,255,.15); border-radius: 12px; padding: 12px 16px; min-width: 104px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tablewrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(92,102,255,.12); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: 10px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,.05); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; position: sticky; top: 0; background: #10141c; }
tr:hover td { background: rgba(255,255,255,.02); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.logged_in, .badge.valid { background: rgba(54,215,132,.15); color: #7ee7a8; }
.badge.awaiting_code, .badge.awaiting_2fa, .badge.code_sent, .badge.unknown { background: rgba(227,179,65,.15); color: #e3b341; }
.badge.error, .badge.banned, .badge.invalid { background: rgba(255,95,95,.15); color: #ff9d96; }
.badge.frozen { background: rgba(92,102,255,.15); color: #9ec5ff; }
.badge.rejected { background: rgba(139,148,158,.15); color: var(--muted); }
.act { background: transparent; border: 1px solid #2a323d; color: var(--text); padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; }
.act:hover { background: rgba(255,255,255,.05); }
.act.primary { background: var(--grad); border: none; }
.act.danger { color: #ff9d96; border-color: rgba(255,95,95,.4); }
.muted { color: var(--muted); }
.inp.sm { padding: 9px 12px; font-size: 14px !important; border-radius: 10px; max-width: 260px; }
select.inp { padding: 9px 12px; font-size: 14px !important; border-radius: 10px; }
.role-tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: rgba(92,102,255,.15); color: #9ec5ff; }

/* Analytics chart */
.chart-card { background: var(--card); border: 1px solid rgba(92,102,255,.12); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.chart-total { color: #fff; font-weight: 600; }
.chart { display: flex; align-items: flex-end; gap: 5px; height: 98px; }
.chart .bar { flex: 1; min-width: 5px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #5c66ff, #ab49ff); transition: opacity .15s; }
.chart .bar:hover { opacity: .72; }
.chart .bar.zero { background: #232a36; }
.chart-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted2); }

/* Account cards grid (без горизонтального скролла) */
.acc-list { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); padding: 34px; text-align: center; }
.acc-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid rgba(92,102,255,.12); border-radius: 10px; padding: 9px 14px; }
.acc-row:hover { border-color: rgba(92,102,255,.32); }
.acc-row .rowchk { width: 16px; height: 16px; accent-color: var(--accent1); cursor: pointer; flex-shrink: 0; }
.acc-flag { font-size: 22px; line-height: 1; flex-shrink: 0; }
.acc-idwrap { min-width: 150px; flex: 0 1 auto; }
.acc-phone { font-size: 14px; font-weight: 650; color: #fff; white-space: nowrap; }
.acc-user { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-status { display: flex; align-items: center; gap: 8px; }
.acc-err { font-size: 11px; color: #ff9d96; }
.acc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.acc-chips .chip { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--field); border: 1px solid rgba(92,102,255,.12); color: #cdd5e2; }
.acc-chips .chip.valid { background: rgba(54,215,132,.12); border-color: rgba(54,215,132,.3); color: #7ee7a8; }
.acc-chips .chip.invalid { background: rgba(255,95,95,.12); border-color: rgba(255,95,95,.3); color: #ff9d96; }
.acc-chips .chip.frozen { background: rgba(92,102,255,.14); border-color: rgba(92,102,255,.3); color: #9ec5ff; }
.acc-meta2 { margin-left: auto; font-size: 11px; color: var(--muted2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.star-btn { background: none; border: none; font-size: 17px; cursor: pointer; padding: 2px; line-height: 1; flex-shrink: 0; }
.acc-actions { display: flex; gap: 5px; flex-shrink: 0; }
.ic { background: var(--field); border: 1px solid rgba(92,102,255,.12); color: #fff; border-radius: 8px; padding: 6px 9px; font-size: 14px; cursor: pointer; transition: background .12s; }
.ic:hover { background: rgba(92,102,255,.15); }
.ic.danger:hover { background: rgba(255,95,95,.15); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-bg.show { display: flex; }
.modal { background: var(--card); border: 1px solid rgba(92,102,255,.2); border-radius: 16px; width: 100%; max-width: 640px; max-height: 86vh; overflow: auto; padding: 22px; }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13px; margin-bottom: 14px; }
.kv .k { color: var(--muted); }
.dialogs { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; margin: 10px 0; }
.dlg { padding: 9px 12px; border-radius: 10px; background: var(--field); font-size: 13px; cursor: pointer; }
.dlg:hover { background: rgba(92,102,255,.08); }
.dlg .t { font-weight: 600; }
.dlg .m { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.chip { font-size: 12px; padding: 5px 10px; border-radius: 20px; background: var(--field); border: 1px solid rgba(92,102,255,.15); }
.chip b { color: #fff; }
