/*
 * Тёмная плотная тема трейдерского скринера: максимум данных на экран,
 * спокойный фон и один акцентный цвет, чтобы внимание держали цифры и графики.
 */

:root {
  --bg: #0a0a0f;
  --surface: #121420;
  --surface-2: #191c2b;
  --border: #262a3c;
  --border-strong: #363b52;

  --text: #f5f6fa;
  --text-dim: #9298ad;
  --text-faint: #686e85;

  --accent: #795ceb;
  --accent-bright: #a78bfa;
  --accent-soft: rgba(121, 92, 235, 0.16);

  /* Неоновое свечение: тонкий ореол вокруг акцентных элементов */
  --glow-accent: 0 0 0 1px rgba(121, 92, 235, 0.45), 0 0 14px rgba(121, 92, 235, 0.3);
  --glow-accent-soft: 0 0 10px rgba(121, 92, 235, 0.22);
  --glow-up: 0 0 0 1px rgba(42, 157, 143, 0.4), 0 0 12px rgba(42, 157, 143, 0.25);
  --glow-text: 0 0 18px rgba(167, 139, 250, 0.55);

  --up: #26a69a;
  --down: #ef5350;

  /* Уровни Фибоначчи — в гамме акцента, чтобы сетка не выбивалась из темы. */
  --fib: #a78bfa;
  --fib-bright: #c4b5fd;
  --fib-dim: #6d5bb8;
  /* Звезда избранного: отдельный цвет, иначе сливалась бы с уровнями. */
  --star: #e0a82e;

  --radius: 8px;
  --radius-sm: 6px;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(121, 92, 235, 0.10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 13px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; }

/* ───── Шапка ───── */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  height: 48px;
  background: linear-gradient(180deg, var(--surface), rgba(18, 20, 32, 0.92));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(121, 92, 235, 0.18), 0 8px 24px rgba(0, 0, 0, 0.4);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  color: var(--text);
  white-space: nowrap;
}
.brand-accent {
  color: var(--accent-bright);
  margin-left: 3px;
  text-shadow: var(--glow-text);
}
.brand-sub { color: var(--text-faint); font-size: 11px; }

/* Логотип ведёт на главную — подсвечиваем, но текстом, а не кнопкой.
   Отступы с обратными полями расширяют область клика, не сдвигая надпись. */
.brand-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 7px 4px;
  margin: -7px -4px;
}
.brand-link:hover .brand-mark { text-shadow: 0 0 16px rgba(167, 139, 250, 0.55); }

.status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.status-dot.is-running {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(121, 92, 235, 0.9);
  animation: pulse 1.2s ease-in-out infinite;
}
.status-dot.is-idle { background: var(--up); box-shadow: 0 0 8px rgba(38, 166, 154, 0.8); }
.status-dot.is-error { background: var(--down); box-shadow: 0 0 8px rgba(239, 83, 80, 0.8); }

@keyframes pulse { 50% { opacity: 0.25; } }

/* ───── Кнопки и поля ───── */

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: var(--glow-accent-soft);
  color: #fff;
}
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-primary {
  background: linear-gradient(180deg, #8a6ff0, var(--accent));
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--glow-accent-soft);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 0 18px rgba(121, 92, 235, 0.45);
}
.btn-ghost { background: transparent; border-color: var(--border-strong); }

input[type="number"], input[type="search"], select {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 9px;
  font-size: 12px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow-accent-soft);
}
input[type="search"]::placeholder { color: var(--text-faint); }

/* ───── Панель параметров ───── */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.control { display: flex; flex-direction: column; gap: 3px; }
/* Авторское display перебивает браузерное [hidden] — гасим вручную. */
.control[hidden] { display: none; }
.control label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.4px; }
.control input[type="number"] { width: 118px; font-variant-numeric: tabular-nums; }
.hint { font-size: 10px; color: var(--text-faint); }

.control-actions { flex-direction: row; align-items: center; gap: 10px; }

