/* Калькулятор перекупа by devollve — дизайн-система основного сайта аренды (Pit Lane). */

:root {
  --bg: #0B0D11;
  --bg-raised: #101318;
  --bg-card: #15171C;
  --bg-hover: #1D2026;
  --border: #23262C;
  --text: #FFFFFF;
  --text-dim: #A8ADB7;
  --text-faint: #7A7F87;
  --accent: #FF7A00;
  --accent-2: #FF8D47;
  --accent-dim: rgba(255, 122, 0, 0.14);
  --green: #37C978;
  --red: #FF5C5C;
  --gold: #FBBF24;
  --plat: #60A5FA;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body { background: transparent; color: var(--text); font-family: var(--font); min-height: 100vh; }
h2 { font-size: 18px; font-weight: 700; }
button { font-family: inherit; cursor: pointer; transition: background .25s, border-color .25s, color .25s, opacity .25s, transform .2s, box-shadow .25s; }
input, select { font-family: inherit; }
.hidden { display: none !important; }
/* Атрибут hidden должен всегда скрывать — иначе display у .a2-dash/.a2-tab перебивает его
   (гейт показывал сайдбар, вкладки не переключались). */
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-dim); }
.pos { color: var(--green); } .neg { color: var(--red); }

/* Анимированный фон-сеть (за контентом) */
#bg-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }

