/* Titaib — Dark, high-contrast, Revert-inspired
   Dark theme with maximum contrast, monospace-first, subdued green accents
   All class names preserved
*/

:root {
  /* Dark theme — глубокий, но контрастный */
  --bg: #0a0a0f;
  --bg-soft: #14141e;

  --panel: #1a1a2e;
  --panel-2: #22223a;
  --panel-3: #2a2a46;

  --line: #2a2a46;
  --line-strong: #3d3d66;

  /* Светлый текст на тёмном фоне — максимальный контраст */
  --ink: #f0f0f5;
  --ink-soft: #d4d4e0;
  --ink-dim: #8888aa;
  --ink-muted: #666688;

  /* Приглушённый зелёный — контрастный, но не кричащий */
  --accent: #22b455;
  --accent-hover: #2ecc71;
  --accent-soft: rgba(34, 180, 85, 0.08);
  --accent-glow: rgba(34, 180, 85, 0.12);

  /* Дополнительные акценты */
  --accent-2: #1a9c4a;
  --ok: #22b455;
  --ok-glow: rgba(34, 180, 85, 0.15);
  --warn: #fbbf24;
  --bad: #f87171;

  --ok-bg: rgba(34, 180, 85, 0.06);
  --warn-bg: rgba(251, 191, 36, 0.06);
  --bad-bg: rgba(248, 113, 113, 0.06);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  /* Моноширинный как основной — фишка Revert */
  --mono: "Berkeley Mono", "Regio Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.002em;
  background: var(--bg);
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.wrap {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 100px;
}

/* ── Header — тёмный, минималистичный ──────────────────────────────────── */
header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  padding: 28px 280px 24px;
  margin-bottom: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

header::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -100px;
  width: 400px;
  height: 150px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(34, 180, 85, 0.04), transparent 70%);
  pointer-events: none;
}

.brand-block {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 18px;
  width: min(300px, calc(100% - 36px));
}

.logo {
  z-index: 1;
  text-align: left;
  font-weight: 700;
  letter-spacing: 0;
  font-size: 18px;
  line-height: 1.2;
  color: var(--ink);
  font-family: var(--mono);
}

.logo span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--ink-dim);
}

.tagline {
  max-width: 300px;
  margin: 6px 0 0;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
}

.timeframe-switcher {
  position: relative;
  z-index: 4;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}

.timeframe-btn {
  min-width: 72px;
  min-height: 40px;
  padding: 8px 18px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
}

.timeframe-btn:hover {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.timeframe-btn.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 16px rgba(34, 180, 85, 0.15);
}

.global-engine-control {
  position: relative;
  z-index: 5;
  display: grid;
  gap: 8px;
  justify-items: center;
  width: min(500px, 100%);
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 11px;
}

.global-engine-control[hidden] {
  display: none;
}

.global-engine-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 10, 15, 0.38);
}

.global-engine-toggle {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 32px;
  max-width: 180px;
  padding: 5px 9px;
  margin: 0;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.global-engine-toggle.is-empty {
  border-color: var(--line);
  color: var(--ink);
}

.global-engine-toggle input,
.global-engine-control select,
.global-engine-control button {
  position: relative;
  z-index: 2;
}

.global-engine-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.global-engine-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.global-engine-control select {
  flex: 0 1 205px;
  min-width: 150px;
  max-width: 205px;
  min-height: 32px;
  padding: 5px 28px 5px 11px;
  font-size: 11px;
  border-radius: 999px;
}

.global-engine-control select[data-action] {
  cursor: pointer;
}

.global-engine-row .b-mini {
  min-width: 34px;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
}

.global-engine-editor {
  width: min(520px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  box-shadow: var(--shadow-md);
}

.global-engine-editor input,
.global-engine-editor textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
}

.global-engine-editor textarea {
  min-height: 220px;
  margin-top: 8px;
  resize: vertical;
}

.global-engine-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.who {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-dim);
  font-size: 12px;
  font-family: var(--mono);
}