/* На широком экране кнопка уходит вправо, на узком остаётся в общем потоке. */
@media (min-width: 1100px) {
  .control-actions { margin-left: auto; }
}
.checkbox { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.checkbox input { accent-color: var(--accent); }

/* ───── Вкладки ───── */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 9px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  box-shadow: 0 2px 10px -2px rgba(121, 92, 235, 0.6);
}

.badge {
  display: inline-block;
  background: var(--surface-2);
  border-radius: 20px;
  padding: 1px 6px;
  font-size: 10px;
  margin-left: 3px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ───── Раскладка ───── */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 12px;
  padding: 12px 16px 32px;
  align-items: start;
}

main { min-width: 0; }
.panel { display: none; }
.panel.is-active { display: block; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar input[type="search"] { width: 190px; }
.toolbar-note { color: var(--text-faint); font-size: 11px; }

/* ───── Фильтры по стадии ───── */

.stage-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }

.stage-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  padding: 5px 12px;
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.stage-chip:hover { color: var(--text); border-color: var(--border-strong); }
.stage-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #d6c9ff;
  box-shadow: var(--glow-accent-soft);
}
.stage-chip.is-active .badge { background: rgba(121, 92, 235, 0.3); color: #ddd6fe; }

/* ───── Сетка карточек ───── */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: rgba(121, 92, 235, 0.5);
  box-shadow: 0 0 20px rgba(121, 92, 235, 0.14), 0 6px 24px rgba(0, 0, 0, 0.35);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}

.card-fav {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.card-fav:hover, .card-fav.is-active { color: var(--star); text-shadow: 0 0 10px rgba(224, 168, 46, 0.7); }

.card-symbol {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.2px;
  cursor: pointer;
}
.card-symbol:hover { color: #a78bfa; }

.card-gain {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--up);
  font-family: var(--mono);
}
.card-threshold { font-size: 10px; color: var(--text-faint); }

.card-price {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

/* Шкала положения цены внутри движения. */
.fib-scale {
  position: relative;
  height: 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(42,157,143,0.12), rgba(121,92,235,0.10) 55%, rgba(224,87,111,0.12));
}

.fib-scale-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}
.fib-scale-tick.is-entry { background: rgba(167, 139, 250, 0.6); }

.fib-scale-label {
  position: absolute;
  top: 3px;
  font-size: 9px;
  color: var(--text-faint);
  transform: translateX(-50%);
  font-family: var(--mono);
  pointer-events: none;
}
.fib-scale-label.is-entry { color: var(--fib); }

.fib-scale-price {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 2px;
  background: #fff;
  border-radius: 1px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.85), 0 0 20px rgba(167, 139, 250, 0.5);
}

/* ───── График и метрики поверх него ───── */

.card-chart { height: 330px; position: relative; overflow: hidden; }

.chart-metrics {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 4;
  pointer-events: none;
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 8px;
  font-size: 10px;
  font-family: var(--mono);
  line-height: 1.55;
  background: rgba(10, 10, 15, 0.68);
  padding: 3px 6px;
  border-radius: 4px;
}
.chart-metrics dt { color: var(--text-faint); }
.chart-metrics dd { margin: 0; color: var(--text); }
.chart-metrics dd.is-up { color: var(--up); }
.chart-metrics dd.is-fib { color: var(--fib-bright); }

.chart-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: 11px;
}

/* ───── Строка действия по стратегии ───── */

.card-strategy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-height: 30px;
}
.card-strategy b { color: var(--text); font-weight: 600; font-family: var(--mono); }

.stage-pill {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  flex: none;
}
.stage-pill.stage-waiting {
  background: var(--accent-soft);
  color: #d6c9ff;
  box-shadow: inset 0 0 0 1px rgba(121, 92, 235, 0.35), 0 0 10px rgba(121, 92, 235, 0.18);
}
.stage-pill.stage-in-position {
  background: rgba(42, 157, 143, 0.16);
  color: #7ff0dd;
  box-shadow: inset 0 0 0 1px rgba(42, 157, 143, 0.4), 0 0 10px rgba(42, 157, 143, 0.2);
}
.stage-pill.stage-underwater {
  background: rgba(224, 87, 111, 0.16);
  color: #ffa8b4;
  box-shadow: inset 0 0 0 1px rgba(224, 87, 111, 0.4), 0 0 10px rgba(224, 87, 111, 0.2);
}
.stage-pill.stage-closed { background: var(--surface-2); color: var(--text-faint); }
.stage-pill.stage-idle { background: var(--surface-2); color: var(--text-faint); }