/* Скроллбары в стиле сайта */
* { scrollbar-width: thin; scrollbar-color: #3A3A40 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3A3A40; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }

/* Контейнеры как на аренде: шапка/футер во всю ширину, контент ограничен */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.page { max-width: 1200px; width: 100%; margin: 0 auto; padding: 0 24px 40px; flex: 1; }
.accent { color: var(--accent); }

/* ---------- Кнопки ---------- */
/* Базовая геометрия у всех кнопок-вариантов: btn-primary/btn-ghost могут
   использоваться и без класса .btn — скругление не должно теряться */
.btn, .btn-primary, .btn-ghost {
  border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); text-decoration: none; display: inline-block;
}
.btn { background: var(--bg-hover); color: var(--text); }
.btn:hover { background: #333338; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1A1204; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--text); }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; width: 36px; height: 36px; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Шапка ---------- */
.topbar { border-bottom: 1px solid var(--border); background: var(--bg-raised); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 28px; }
.logo {
  font-weight: 800; letter-spacing: 1.5px; font-size: 15px; white-space: nowrap;
  cursor: default; user-select: none;
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
}
.logo .logo-main span { color: var(--accent); }
.logo:hover .logo-main span { text-shadow: 0 0 14px rgba(255,122,41,.5); }
.logo-by { display: block; color: #B8B8C0; font-size: 11px; font-weight: 600; letter-spacing: 3px; margin-top: 2px; text-align: center; }
.tabs { display: flex; gap: 4px; flex: 1; margin: 0; }
.tab { background: transparent; border: 1px solid transparent; color: var(--text-dim); font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 10px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--accent-dim); }
.topbar-right { display: flex; gap: 8px; align-items: center; }

/* Меню профиля — своё выпадающее, а не системный select (как на аренде) */
.profile-dd { position: relative; }
.profile-dd-btn {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; max-width: 240px; white-space: nowrap;
}
.profile-dd-btn:hover { border-color: var(--accent); }
.dd-arrow { color: var(--text-dim); font-size: 11px; }
.profile-dd-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 230px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.dd-caption { color: var(--text-dim); font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 2px 8px 8px; }
.dd-item { display: flex; align-items: stretch; gap: 2px; border-radius: 8px; }
.dd-item-main {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: transparent; border: none; color: var(--text); text-align: left;
  padding: 9px 10px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.dd-item-main small { color: var(--text-dim); font-weight: 400; font-size: 12px; }
.dd-item-main:hover { background: var(--bg-hover); }
.dd-item.active .dd-item-main {
  background: linear-gradient(90deg, rgba(255,122,0,0.10), transparent 75%);
  color: var(--text); box-shadow: inset 3px 0 0 var(--accent);
}
.dd-item.active .dd-item-main small { color: var(--accent); }
.dd-item-edit, .dd-item-del {
  background: transparent; border: none; color: var(--text-dim);
  padding: 0 9px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .15s;
}
.dd-item:hover .dd-item-edit, .dd-item:hover .dd-item-del { opacity: 1; }
.dd-item-edit:hover { color: var(--accent); background: var(--bg-hover); }
.dd-item-del:hover { color: var(--red); background: var(--bg-hover); }
.dd-add {
  width: 100%; margin-top: 8px; background: transparent; border: 1px dashed var(--border);
  color: var(--text-dim); border-radius: 8px; padding: 9px; font-size: 13px; font-weight: 600;
}
.dd-add:hover { color: var(--accent); border-color: var(--accent); }

/* Сетка серверов в модалке профиля */
.player-modal { max-width: 640px; }
.server-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
.server-cell {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px 6px 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: border-color .12s, background .12s;
}
.server-cell:hover { border-color: var(--text-dim); }
.server-cell.active { border-color: var(--accent); background: var(--accent-dim); }
.server-cell.active .server-name { color: var(--accent); }
.server-icon { font-size: 22px; line-height: 1; }
.server-cell small { color: var(--text-dim); font-size: 10px; font-family: var(--mono); }
.server-name { font-size: 12px; font-weight: 700; }
.field-hint { display: block; color: var(--text-dim); font-size: 11px; margin-top: 5px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.slots-prop { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.slots-prop span { color: var(--text-faint); }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* Заметки */
.notes-modal { max-width: 560px; }
.notes-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.notes-head h3 { margin-bottom: 0; }
.notes-head-actions { display: flex; gap: 8px; align-items: center; }
.notes-list { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; }
.note-form { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.note-form input, .note-form textarea { margin-bottom: 8px; }
.note-form textarea { min-height: 90px; }
.note-item { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.note-item-head { display: flex; align-items: center; gap: 8px; }
.note-title { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; }
.note-date { color: var(--text-faint); font-size: 11px; font-family: var(--mono); }
.note-body { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin-top: 6px; white-space: pre-wrap; }

/* ---------- KPI-плитки (как .stat основного сайта) ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 16px; }
.kpi { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { color: var(--text-faint); font-size: 12px; }
.kpi-value { font-size: 22px; font-weight: 700; font-family: var(--mono); }
.kpi-sub { color: var(--text-faint); font-size: 12px; }

/* ---------- VIP-статус (строка чипов, как на основном сайте) ---------- */
.vip-inline { display: flex; align-items: center; gap: 8px; margin: 18px 0 14px; flex-wrap: wrap; }
.vip-inline-label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.vip-chip { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 96px; }
.vip-chip span { font-size: 11px; color: var(--text-dim); font-weight: 500; }
.vip-chip:hover { border-color: var(--text); }
.vip-chip.active { border-color: var(--accent); background: var(--accent-dim); }
.vip-chip.vip-gold { color: var(--gold); }
.vip-chip.vip-gold:hover { border-color: var(--gold); }
.vip-chip.vip-gold.active { border-color: var(--gold); background: rgba(251,191,36,0.1); }
.vip-chip.vip-plat { color: var(--plat); }
.vip-chip.vip-plat:hover { border-color: var(--plat); }
.vip-chip.vip-plat.active { border-color: var(--plat); background: rgba(96,165,250,0.1); }

/* ---------- Панель бота (оранжевая полоса слева, по концепту) ---------- */
.bot-panel { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 16px 20px; }
.bot-panel strong { font-size: 15px; }
.bot-panel p { color: var(--text-dim); font-size: 13px; margin-top: 4px; max-width: 680px; }
.bot-panel-actions { display: flex; gap: 10px; white-space: nowrap; }

/* ---------- Панели / сетка калькулятора ---------- */
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.count { color: var(--text-dim); font-weight: 500; margin-left: 4px; }

.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: stretch; --panel-h: 500px; }
.add-panel { grid-column: span 1; }
.deals-panel { grid-column: span 2; }
.inv-panel { grid-column: span 1; }
.calc-grid > .panel { height: var(--panel-h); display: flex; flex-direction: column; }
.deals-panel .deals-grid { flex: 1; overflow-y: auto; align-content: start; padding-right: 4px; }
.deals-panel .deals-grid:empty { flex: 0; }
.deals-panel #dealsEmpty { flex: 1; display: flex; align-items: center; justify-content: center; }
.inv-panel .inv-list { flex: 1; overflow-y: auto; padding-right: 4px; }
.inv-panel .inv-list .empty { height: 100%; display: flex; align-items: center; justify-content: center; }
.add-panel .add-form { overflow-y: auto; }

/* Форма добавления */
.seg { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.seg-btn { flex: 1; background: transparent; border: 0; color: var(--text-dim); padding: 9px; border-radius: 8px; font-weight: 600; }
.seg-btn.active { background: var(--bg-hover); color: var(--text); }
.add-form { display: flex; flex-direction: column; }
.add-form label { color: var(--text-dim); font-size: 12px; margin: 12px 0 6px; font-weight: 600; }
.add-form input, .add-form select { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 11px 12px; font-size: 14px; width: 100%; }
.add-form input:focus, .add-form select:focus { outline: none; border-color: var(--accent); }
.btn-primary.submit, .add-form .btn-primary { background: var(--accent); color: #1A1204; border: 0; border-radius: 8px; padding: 12px; font-weight: 700; margin-top: 16px; }
.hint { color: var(--text-faint); font-size: 12px; margin-top: 10px; }
.cash-btns { display: flex; gap: 10px; margin-top: 16px; }
.btn-income, .btn-expense { flex: 1; border: 0; border-radius: 8px; padding: 12px; font-weight: 700; color: #fff; }
.btn-income { background: #1f7a44; } .btn-income:hover { background: #259150; }
.btn-expense { background: #8a3227; } .btn-expense:hover { background: #a63c2f; }

/* Поиск с автодополнением */
.search-wrap { position: relative; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; max-height: 340px; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.active { background: var(--bg-hover); }
.sr-thumb { width: 40px; height: 30px; object-fit: contain; border-radius: 6px; background: var(--bg); flex: 0 0 auto; }
.sr-name { font-weight: 600; font-size: 13px; }
.sr-meta { color: var(--text-dim); font-size: 11px; }
.sr-cat { margin-left: auto; color: var(--accent-2); font-size: 11px; white-space: nowrap; }

/* Выбранный предмет + варианты */
.picked { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-top: 10px; }
.picked img { width: 44px; height: 32px; object-fit: contain; }
.picked .p-name { font-weight: 600; }
.picked .p-clear { margin-left: auto; color: var(--text-dim); background: 0; border: 0; font-size: 16px; }
.variants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.swatch { width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--border); background: var(--bg); object-fit: contain; cursor: pointer; }
.swatch.active { border-color: var(--accent); }

/* Активные сделки */
.deals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.deal-card { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.deal-img { width: 100%; height: 96px; object-fit: contain; background: var(--bg-raised); border-radius: 8px; }
.deal-name { font-weight: 600; font-size: 13px; padding-right: 20px; }
.deal-date { color: var(--text-dim); font-size: 11px; }
.deal-rows { display: flex; flex-direction: column; gap: 2px; font-size: 12px; margin-top: 4px; }
.deal-rows .r { display: flex; justify-content: space-between; }
.deal-rows .r span:first-child { color: var(--text-dim); }
.deal-sell { display: flex; gap: 6px; margin-top: 8px; }
.deal-sell input { flex: 1; min-width: 0; background: var(--bg-raised); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px; }
.deal-sell button { background: var(--accent); color: #1A1204; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 700; }

/* Крестик удаления */
.card-del { position: absolute; top: 8px; right: 8px; z-index: 2; width: 22px; height: 22px; border-radius: 6px; line-height: 1; background: rgba(0,0,0,.35); color: var(--text-dim); border: 1px solid var(--border); font-size: 12px; }
.card-del:hover { background: var(--red); color: #fff; border-color: var(--red); }
.row-del { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 6px; line-height: 1; background: transparent; color: var(--text-dim); border: 1px solid transparent; font-size: 12px; }
.row-del:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Инвентарь */
.inv-sum { color: var(--accent); font-weight: 700; font-family: var(--mono); }
.inv-list { display: flex; flex-direction: column; }
.inv-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.inv-item img { width: 40px; height: 30px; object-fit: contain; background: var(--bg-raised); border-radius: 6px; }
.inv-main { min-width: 0; flex: 1; }
.inv-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-date { color: var(--text-dim); font-size: 11px; }
.inv-val { margin-left: auto; text-align: right; font-size: 12px; white-space: nowrap; font-family: var(--mono); }
.best-rank { color: var(--accent); font-weight: 700; width: 16px; text-align: center; flex: 0 0 auto; }

/* Таблица истории */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
.deals-table { width: 100%; border-collapse: collapse; }
.deals-table th { text-align: left; color: var(--text-faint); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.deals-table td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.deals-table td.mono, .deals-table .num { font-family: var(--mono); }

/* Аналитика */
.analytics-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.analytics-body .panel { background: var(--bg-raised); }

/* Рынок — пошаговый выбор */
.market-step { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.step-num { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; margin-top: 6px; background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(255,122,0,.4); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.step-body { flex: 1; min-width: 0; }
.step-label { color: var(--text-dim); font-size: 12px; margin-bottom: 8px; }
.step-label .muted { opacity: .8; }
/* Поиск предмета: компактный, а не во всю ширину панели */
.market-search { flex: 0 1 420px; max-width: 420px; min-width: 220px; }
.market-search input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.market-search input:focus { outline: none; border-color: var(--accent); }

.server-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.server-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); border-radius: 20px; padding: 7px 12px; font-size: 13px; font-weight: 600; }
.server-chip:hover { border-color: var(--accent-2); color: var(--text); }
.server-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.chip-n { color: var(--text-dim); font-size: 11px; font-weight: 500; font-family: var(--mono); }
.server-chip.active .chip-n { color: var(--accent-2); }

.market-view-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.metric-seg, .period-seg { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.metric-seg button, .period-seg button { background: 0; border: 0; color: var(--text-dim); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.metric-seg button.active, .period-seg button.active { background: var(--bg-hover); color: var(--accent); }

/* Точки графика: заметная реакция на наведение + кастомный тултип в стиле сайта */
.market-chart { min-height: 320px; position: relative; }
.chart-dot { transition: r .1s ease; pointer-events: none; }
.chart-dot.active { r: 6.5; stroke: var(--text); stroke-width: 2; }
.chart-bar { transition: opacity .1s ease; pointer-events: none; }
.chart-bar.active { opacity: 1; filter: brightness(1.35); }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-tip {
  position: absolute; z-index: 6; transform: translate(-50%, calc(-100% - 14px));
  background: rgba(16, 19, 24, 0.97); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 10px; padding: 8px 12px;
  pointer-events: none; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.chart-tip::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: rgba(16,19,24,0.97); border-bottom: 0;
}
.chart-tip-date { color: var(--text-faint); font-size: 11px; margin-bottom: 2px; }
.chart-tip-sum { color: var(--accent); font-weight: 800; font-size: 16px; font-family: var(--mono); }
.chart-tip-meta { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; }
.chart-legend .lg { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.chart-legend .sw { width: 12px; height: 3px; border-radius: 2px; }

.empty { color: var(--text-dim); text-align: center; padding: 30px; font-size: 13px; }

/* ---------- Модалки (стиль основного сайта: bg-raised + оранжевая полоса сверху) ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: var(--bg-raised); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 14px; padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { margin: 0 0 6px; font-size: 17px; }
.modal-box .modal-sub { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin: 0 0 16px; }
.modal-box label { display: block; color: var(--text-dim); font-size: 12px; margin: 12px 0 6px; font-weight: 600; }
.modal-box input, .modal-box select, .modal-box textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 11px 12px; font-size: 14px; }
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus { outline: none; border-color: var(--accent); }
.modal-box textarea { min-height: 120px; resize: vertical; font-family: var(--font); line-height: 1.5; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Кандидаты для неоднозначной продажи */
.sale-candidates { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sale-cand { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.sale-cand:hover { border-color: var(--accent); background: var(--accent-dim); }
.sale-cand img { width: 40px; height: 30px; object-fit: contain; background: var(--bg-raised); border-radius: 6px; }

/* Тост */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--bg-raised); border: 1px solid var(--border); color: var(--text); padding: 12px 18px; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.5); z-index: 200; max-width: 90vw; text-align: center; }

/* Табы-панели */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

@media (max-width: 1200px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-grid > .panel { height: auto; max-height: 560px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .tabs { order: 3; width: 100%; justify-content: center; flex: none; }
  .analytics-body { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
}
@media (max-width: 640px) {
  #app { padding: 0 12px 40px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .bot-panel { flex-direction: column; align-items: flex-start; }
  .vip-chip { min-width: 0; flex: 1; }
}

/* ---------- Футер (как на сайте аренды) ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 32px; background: rgba(11,13,17,0.5); }
.footer-inner {
  max-width: 1240px; margin: 0 auto; padding: 8px 24px;
  display: flex; align-items: center; gap: 24px;
  font-size: 11px; color: var(--text-dim);
}
.footer-brand { font-weight: 600; white-space: nowrap; line-height: 1.25; }
.footer-brand small { display: block; color: var(--text-faint); font-weight: 400; }
.footer-note {
  flex: 1; min-width: 320px; color: var(--text-faint); line-height: 1.35; font-size: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.footer-links { display: grid; grid-template-columns: auto auto; gap: 4px 18px; justify-content: end; }
.footer-links a { color: var(--text-dim); text-decoration: none; white-space: nowrap; }
.footer-links a:hover { color: var(--accent); }
.footer-links a:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fl-ico { display: inline-block; width: 1.5em; }
@media (max-width: 860px) {
  .footer-inner { flex-wrap: wrap; gap: 8px 20px; }
  .footer-note { order: 3; min-width: 100%; }
}
.legal-body { font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.legal-body p { margin-bottom: 12px; }
.legal-body b { color: var(--text); font-weight: 600; }

/* ---------- Подсказки «?» (кружок с пояснением) ---------- */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--text-faint); color: var(--text-faint);
  font-size: 10px; font-weight: 700; cursor: help; margin-left: 6px; line-height: 1;
  position: relative; vertical-align: middle;
}
.help:hover { border-color: var(--accent); color: var(--accent); }
.help:hover::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  z-index: 60; width: max-content; max-width: 260px;
  background: var(--bg-raised); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  font-family: var(--font); font-size: 12px; font-weight: 500; line-height: 1.45;
  white-space: normal; text-align: left; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
/* у правой колонки подсказка не должна уезжать за край */
.inv-panel .help:hover::after { left: auto; right: 0; transform: none; }

/* ---------- Перемещение между активными и инвентарём ---------- */
.move-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; padding: 7px 10px; font-size: 12px; font-weight: 600; width: 100%;
}
.move-btn:hover { border-color: var(--accent); color: var(--accent); }
.inv-item .move-btn { width: auto; padding: 5px 8px; font-size: 11px; }
.inv-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

/* ---------- Аналитика: график доходности ---------- */
.chart-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.date-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-range input[type="date"] {
  background: rgba(21,23,28,.6); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: var(--font);
  color-scheme: dark;
}
.date-range input[type="date"]:focus { outline: none; border-color: var(--accent); }
.date-range .btn, .date-range .btn-ghost { padding: 7px 12px; font-size: 13px; }
.profit-summary { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; }
.ps-item { display: flex; flex-direction: column; gap: 2px; }
.ps-label { color: var(--text-faint); font-size: 11px; }
.ps-value { font-size: 18px; font-weight: 700; font-family: var(--mono); }

/* ==================================================================
   СТЕКЛО — финальные переопределения (как на сайте аренды).
   Держать В КОНЦЕ файла: иначе фоны выше по каскаду их перекроют.
   Прозрачность без backdrop-filter: фон-сеть просвечивает, скролл плавный.
   ================================================================== */
.kpi, .panel, .bot-panel, .deal-card, .vip-chip, .seg, .metric-seg, .period-seg,
.server-chip, .picked, .search-results, .modal-box, .toast, .sale-cand,
.profile-select, .add-form input, .add-form select, .deal-sell input, .market-search input {
  background: rgba(21, 23, 28, 0.6);
}
.seg-btn.active, .metric-seg button.active, .period-seg button.active { background: rgba(255, 122, 0, 0.14); }
.server-chip.active { background: rgba(255, 122, 0, 0.14); }
.analytics-body .panel { background: rgba(21, 23, 28, 0.45); }
.deal-img, .inv-item img, .sr-thumb, .swatch { background: rgba(11, 13, 17, 0.55); }

/* VIP-чипы: стеклянные, без цветных заливок; активный — оранжевая обводка,
   цветной остаётся только текст статуса (как на аренде) */
.vip-chip { border: 1px solid var(--border); border-radius: 12px; padding: 10px 22px; font-size: 14px; min-width: 118px; gap: 3px; }
.vip-chip span { font-size: 12px; }
.vip-chip:hover { border-color: var(--accent); }
.vip-chip.active,
.vip-chip.vip-gold.active,
.vip-chip.vip-plat.active { border-color: var(--accent); background: rgba(21, 23, 28, 0.6); }
@media (max-width: 860px) { .vip-chip { min-width: 0; padding: 9px 8px; font-size: 12px; } }

/* ===== Порт дизайн-языка админки Аренды (a2) — из web/styles.css ===== */

/* Каркас страницы /admin.html: шапка + меню слева + контент */
.a2-page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
.a2-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.a2-brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.a2-topbar-actions { display: flex; align-items: center; gap: 12px; }
.a2-whoami { color: var(--text-dim); font-size: 13px; }
.a2-dash { display: flex; align-items: flex-start; gap: 20px; }
.a2-side { position: sticky; top: 20px; width: 200px; flex-shrink: 0; }
.a2-nav { display: flex; flex-direction: column; gap: 4px; }
.a2-nav-btn {
  text-align: left; padding: 11px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: transparent; border: 1px solid transparent; color: var(--text-dim); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.a2-nav-btn:hover { background: var(--bg-hover); color: var(--text); }
.a2-nav-btn.active { background: var(--bg-card); border-color: var(--border); color: var(--text); }
.a2-content { flex: 1; min-width: 0; }
.a2-tab { display: flex; flex-direction: column; gap: 16px; }

@media (max-width: 860px) {
  .a2-dash { flex-direction: column; }
  .a2-side { position: static; width: 100%; }
  .a2-nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .a2-nav-btn { white-space: nowrap; }
}

/* Гейт доступа (код разблокировки) */
.a2-gate { display: flex; justify-content: center; padding: 50px 0; }
.a2-gate-card { max-width: 430px; width: 100%; text-align: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px; }
.a2-gate-ico { font-size: 40px; margin-bottom: 8px; }
.a2-gate-card h2 { margin-bottom: 10px; font-size: 20px; }
.a2-gate-card p { color: var(--text-dim); font-size: 13px; line-height: 1.55; margin-bottom: 18px; }
.a2-gate-card code { background: var(--bg); padding: 1px 6px; border-radius: 5px; font-family: var(--mono); color: var(--accent); }
.a2-gate-card .btn { width: 100%; }
.a2-gate-err { color: var(--red); font-size: 13px; margin-top: 12px; }

/* Карточки-графики и карточки-таблицы */
.chart-card {
  margin-top: 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.chart-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text-dim); }
.admin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-card-head h3 { margin: 0; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; color: var(--text-faint); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admin-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.admin-table tbody td { height: 50px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

/* KPI-плитки, счётчик, поля ввода */
.a2-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 4px; }
.a2-count { color: var(--text-faint); font-size: 13px; font-family: var(--mono); }
.a2-input, .a2-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: var(--font); font-size: 14px; padding: 10px 12px; margin-bottom: 10px;
}
.a2-textarea { resize: vertical; min-height: 110px; }
.a2-input:focus, .a2-textarea:focus { outline: none; border-color: var(--accent); }

@media (max-width: 860px) {
  .a2-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Админка калькулятора: доп. элементы ===== */
.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; background: var(--bg-hover); color: var(--text-dim); }
.badge.on { background: rgba(60,180,90,.22); color: #cdeccd; }
.badge.off { background: rgba(200,80,80,.20); color: #f0cccc; }
.admin-table code { cursor: pointer; font-family: var(--mono); color: var(--accent); }
.a2-kpi-tile { display: flex; flex-direction: column; align-items: center; padding: 12px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); }
.a2-kpi-tile b { font-size: 22px; }
.a2-kpi-tile span { font-size: 12px; color: var(--text-dim); }
.admin-gen { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin: 12px 0; }
.admin-gen input { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 11px; width: 100%; }
/* Поле формы генерации с подписью сверху */
.gen-field { display: flex; flex-direction: column; gap: 4px; }
.gen-field > span { font-size: 12px; color: var(--text-dim); }
.gen-field-grow { flex: 1; min-width: 140px; }
.admin-filter { margin: 8px 0; font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-filter button { background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; padding: 4px 10px; }
.admin-filter button.active { background: var(--accent); color: #1A1204; border-color: var(--accent); }
/* Раскрывающаяся пачка ключей */
.key-batch { border: 1px solid var(--border); border-radius: 10px; margin: 8px 0; overflow: hidden; }
.key-batch > summary { cursor: pointer; padding: 10px 14px; background: var(--bg-card); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; list-style: none; }
.key-batch > summary::-webkit-details-marker { display: none; }
.key-batch > summary::before { content: '▸'; color: var(--text-dim); }
.key-batch[open] > summary::before { content: '▾'; }
.key-batch .table-wrap { padding: 0 8px 8px; }
/* Блок подписки в настройках */
.sub-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.sub-block .sub-status { font-size: 14px; margin-bottom: 12px; }
.sub-block .sub-row { display: flex; gap: 8px; margin: 10px 0; }
.sub-block .sub-row input { flex: 1; }

/* ===== Виджет чата ===== */
#chat-widget { position: fixed; right: 20px; bottom: 20px; z-index: 900; }
.chat-bubble { position: relative; width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--accent); color: #1A1204; font-size: 24px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.chat-dot { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg); }
.chat-panel { position: absolute; right: 0; bottom: 64px; width: 340px; max-width: calc(100vw - 40px);
  height: 460px; max-height: calc(100vh - 120px); display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px;
  border-bottom: 1px solid var(--border); font-weight: 600; }
.chat-x { background: none; border: none; color: var(--text-dim); font-size: 20px; line-height: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 90%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: 11px; color: var(--text-dim); }
.chat-text { background: var(--bg-hover); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 10px; word-break: break-word; white-space: pre-wrap; display: inline-block; }
.chat-msg.mine .chat-text { background: rgba(230,168,60,.15); }
.chat-err { color: var(--red); font-size: 12px; padding: 4px 12px; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; }
.chat-form button { flex-shrink: 0; }
.chat-locked { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center; color: var(--text-dim); }
.msg-deleted { opacity: .5; }
.chat-tabs { display: flex; gap: 4px; }
.chat-tabs button { background: transparent; border: 1px solid transparent; color: var(--text-dim);
  font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 8px; }
.chat-tabs button.active { color: var(--text); background: var(--accent-dim); }
/* Экран-заглушка доступа (закрытая бета / нужен вход) */
.access-gate { position: fixed; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