.who button {
  margin-left: 0;
}

/* ── Кнопки — приглушённый зелёный ────────────────────────────────────── */
button {
  width: auto;
  min-height: 42px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  padding: 10px 24px;
  cursor: pointer;
  background: var(--accent);
  box-shadow: 0 2px 16px rgba(34, 180, 85, 0.15);
  transition: all 0.15s ease;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(34, 180, 85, 0.25);
}

button:active {
  transform: translateY(0);
}

button.ghost {
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.ghost:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--panel-2);
  box-shadow: none;
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

label {
  display: block;
  margin: 0 0 6px;
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--mono);
}

input,
textarea,
select {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 16px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.15s ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-muted);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 180, 85, 0.06);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238888aa' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* ── Панели — тёмные, с лёгкой тенью ────────────────────────────────────── */
.panel {
  position: relative;
  padding: 32px 34px;
  margin-bottom: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

#strategiesPanel {
  transition: min-height 0.18s ease;
}

.panel h2 {
  margin: 0 0 24px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-family: var(--mono);
}

.row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.err {
  min-height: 18px;
  color: var(--bad);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
}

.hint {
  margin: -4px 0 16px;
  color: var(--ink-muted);
  font-size: 12px;
  font-family: var(--mono);
}

/* ── Jobs / Cards — минималистичные ────────────────────────────────────── */
.job {
  position: relative;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.job:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.job-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.job-main {
  flex: 1 1 420px;
  min-width: 0;
}

.job-actions {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.job-key {
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-soft);
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.job-key-readable {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  line-height: 1.8;
  white-space: normal;
}

.job-dot {
  color: var(--ink-muted);
}

.job-param-set-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(420px, 100%);
  min-height: 22px;
  padding: 2px 8px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.job-param-set-pill span {
  flex: 0 0 auto;
  color: var(--ink-dim);
  font-weight: 700;
}

.coin-mini-list {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  vertical-align: middle;
}

.coin-mini {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.result-name-editor {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-name-editor.hidden {
  display: none;
}

.result-name-editor input {
  max-width: 520px;
  margin-bottom: 10px;
}

.job-error {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius-sm);
  background: var(--bad-bg);
}

.job-error span {
  color: var(--bad);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.job-error p {
  margin: 0;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 14px;
  border-radius: 999px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  text-transform: uppercase;
}

.b-queued {
  color: var(--ink-dim);
  background: var(--bg-soft);
  border-color: var(--line);
}

.b-running {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(34, 180, 85, 0.15);
  animation: pulse-green 1.5s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { border-color: rgba(34, 180, 85, 0.15); }
  50% { border-color: rgba(34, 180, 85, 0.35); }
}

.b-done {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(34, 180, 85, 0.15);
}

.b-failed {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: rgba(248, 113, 113, 0.15);
}

.progress {
  margin-top: 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.verdict {
  margin-top: 12px;
  padding: 14px 16px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.v-APPROVED {
  border-left: 3px solid var(--ok);
  background: var(--ok-bg);
}

.v-BORDERLINE {
  border-left: 3px solid var(--warn);
  background: var(--warn-bg);
}

.v-REJECTED,
.v-NO_PROFITABLE_PARAMS {
  border-left: 3px solid var(--bad);
  background: var(--bad-bg);
}

.verdict.v-NO_PROFITABLE_PARAMS {
  border-left: 3px solid var(--bad);
}

.empty {
  padding: 48px;
  color: var(--ink-muted);
  text-align: center;
  font-size: 13px;
  font-family: var(--mono);
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
}

.spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spin {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── Detail Tables ──────────────────────────────────────────────────────── */
.ptable {
  width: 100%;
  margin: 10px 0;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}

.lazy-params-body {
  padding: 0 14px 12px;
}

.ptable td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.ptable tr:last-child td {
  border-bottom: 0;
}

.p-key {
  width: 1%;
  color: var(--ink-dim);
  white-space: nowrap;
}

.p-val {
  color: var(--ink-soft);
}

.p-val .ptable {
  margin: 0;
}

.p-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.p-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.p-empty {
  color: var(--ink-dim);
}

.pset {
  padding: 14px 18px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.pset-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pset-name {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.favorite-param-name-row {
  margin-top: 10px;
  max-width: 520px;
}

.favorite-param-name-row label {
  margin-bottom: 5px;
}

.favorite-param-name-input {
  margin-bottom: 4px;
}

.ps-coins {
  margin-top: 6px;
  color: var(--ink-dim);
  font-size: 12px;
  font-family: var(--mono);
}

.ps-rationale {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-style: italic;
  font-family: var(--mono);
}

.favorite-param-list {
  max-height: min(62vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.badge.b-mini {
  min-height: 20px;
  padding: 2px 10px;
  font-size: 9px;
}

.b-mini.v-APPROVED {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(34, 180, 85, 0.12);
}

.b-mini.v-BORDERLINE {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: rgba(251, 191, 36, 0.12);
}

.b-mini.v-REJECTED {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: rgba(248, 113, 113, 0.12);
}

/* ── Collapsible Sections ──────────────────────────────────────────────── */
.sec {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  overflow: hidden;
}

.sec > summary {
  cursor: pointer;
  padding: 14px 18px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
  user-select: none;
  font-family: var(--mono);
  transition: all 0.15s ease;
}

.sec > summary:hover {
  color: var(--ink);
  background: var(--bg-soft);
}

.sec > summary::-webkit-details-marker {
  display: none;
}

.sec > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 10px;
  color: var(--ink-dim);
}

.sec[open] > summary::before {
  content: "▾";
  color: var(--accent);
}

.sec > *:not(summary) {
  padding: 0 18px 18px;
}

/* ── My Strategies ──────────────────────────────────────────────────────── */
.strat-bulk {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.strat-select-all,
.strat-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.strat-select-wrap {
  width: 22px;
  height: 22px;
  justify-content: center;
  flex: 0 0 auto;
}

.strat-select,
.strat-select-all-input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.strat-selected-count {
  color: var(--ink-dim);
  font-size: 11px;
  font-family: var(--mono);
}

.strat-bulk-delete {
  color: var(--bg);
  background: var(--bad);
  box-shadow: 0 2px 16px rgba(248, 113, 113, 0.14);
}

.strat-bulk-delete:hover {
  background: #fb8a8a;
  box-shadow: 0 4px 24px rgba(248, 113, 113, 0.22);
}

.strat-bulk-delete:disabled {
  background: var(--bad);
}

.strat > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.strat-name {
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}

.strat-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.strat-counts {
  margin-left: auto;
  color: var(--ink-dim);
  font-size: 11px;
  font-family: var(--mono);
  background: var(--bg-soft);
  padding: 2px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.strat-status {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.s-ready {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(34, 180, 85, 0.12);
}

.s-no_params {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: rgba(248, 113, 113, 0.12);
}

.s-queued {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(34, 180, 85, 0.12);
}

.s-running {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(34, 180, 85, 0.12);
  animation: pulse-green 1.5s ease-in-out infinite;
}

.s-failed {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: rgba(248, 113, 113, 0.12);
}

.s-draft {
  color: var(--ink-dim);
  background: var(--bg-soft);
  border-color: var(--line);
}

.strat-body {
  padding-top: 4px;
}

.strat-sub {
  margin: 18px 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
}

.b-act {
  padding: 8px 18px;
  font-size: 11px;
}

.runrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.runrow .job-key {
  font-size: 12px;
}

/* ── Editor ────────────────────────────────────────────────────────────── */
.editor {
  padding: 18px 20px;
  margin: 12px 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}

.editor-rows {
  margin: 8px 0;
}

.erow {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr) minmax(180px, 1.5fr) auto;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}

.erow-head {
  margin-bottom: 6px;
  padding-bottom: 8px;
  color: var(--ink-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}

.ekey {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
}

.echeck {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-dim);
  font-size: 11px;
  white-space: nowrap;
  font-family: var(--mono);
}

.echeck input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.erow .eval {
  margin-bottom: 0;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--panel);
}

.erow[data-grid="1"] .eval {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 180, 85, 0.05);
}

.erow-remove {
  justify-self: end;
}

.editor-combos {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 600;
}

.editor-mode {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin: 8px 0 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}

.editor-mode label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.editor-mode label:has(input:checked) {
  color: var(--bg);
  background: var(--accent);
}

.editor-mode input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.editor-json-input {
  width: 100%;
  min-height: 300px;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.editor-ui-pane.hidden,
.editor-json-pane.hidden {
  display: none;
}

.params-view-json {
  display: none;
}

.params-view:has(.params-view-json-toggle:checked) .params-view-table {
  display: none;
}

.params-view:has(.params-view-json-toggle:checked) .params-view-json {
  display: block;
}

.params-json-output {
  width: 100%;
  min-height: 260px;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  resize: vertical;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 34px;
  padding: 6px 16px;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.main-link-tab {
  text-decoration: none;
}

.tab-btn:hover {
  color: var(--ink);
  background: var(--bg-soft);
  border-color: var(--line);
  transform: none;
  box-shadow: none;
}

.tab-btn.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.tab-pane.hidden {
  display: none;
}

.main-page.hidden {
  display: none;
}

.main-tabs {
  margin-bottom: 22px;
}

.profile-summary {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  color: var(--bg);
  font-size: 26px;
  font-weight: 800;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 16px rgba(34, 180, 85, 0.15);
}

.profile-details {
  min-width: 0;
}

.profile-email {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  word-break: break-word;
}

.profile-meta {
  color: var(--ink-dim);
  font-size: 12px;
  word-break: break-word;
}

.profile-meta code {
  color: var(--ink-soft);
  font-family: var(--mono);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.profile-stat,
.instruction-block {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.profile-stat span {
  display: block;
  color: var(--ink-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-stat strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.profile-loading {
  color: var(--ink-dim);
}

.profile-token-history,
.profile-admin-token {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.profile-token-history h3,
.profile-admin-token h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 15px;
}

.token-table {
  display: grid;
  gap: 8px;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(140px, 1fr) minmax(80px, auto) minmax(90px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.token-row strong {
  text-align: right;
}

.token-positive {
  color: var(--ok);
}

.token-negative {
  color: var(--bad);
}

.admin-token-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
}

.admin-token-grid label,
.admin-token-grid input,
.admin-token-grid select {
  margin-bottom: 0;
}

.instructions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.instruction-block h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
}

.instruction-block p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.engine-input {
  width: 100%;
  box-sizing: border-box;
}

/* ── Parameter set selection ───────────────────────────────────────────── */
.strategy-code-input {
  width: 100%;
  min-height: 420px;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.editor-add-param {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0 4px;
}

.editor-add-param input {
  margin: 0;
}

.ps-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  color: var(--accent);
  font-size: 11px;
  font-family: var(--mono);
}

.ps-select input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* ── Launch panel ──────────────────────────────────────────────────────── */
.launch-item {
  padding: 12px 18px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.launch-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.launch-section {
  margin-top: 10px;
}

.launch-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.launch-mode-switch label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  margin: 0;
  padding: 7px 10px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.launch-mode-switch label:has(input:checked) {
  color: var(--bg);
  border-color: var(--accent);
  background: var(--accent);
}

.launch-mode-switch input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.launch-param-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.4fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.launch-param-sources {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.launch-param-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.launch-param-panel-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.launch-param-panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.favorite-param-search {
  width: 118px;
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

.launch-param-count {
  color: var(--ink-dim);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.launch-param-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.launch-param-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: min(52vh, 430px);
  overflow: auto;
  padding-right: 4px;
}

.fav-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.param-source-list {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  padding-right: 4px;
}

.param-source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.param-source-item:hover {
  border-color: var(--line-strong);
  background: var(--panel);
}

.param-source-main {
  min-width: 0;
}

.param-source-name {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.param-source-meta {
  margin-top: 4px;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.3;
}

.param-source-item > button {
  align-self: start;
  min-width: 74px;
  white-space: nowrap;
}

.param-source-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.launch-param,
.launch-single-param {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.launch-single-param-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.launch-period {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}

.launch-period label {
  margin: 0;
}

.launch-period input {
  margin-bottom: 0;
}

.launch-period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 14px;
}

.launch-period-presets button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 10px;
}

.coin-picker {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.coin-picked {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 28px;
}

.favorite-coin-title {
  margin: 2px 0 -2px;
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.favorite-coin-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 28px;
}

.favorite-coin-btn.active,
.coin-fav-toggle.active {
  color: var(--bg);
  border-color: var(--accent);
  background: var(--accent);
}

.coin-search {
  min-height: 34px;
}

.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  padding: 3px 5px 3px 10px;
}

.coin-chip button {
  min-height: 18px;
  padding: 0 6px;
  line-height: 1;
}

.coin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.coin-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 6px 8px;
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  border-radius: 8px;
  cursor: pointer;
}

.coin-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: inherit;
  font-size: inherit;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.coin-choice span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.coin-option[hidden] {
  display: none;
}

.coin-option:hover {
  background: var(--panel);
}

.coin-option input,
.coin-choice input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.coin-fav-toggle {
  min-width: 28px;
  min-height: 26px;
  padding: 2px 8px;
  line-height: 1;
}

.coin-empty {
  grid-column: 1 / -1;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.launch-param-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .launch-param-workspace {
    grid-template-columns: 1fr;
  }
}

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

  .param-source-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .param-source-footer {
    justify-content: flex-start;
  }
}

.b-mini {
  width: auto;
  padding: 2px 12px;
  font-size: 10px;
}

/* ── Console ────────────────────────────────────────────────────────────── */
.console-out {
  max-height: 480px;
  margin: 10px 0 0;
  padding: 14px 18px;
  overflow: auto;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

/* ── Scrollbar — тонкий, как у Revert ──────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-soft);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-dim);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) var(--bg-soft);
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .wrap {
    width: min(100% - 24px, 1160px);
    padding-top: 24px;
  }

  header {
    min-height: 120px;
    padding: 92px 20px 24px;
    border-radius: var(--radius-md);
    flex-direction: column;
    gap: 12px;
  }

  .brand-block {
    right: 18px;
    width: auto;
  }

  .who {
    position: static;
    justify-content: center;
    margin-top: 0;
    flex-wrap: wrap;
  }

  .global-engine-control {
    position: static;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    transform: none;
  }

  .global-engine-toggle span {
    white-space: normal;
  }

  .panel {
    padding: 20px;
    border-radius: var(--radius-md);
  }

  .token-row,
  .admin-token-grid {
    grid-template-columns: 1fr;
  }

  .token-row strong {
    text-align: left;
  }

  .job-top,
  .runrow,
  .launch-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .strat-counts {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 13px;
  }

  .logo {
    font-size: 16px;
  }

  .logo span {
    font-size: 11px;
  }

  .erow {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 6px 0;
  }

  .erow .eval {
    grid-column: 1 / -1;
  }

  .erow-remove {
    justify-self: start;
  }

  .editor-add-param {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
    justify-content: center;
  }

  .tab-btn,
  .b-mini,
  .b-act,
  .who button {
    width: auto;
  }
}