.stage-next { margin-left: auto; text-align: right; white-space: nowrap; }
.stage-distance { color: var(--text-faint); font-size: 10.5px; }

.stage-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--text-faint);
}
.stage-dot.stage-waiting { background: var(--accent); }
.stage-dot.stage-in-position { background: var(--up); }
.stage-dot.stage-underwater { background: var(--down); }

.is-up { color: var(--up); }
.is-down { color: var(--down); }

.empty { color: var(--text-faint); text-align: center; padding: 40px 0; font-size: 12px; }

/* ───── Боковой список монет ───── */

.sidebar {
  position: sticky;
  top: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 76px);
  overflow: hidden;
}

.sidebar-head {
  padding: 9px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-title { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar-head input[type="search"] { width: 100%; }
.sidebar-filters { display: flex; gap: 4px; flex-wrap: wrap; }

.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  padding: 3px 9px;
  font-size: 10.5px;
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--glow-accent-soft);
}

.sidebar-list { overflow-y: auto; padding: 4px; }
.sidebar-list::-webkit-scrollbar { width: 8px; }
.sidebar-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.symbol-row { display: flex; align-items: center; border-radius: var(--radius-sm); }
.symbol-row:hover { background: var(--surface-2); }
.symbol-row.has-signal .symbol-name { color: var(--up); }

.symbol-star {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1;
  padding: 6px 3px 6px 6px;
  cursor: pointer;
}
.symbol-star:hover, .symbol-star.is-active { color: var(--star); text-shadow: 0 0 10px rgba(224, 168, 46, 0.7); }

.symbol-open {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 11.5px;
  text-align: left;
  padding: 6px 7px 6px 2px;
  cursor: pointer;
  min-width: 0;
}
.symbol-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.symbol-meta { margin-left: auto; color: var(--text-faint); font-size: 10.5px; font-family: var(--mono); }

/* ───── Журнал ───── */

.log-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.log-table th, .log-table td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 12px; }
.log-table th { color: var(--text-faint); font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ───── Большое окно графика ───── */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(2px); }

.modal-body {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(121, 92, 235, 0.35);
  border-radius: 10px;
  width: min(1240px, 95vw);
  max-height: 93vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(121, 92, 235, 0.18), 0 24px 70px rgba(0, 0, 0, 0.7);
}

.modal-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 14px; letter-spacing: 0.3px; }

.modal-gain { font-size: 14px; font-weight: 700; color: var(--up); font-family: var(--mono); }
.modal-tip { margin-left: auto; color: var(--text-faint); font-size: 11px; }

.card-gain.is-manual, .modal-gain.is-manual { color: var(--fib); }
.card-gain.is-manual::after, .modal-gain.is-manual::after {
  content: '*';
  font-size: 0.8em;
  vertical-align: super;
}

.modal-chart { height: min(540px, 60vh); position: relative; overflow: hidden; }

.modal-meta {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  overflow-y: auto;
}
.modal-meta b { color: var(--text); font-weight: 600; font-family: var(--mono); }

/* ───── План сделки ───── */

.plan { width: 100%; margin-top: 2px; }

.plan-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 7px; }

.plan-table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.plan-table th {
  text-align: left;
  font-weight: 500;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-faint);
  padding: 2px 16px 2px 0;
}
.plan-table td { padding: 2px 16px 2px 0; font-size: 12px; }
.plan-table .is-fib { color: var(--fib-bright); font-family: var(--mono); }
.plan-table b { font-family: var(--mono); }

.plan-history { margin-top: 6px; font-size: 11.5px; }

