/* ============================================================
   Proxa — светлый интерфейс продажи прокси
   Светло-серый фон · белые панели · индиго-акцент #4f46e5
   Шрифт: Manrope · данные прокси: JetBrains Mono
   Поток: версия -> шторка (страна -> период/количество -> покупка)
   ============================================================ */

:root {
  --bg: #eef0f6;
  --card: #ffffff;
  --ink: #141b2e;
  --muted: #7a839c;
  --line: #eceef4;
  --ac: #4f46e5;
  --ac-deep: #4338ca;
  --ac-soft: #e0e7ff;
  --ac-ghost: #f3f4ff;
  --ok: #1fb567;
  --ok-soft: #e3f8ed;
  --warn: #e8930c;
  --warn-soft: #fdf1dc;
  --red: #e23c3c;
  --red-soft: #fde8e8;

  /* per-version accent tints (catalog cards) */
  --v6: #4f46e5;   --v6-soft: #e0e7ff;   /* IPv6 */
  --v4: #0e9f6e;   --v4-soft: #d8f5e9;   /* IPv4 */
  --v3: #0891b2;   --v3-soft: #d3f1f8;   /* IPv4 Shared */
  --v5: #7c3aed;   --v5-soft: #ede4ff;   /* MTProto */

  --font-body: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;

  --r-panel: 22px;
  --r-item: 14px;
  --shadow: 0 10px 30px rgba(20, 27, 46, 0.07);
  --shadow-soft: 0 4px 14px rgba(20, 27, 46, 0.05);
  --shadow-ac: 0 8px 22px rgba(79, 70, 229, 0.3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 96px;
  overflow-x: hidden;
}
::selection { background: var(--ac-soft); }
button, input, select, textarea { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }

/* ---- шапка ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(238, 240, 246, 0.98), rgba(238, 240, 246, 0.85));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 26px; height: 26px; display: block; }
.brand-name {
  font-weight: 800; font-size: 22px; letter-spacing: -0.5px; line-height: 1; color: var(--ink);
}
.brand-accent { color: var(--ac); }

.balance-pill {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  background: var(--card); border: none; border-radius: 16px;
  padding: 8px 15px; box-shadow: var(--shadow-soft); cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}
.balance-pill:hover { box-shadow: var(--shadow); }
.balance-pill:active { transform: scale(0.97); }
.balance-label {
  font-size: 9px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1.2px; font-weight: 700;
}
.balance-value { font-weight: 800; font-size: 15px; color: var(--ac); }
.balance-flash { display: inline-block; animation: balflash 0.6s ease; }
@keyframes balflash { 30% { transform: scale(1.12); } }

/* ---- каркас ---- */
main { padding: 6px 12px; max-width: 640px; margin: 0 auto; }
.tab { animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

.panel {
  background: var(--card); border-radius: var(--r-panel);
  box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 14px;
}
.panel-list { padding: 6px 16px; }
.panel-title { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; margin: 2px 2px 14px; }
.section-title {
  margin: 18px 6px 10px; font-size: 13px; color: var(--muted);
  font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}
.section-lead { margin: 2px 6px 14px; color: var(--muted); font-size: 13.5px; font-weight: 500; line-height: 1.5; }

/* ---- поиск ---- */
.search-wrap { position: relative; margin: 4px 0 6px; }
input[type="text"], input[type="number"] {
  width: 100%; appearance: none; background: var(--card);
  border: 1.5px solid transparent; color: var(--ink);
  padding: 14px 16px; border-radius: 16px; font-size: 15px; font-weight: 600; outline: none;
  box-shadow: var(--shadow-soft); transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus { border-color: var(--ac); box-shadow: var(--shadow); }
input::placeholder { color: var(--muted); font-weight: 500; }
.search-wrap input { padding-left: 44px; }
.search-wrap::before {
  content: ""; position: absolute; left: 16px; top: 50%; width: 17px; height: 17px;
  transform: translateY(-50%); pointer-events: none; opacity: 0.8;
  background: no-repeat center / contain
    url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%237a839c" stroke-width="2.4" stroke-linecap="round"%3E%3Ccircle cx="11" cy="11" r="7"/%3E%3Cpath d="m20 20-3.5-3.5"/%3E%3C/svg%3E');
}
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; border-radius: 10px;
  background: var(--bg); color: var(--muted); cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.search-clear svg { width: 14px; height: 14px; }

/* ---- каталог: карточки версий ---- */
.version-list { display: flex; flex-direction: column; gap: 12px; }
.version-card {
  position: relative; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: none; border-radius: var(--r-panel);
  box-shadow: var(--shadow); padding: 18px 16px 16px;
  overflow: hidden; transition: transform 0.1s, box-shadow 0.2s;
  border-left: 4px solid var(--vc, var(--ac));
}
.version-card:hover { box-shadow: 0 14px 38px rgba(20, 27, 46, 0.1); }
.version-card:active { transform: scale(0.99); }
.vc-head { display: flex; align-items: center; gap: 11px; }
.vc-badge {
  width: 44px; height: 44px; flex: none; border-radius: 13px;
  display: grid; place-items: center; color: #fff;
  background: var(--vc, var(--ac)); box-shadow: 0 5px 14px rgba(20, 27, 46, 0.14);
}
.vc-badge svg { width: 24px; height: 24px; }
.vc-title { flex: 1; min-width: 0; }
.vc-name { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.vc-tag {
  display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 700;
  color: var(--vc, var(--ac)); background: var(--vc-soft, var(--ac-soft));
  padding: 3px 9px; border-radius: 999px; letter-spacing: 0.2px;
}
.vc-from { text-align: right; flex: none; }
.vc-from-label { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.vc-from-val { font-size: 17px; font-weight: 800; color: var(--ink); }
.vc-desc { margin: 12px 2px 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); font-weight: 500; }
.vc-cta {
  display: flex; align-items: center; gap: 6px; margin-top: 13px;
  font-size: 13.5px; font-weight: 800; color: var(--vc, var(--ac));
}
.vc-cta svg { width: 15px; height: 15px; }

/* ---- строки списков (страны) ---- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  border: none; background: transparent; padding: 12px 2px; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: opacity 0.15s, transform 0.06s;
}
.rows .row:last-child { border-bottom: none; }
.row:hover { opacity: 0.85; }
.row:active { transform: scale(0.99); }
.row-dim { opacity: 0.5; }
.row-dim.row { pointer-events: none; }
.row-body { flex: 1; min-width: 0; }
.row-name { font-weight: 700; font-size: 15.5px; letter-spacing: -0.1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.row-chevron { flex: none; color: var(--muted); display: grid; place-items: center; }
.row-chevron svg { width: 16px; height: 16px; }

.price-pill {
  flex: none; font-weight: 800; font-size: 13.5px; white-space: nowrap;
  color: var(--ac); background: var(--ac-soft); padding: 9px 14px; border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.row:hover .price-pill { background: var(--ac); color: #fff; }
.stock-pill {
  flex: none; font-weight: 700; font-size: 12px; white-space: nowrap;
  color: var(--muted); background: var(--bg); padding: 8px 12px; border-radius: 999px;
}

.flag { width: 34px; flex: none; display: flex; justify-content: center; }
.flag-wrap { position: relative; width: 28px; height: 21px; display: block; }
.flag-img {
  position: absolute; inset: 0; width: 28px; height: 21px; object-fit: cover; border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(20, 27, 46, 0.08); display: block;
}
.flag-none {
  width: 28px; height: 21px; border-radius: 4px; display: block;
  background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line);
}

/* ---- шторка ---- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30; background: rgba(20, 27, 46, 0.42);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fadein 0.2s ease;
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--card);
  border-radius: 26px 26px 0 0; box-shadow: 0 -14px 44px rgba(20, 27, 46, 0.18);
  padding: 8px 16px 0; max-width: 640px; margin: 0 auto;
  height: min(82vh, 680px); display: flex; flex-direction: column;
  animation: sheetup 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes sheetup { from { transform: translateY(60%); opacity: 0.4; } }
.sheet-grabber { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 10px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding-bottom: 4px; flex: none; }
.sheet-head-text { flex: 1; min-width: 0; }
.sheet-title { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.sheet-sub { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.sheet-back {
  flex: none; width: 40px; height: 40px; border: none; border-radius: 12px;
  background: var(--bg); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.sheet-back svg { width: 18px; height: 18px; }
.sheet-search { flex: none; }
.sheet-search input { background: var(--bg); box-shadow: none; }
.sheet-note {
  flex: none; display: flex; align-items: center; gap: 7px; margin: 8px 2px 4px;
  color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.4;
}
.sheet-note svg { width: 14px; height: 14px; flex: none; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 2px calc(18px + env(safe-area-inset-bottom)); }
/* Each pane must fill the remaining sheet height so its inner list can scroll. */
.sheet-pane { flex: 1; min-height: 0; }
#paneCountries { display: flex; flex-direction: column; }
.sheet .empty { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.loader { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.loader .spinner { width: 26px; height: 26px; border-width: 3px; }
.loader-msg { animation: fade 0.3s ease; text-align: center; max-width: 260px; line-height: 1.4; }
.offer-row[data-busy] { opacity: 0.6; pointer-events: none; }

/* ---- конфигуратор покупки ---- */
.cfg { display: flex; flex-direction: column; }
.cfg-country {
  display: flex; align-items: center; gap: 11px; padding: 12px 14px; margin: 4px 0 14px;
  background: var(--bg); border-radius: var(--r-item);
}
.cfg-country .row-name { font-size: 15px; }
.cfg-label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; margin: 6px 2px 9px; }
.period-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.stepper {
  display: flex; align-items: center; gap: 12px; background: var(--bg);
  border-radius: var(--r-item); padding: 8px; margin-top: 4px;
}
.stepper button {
  width: 44px; height: 44px; flex: none; border: none; border-radius: 11px;
  background: var(--card); color: var(--ac); font-size: 24px; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow-soft); display: grid; place-items: center;
  transition: transform 0.08s;
}
.stepper button:active { transform: scale(0.92); }
.stepper button:disabled { opacity: 0.4; cursor: default; }
.stepper input {
  flex: 1; text-align: center; background: transparent; box-shadow: none; border: none;
  font-size: 20px; font-weight: 800; padding: 0;
}
.quote-bar {
  position: sticky; bottom: 0; margin: 16px -16px 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,255,255,0.4), var(--card) 40%);
  border-top: 1px solid var(--line);
}
.quote-line { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 11px; }
.quote-unit { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.quote-total { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.quote-total .spinner { width: 20px; height: 20px; }

/* ---- карточки прокси ---- */
.list { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border-radius: var(--r-panel); padding: 16px; box-shadow: var(--shadow); }
.proxy-top { display: flex; align-items: center; gap: 10px; }
.proxy-check {
  width: 22px; height: 22px; flex: none; border-radius: 7px; border: 2px solid var(--line);
  background: var(--card); cursor: pointer; display: grid; place-items: center; padding: 0; color: transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.proxy-check svg { width: 13px; height: 13px; }
.proxy-check.on { background: var(--ac); border-color: var(--ac); color: #fff; }
.proxy-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.proxy-ver {
  font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px;
  color: var(--vc, var(--ac)); background: var(--vc-soft, var(--ac-soft)); flex: none;
}
.proxy-country { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; padding: 5px 11px; border-radius: 999px; font-weight: 700; white-space: nowrap; flex: none; }
.badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.expiring { background: var(--warn-soft); color: var(--warn); }
.badge.expired { background: var(--red-soft); color: var(--red); }

.expiry-row { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.expiry-row svg { width: 15px; height: 15px; flex: none; }
.expiry-strong { color: var(--ink); font-weight: 700; }

/* монокредный блок — «подпись» интерфейса */
.cred {
  margin-top: 13px; background: var(--bg); border-radius: var(--r-item); padding: 12px 12px 10px;
}
.cred-main { display: flex; align-items: center; gap: 10px; }
.cred-string {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13.5px; font-weight: 700;
  color: var(--ink); overflow-x: auto; white-space: nowrap; letter-spacing: 0.2px; padding: 2px 0;
}
.cred-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.copy-chip {
  display: inline-flex; align-items: center; gap: 5px; border: none; cursor: pointer;
  background: var(--card); color: var(--muted); border-radius: 9px; padding: 6px 10px;
  font-size: 11.5px; font-weight: 700; box-shadow: var(--shadow-soft);
  transition: transform 0.08s, color 0.12s;
}
.copy-chip:hover { color: var(--ac); }
.copy-chip:active { transform: scale(0.94); }
.copy-chip svg { width: 12px; height: 12px; }
.copy-chip b { color: var(--ink); font-weight: 700; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tg-connect {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px;
  text-decoration: none; width: 100%; min-height: 48px; border-radius: var(--r-item);
  background: linear-gradient(135deg, #6aa8ff, #2f7de0); color: #fff; font-weight: 700; font-size: 14.5px;
  box-shadow: 0 8px 22px rgba(47, 125, 224, 0.32);
}
.tg-connect svg { width: 19px; height: 19px; }

.proxy-actions { display: flex; gap: 9px; margin-top: 13px; }

/* инструкции по установке */
.guide { margin-top: 12px; background: var(--bg); border-radius: var(--r-item); padding: 0 14px; }
.guide summary {
  list-style: none; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px;
  padding: 12px 0; font-size: 13px; font-weight: 700; color: var(--muted);
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::before {
  content: ""; width: 15px; height: 15px; flex: none;
  background: no-repeat center / contain
    url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%237a839c" stroke-width="2"%3E%3Cpath d="M4 5h16v11H4zM8 20h8M12 16v4" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
}
.guide summary::after {
  content: ""; margin-left: auto; width: 11px; height: 11px;
  background: no-repeat center / contain
    url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"%3E%3Cpath d="M2 4.2 6 8l4-3.8" fill="none" stroke="%237a839c" stroke-width="2" stroke-linecap="round"/%3E%3C/svg%3E');
  transition: transform 0.2s;
}
.guide[open] summary::after { transform: rotate(180deg); }
.guide-body { padding: 0 0 14px; }
.guide-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; margin: 0 -2px; }
.guide-tab {
  flex: none; border: none; cursor: pointer; background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; box-shadow: var(--shadow-soft);
}
.guide-tab.active { background: var(--ac); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,0.28); }
.guide-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; color: var(--ink); font-weight: 500; }
.guide-steps li { margin-bottom: 6px; }
.guide-steps li::marker { color: var(--ac); font-weight: 700; }
.guide-note { margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.5; }

/* ---- фильтр-чипы ---- */
.filter-chips { display: flex; gap: 8px; margin: 4px 0 12px; flex-wrap: wrap; }

/* плавающая панель массового продления */
.bulk-bar {
  position: fixed; left: 12px; right: 12px; bottom: 78px; z-index: 22; max-width: 616px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 18px; padding: 12px 14px;
  box-shadow: 0 14px 34px rgba(20, 27, 46, 0.28); display: flex; align-items: center; gap: 10px;
  animation: toastin 0.2s ease;
}
.bulk-bar .bulk-count { font-weight: 800; font-size: 14px; flex: none; }
.bulk-bar .btn { min-height: 40px; }

/* ============================================================ КНОПКИ ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; background: var(--bg); color: var(--ink);
  min-height: 48px; padding: 12px 18px; border-radius: var(--r-item);
  font-size: 14.5px; font-weight: 700; letter-spacing: -0.1px; cursor: pointer; flex: 1;
  transition: transform 0.08s, filter 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { filter: brightness(0.965); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-primary { background: linear-gradient(135deg, #6d64f0, var(--ac) 55%, var(--ac-deep)); color: #fff; box-shadow: var(--shadow-ac); }
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:active { box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3); }
.btn-tonal { background: var(--ac-ghost); color: var(--ac-deep); }
.btn-tonal:hover { background: var(--ac-soft); filter: none; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-icon {
  flex: none; width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 12px;
  display: grid; place-items: center; background: var(--card); color: var(--ink); box-shadow: var(--shadow-soft);
}
.btn-icon svg { width: 17px; height: 17px; }
.btn-block { width: 100%; flex: none; margin-top: 12px; }
.btn-sm { min-height: 40px; padding: 9px 14px; font-size: 13px; flex: none; }

/* ---- баланс ---- */
.balance-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #6d64f0, var(--ac) 45%, var(--ac-deep));
  border-radius: var(--r-panel); padding: 24px; margin-bottom: 14px;
  box-shadow: 0 14px 34px rgba(79, 70, 229, 0.32);
}
.balance-card::after { content: ""; position: absolute; right: -46px; bottom: -70px; width: 190px; height: 190px; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, 0.12); }
.balance-card::before { content: ""; position: absolute; right: 34px; top: -58px; width: 130px; height: 130px; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, 0.08); }
.balance-card-label { font-size: 11px; color: rgba(255, 255, 255, 0.85); text-transform: uppercase; letter-spacing: 1.6px; font-weight: 700; }
.balance-card-value { font-size: 36px; font-weight: 800; margin-top: 7px; letter-spacing: -0.5px; color: #fff; }

.chips { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chip {
  background: var(--bg); border: 1.5px solid transparent; color: var(--ink);
  border-radius: 999px; padding: 11px 16px; font-weight: 700; cursor: pointer; font-size: 14px;
  transition: background 0.15s, color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.chip:hover { border-color: var(--ac-soft); }
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--ac); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3); }
#tab-balance .panel input[type="number"] { background: var(--bg); box-shadow: none; }
#tab-balance .panel input[type="number"]:focus { background: var(--card); box-shadow: var(--shadow-soft); }

.topup-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.rows .topup-row:last-child { border-bottom: none; }
.topup-row .amt { font-weight: 800; font-size: 14.5px; }
.topup-row .when { color: var(--muted); font-size: 12px; font-weight: 500; flex: 1; margin-left: 2px; }

/* ---- FAQ ---- */
.faq-item { background: var(--card); border-radius: var(--r-item); box-shadow: var(--shadow-soft); margin-bottom: 10px; padding: 0 16px; }
.faq-item summary { list-style: none; cursor: pointer; padding: 15px 0; font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; margin-left: auto; width: 12px; height: 12px; flex: none;
  background: no-repeat center / contain
    url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"%3E%3Cpath d="M2 4.2 6 8l4-3.8" fill="none" stroke="%237a839c" stroke-width="2" stroke-linecap="round"/%3E%3C/svg%3E');
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item .faq-a { padding: 0 0 16px; font-size: 13.5px; line-height: 1.6; color: var(--muted); font-weight: 500; }

/* ---- пустые состояния ---- */
.empty { text-align: center; color: var(--muted); padding: 30px 20px; line-height: 1.7; font-size: 14px; font-weight: 500; }
.empty-tall { padding: 60px 24px; }
.empty-ico { width: 44px; height: 44px; opacity: 0.5; margin-bottom: 6px; }

/* ---- нижняя навигация ---- */
.tabbar {
  position: fixed; bottom: 10px; left: 10px; right: 10px; z-index: 20; display: flex; gap: 4px;
  background: var(--card); border-radius: 22px; box-shadow: 0 12px 36px rgba(20, 27, 46, 0.12);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom) / 2); max-width: 640px; margin: 0 auto;
}
.tabbtn {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; font-size: 11px; font-weight: 700; cursor: pointer;
  border-radius: 16px; transition: color 0.15s, background 0.15s;
}
.tabbtn-ico { display: grid; place-items: center; position: relative; }
.tabbtn-ico svg { width: 22px; height: 22px; }
.tabbtn.active { color: var(--ac); background: var(--ac-ghost); }
.tabbtn:active { transform: scale(0.96); }
.tab-dot { position: absolute; top: -2px; right: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--ac); border: 2px solid var(--card); }

/* ---- админка ---- */
.admin-nav { margin: 4px 0 12px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { background: var(--card); border-radius: 18px; padding: 14px 15px; box-shadow: var(--shadow-soft); }
.stat-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; }
.stat-value { font-size: 21px; font-weight: 800; margin-top: 5px; letter-spacing: -0.3px; }
.stat-extra { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 3px; }
.stat-warn { box-shadow: inset 0 0 0 1.5px var(--red); }
.stat-warn .stat-value, .stat-warn .stat-extra { color: var(--red); }
.status-panel { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; padding: 14px 15px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.mini-row:last-child { border-bottom: none; }
.mini-row > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txt-red { color: var(--red); }
.txt-ok { color: var(--ok); }
.credit-form { display: flex; flex-direction: column; gap: 9px; }
.credit-form input { background: var(--bg); box-shadow: none; }
.credit-form .order-actions, .credit-form .proxy-actions { margin-top: 0; display: flex; gap: 9px; }
textarea {
  width: 100%; appearance: none; resize: vertical; background: var(--bg);
  border: 1.5px solid transparent; color: var(--ink); padding: 13px 15px; border-radius: var(--r-item);
  font-size: 15px; font-weight: 600; outline: none; margin-bottom: 12px; min-height: 110px; transition: border-color 0.15s;
}
textarea:focus { border-color: var(--ac); background: var(--card); }
textarea::placeholder { color: var(--muted); font-weight: 500; }
.feed-card { padding: 13px 14px; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 13px 19px; border-radius: 16px;
  font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(20, 27, 46, 0.25);
  z-index: 40; max-width: 90%; animation: toastin 0.22s ease;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--ok); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(79, 70, 229, 0.25);
  border-top-color: var(--ac); border-radius: 50%; display: inline-block;
  animation: spin 0.7s linear infinite; vertical-align: middle;
}
.btn-primary .spinner { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .tab, .toast, .sheet, .sheet-backdrop, .bulk-bar { animation: none; }
  .balance-flash { animation: none; }
}