/* ───── Разметка Фибоначчи поверх графика ───── */

.fib-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 2; }

.fib-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  cursor: grab;
  z-index: 3;
  touch-action: none;
  transition: transform 0.1s;
}
.fib-handle:hover { transform: scale(1.3); }
.fib-handle.is-dragging { cursor: grabbing; transform: scale(1.4); }
.fib-handle-low { background: #2fd4bd; box-shadow: 0 0 12px rgba(47, 212, 189, 0.8); }
.fib-handle-high { background: #ff6b86; box-shadow: 0 0 12px rgba(255, 107, 134, 0.8); }

/* ───── Адаптив ───── */

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: 380px; }
}

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  /* ───── Шапка: логотип в строку, остальное — отдельной полосой ───── */
  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }
  .brand { flex: 1 1 auto; }
  .brand-mark { font-size: 14px; }
  .brand-sub { display: none; }

  .status {
    order: 3;
    flex: 1 1 100%;
    margin-left: 0;
    font-size: 11px;
  }

  .account {
    order: 2;
    flex-wrap: wrap;
    gap: 6px;
  }
  .account-email { display: none; }
  .account .btn, #scan-now { padding: 6px 10px; font-size: 11.5px; }
  .access-badge { font-size: 9px; padding: 3px 7px; }

  /* ───── Параметры: две колонки вместо строки ───── */
  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 12px;
  }
  .control input[type="number"], .control select { width: 100%; }
  .control label { font-size: 9.5px; }
  .hint { font-size: 9.5px; }

  .control-actions {
    grid-column: 1 / -1;
    margin-left: 0;
    justify-content: space-between;
  }
  .control-actions .btn { flex: 1; }

  /* ───── Остальное ───── */
  .layout { padding: 10px 12px 28px; gap: 10px; }
  .card-chart { height: 260px; }
  .locked-chart { height: 260px; }

  .stage-filters { gap: 4px; }
  .stage-chip { padding: 6px 10px; font-size: 11px; }

  .toolbar { gap: 8px; }
  .toolbar input[type="search"] { flex: 1; min-width: 0; width: auto; }
  .toolbar select { flex: 1; min-width: 0; }
  .toolbar-note { flex-basis: 100%; }

  .tabs { padding: 0 12px; }
  .demo-banner { padding: 8px 12px; gap: 8px; }
  .demo-banner-text { font-size: 11.5px; }
  .demo-banner .btn { margin-left: 0; flex: 1 1 100%; }

  /* Полоса срока: на узком экране текст в две строки, шкала во всю ширину. */
  .access-bar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .access-bar-body { flex: 1 1 auto; flex-direction: column; align-items: flex-start; gap: 1px; }
  .access-bar-title { font-size: 12px; white-space: normal; }
  .access-bar-sub { font-size: 10.5px; }
  .access-bar-track { order: 3; width: 100%; }
  .access-bar-cta { margin-left: 0; padding: 6px 10px; font-size: 11.5px; }

  /* Карточка: заголовок не должен ломаться на части */
  .card-head { flex-wrap: wrap; gap: 5px 7px; }
  .card-price { font-size: 11.5px; }
  .card-threshold { display: none; }

  .card-strategy { flex-wrap: wrap; gap: 5px 8px; }
  .stage-next { margin-left: 0; flex-basis: 100%; text-align: left; }

  .chart-metrics { font-size: 9px; gap: 0 6px; }

  /* Окно графика во весь экран */
  .modal-body { width: 100%; max-height: 100vh; border-radius: 0; }
  .modal-head { flex-wrap: wrap; gap: 6px; }
  .modal-tip { display: none; }
  .modal-chart { height: 46vh; }
  .modal-meta { font-size: 11px; gap: 8px 12px; }
  .plan-table { font-size: 11px; }
  .plan-table th:nth-child(5), .plan-table td:nth-child(5),
  .plan-table th:nth-child(6), .plan-table td:nth-child(6) { display: none; }

  /* Окно доступа */
  .access-body { width: 100%; max-height: 100vh; border-radius: 0; }
  .access-row { flex-direction: column; align-items: stretch; }
  .access-row .btn { width: 100%; }
}

/* ───── Аккаунт в шапке ───── */

.account { display: flex; align-items: center; gap: 8px; }
.account [hidden] { display: none; }

.account-email { font-size: 11.5px; color: var(--text-dim); }

.access-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.access-badge.is-full { background: rgba(38, 166, 154, 0.16); color: #5eead4; }
.access-badge.is-demo { background: var(--accent-soft); color: #c4b5fd; }

/* ───── Полоса демонстрационного режима ───── */

.demo-banner[hidden] { display: none; }

.demo-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  border-bottom: 1px solid var(--border);
}
.demo-banner-text { font-size: 12.5px; color: #c4b5fd; }
.demo-banner .btn { margin-left: auto; }

/* ───── Полоса срока доступа ───── */

.access-bar[hidden] { display: none; }

.access-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  background: linear-gradient(90deg, rgba(38, 166, 154, 0.14), transparent 70%);
  border-bottom: 1px solid var(--border);
}

/* Точка слева повторяет цвет состояния — видно боковым зрением. */
.access-bar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2fd4bd;
  box-shadow: 0 0 10px rgba(47, 212, 189, 0.8);
  flex: none;
}

.access-bar-body { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.access-bar-title { font-size: 12.5px; font-weight: 600; color: #5eead4; white-space: nowrap; }
.access-bar-sub { font-size: 11.5px; color: var(--text-dim); }

/* Полоска остатка: сколько дней из оплаченного срока ещё не вышло. */
.access-bar-track {
  width: 160px;
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex: none;
}
.access-bar-track[hidden] { display: none; }
.access-bar-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: #2fd4bd;
  box-shadow: 0 0 10px rgba(47, 212, 189, 0.7);
  transition: width 0.4s ease;
}

.access-bar-cta { margin-left: auto; }
.access-bar-cta[hidden] { display: none; }

/* Срок на исходе — полоса желтеет, под конец краснеет. */
.access-bar.is-soon { background: linear-gradient(90deg, rgba(224, 168, 46, 0.14), transparent 70%); }
.access-bar.is-soon .access-bar-dot { background: #e0a82e; box-shadow: 0 0 10px rgba(224, 168, 46, 0.8); }
.access-bar.is-soon .access-bar-title { color: #f0c674; }
.access-bar.is-soon .access-bar-fill { background: #e0a82e; box-shadow: 0 0 10px rgba(224, 168, 46, 0.7); }

.access-bar.is-last { background: linear-gradient(90deg, rgba(255, 107, 134, 0.16), transparent 70%); }
.access-bar.is-last .access-bar-dot { background: #ff6b86; box-shadow: 0 0 10px rgba(255, 107, 134, 0.85); }
.access-bar.is-last .access-bar-title { color: #ff92a6; }
.access-bar.is-last .access-bar-fill { background: #ff6b86; box-shadow: 0 0 10px rgba(255, 107, 134, 0.7); }

/* ───── Окно открытия доступа ───── */

.access-body { width: min(620px, 94vw); }

.access-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.access-block h3 {
  margin: 0 0 7px;
  font-size: 12.5px;
  font-weight: 600;
}
.access-block p { margin: 0 0 10px; font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.access-block a { color: #a78bfa; }

.access-row { display: flex; gap: 7px; flex-wrap: wrap; }
.access-row input { flex: 1; min-width: 160px; }
.access-row select { min-width: 150px; }

.access-status { margin: 8px 0 0; font-size: 11.5px; color: #c4b5fd; min-height: 16px; }

.wallets { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.wallet[hidden] { display: none; }

.wallet {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.wallet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.wallet-network { font-size: 11px; color: var(--text-dim); }
.wallet-copy { margin-left: auto; padding: 3px 8px; font-size: 10.5px; }
.wallet-address {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
}

.payment-list { margin-top: 14px; }
.payment-list h4 {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  font-weight: 600;
}

.payment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
}
.payment-item code { font-family: var(--mono); font-size: 11px; }
.payment-network { text-transform: uppercase; font-size: 10px; letter-spacing: 0.4px; }
.payment-status { font-weight: 600; }
.payment-status.is-pending { color: var(--fib); }
.payment-status.is-approved { color: var(--up); }
.payment-status.is-rejected { color: var(--down); }
.payment-date { margin-left: auto; color: var(--text-faint); }
.payment-note { flex-basis: 100%; color: var(--text-faint); font-size: 11px; }

/* ───── Закрытые карточки ───── */

.card-locked { position: relative; user-select: none; }

.card-locked .is-hidden {
  color: var(--text-faint);
  filter: blur(3px);
}

.locked-chart {
  height: 330px;
  filter: blur(7px);
  opacity: 0.4;
  padding: 16px 10px;
}
.locked-chart svg { width: 100%; height: 100%; }
.locked-chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.locked-overlay {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(1px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(10, 10, 15, 0.55);
}
.locked-icon { font-size: 22px; opacity: 0.75; }

@media (max-width: 720px) {
  .locked-chart { height: 260px; }
  .account-email { display: none; }
  .demo-banner { flex-wrap: wrap; }
}

/* ───── Админка ───── */

.admin { padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 26px; }

.admin-section h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.admin-warning {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(224, 168, 46, 0.1);
  border: 1px solid rgba(224, 168, 46, 0.3);
  color: #f0d08a;
  font-size: 12px;
  line-height: 1.5;
}
.admin-warning code { font-family: var(--mono); color: var(--text); }

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  margin-bottom: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
}
.admin-card-row b { color: var(--text); }
.admin-note { flex: 1; min-width: 160px; }

.admin-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.admin-actions .btn { padding: 3px 8px; font-size: 10.5px; }

/* ───── Линейка по графику ───── */

.measure-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.measure-canvas.is-active { pointer-events: auto; cursor: crosshair; }

.modal-chart.is-measuring .fib-handle { pointer-events: none; opacity: 0.4; }

#measure-toggle.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ───── Расчёт ордеров ───── */

.order-coins { color: #5eead4; }

.order-warn {
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 50%;
  background: rgba(224, 168, 46, 0.2);
  color: var(--star);
  font-size: 10px;
  font-weight: 700;
}

.plan-table tr.is-problem td { opacity: 0.55; }
.order-problem { color: var(--star); font-size: 11px; }

.plan-totals {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.plan-totals b { color: var(--text); font-family: var(--mono); }

/* ───── Шаги оплаты ───── */

.pay-steps {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pay-steps li { display: flex; gap: 10px; }
.pay-steps li[hidden] { display: none; }

.pay-step-num {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(121, 92, 235, 0.4);
  color: #d6c9ff;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
}

.pay-step-body { flex: 1; min-width: 0; }
.pay-step-body p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }

.invoice-amount {
  font-family: var(--mono);
  font-size: 17px;
  color: #d4c6ff;
  text-shadow: 0 0 14px rgba(167, 139, 250, 0.5);
}

.pay-note {
  font-size: 11.5px;
  color: var(--text-faint);
  background: rgba(224, 168, 46, 0.07);
  border-left: 2px solid rgba(224, 168, 46, 0.5);
  padding: 7px 10px;
  border-radius: 0 6px 6px 0;
}
.pay-note b { color: var(--text); }

/* Запасной путь: ручная проверка по хешу — свёрнут, чтобы не отвлекать. */
.pay-fallback { margin-top: 10px; }
.pay-fallback summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 4px 0;
  width: fit-content;
  transition: color 0.15s;
}
.pay-fallback summary:hover { color: var(--text-dim); }
.pay-fallback[open] summary { color: var(--text-dim); margin-bottom: 8px; }
.pay-fallback .access-row { margin-top: 8px; }

.admin-hint { margin: -4px 0 12px; font-size: 12px; color: var(--text-dim); line-height: 1.5; max-width: 640px; }
.awaiting-amount { font-family: var(--mono); color: #d4c6ff; }
