/* ── Переменные темы ─────────────────────────────────────────────────────── */
:root {
  --bg:       #0f1724;
  --card:     #162032;
  --border:   #1e3a5f;
  --accent:   #38bdf8;
  --accent2:  #22d3ee;
  --text:     #e2e8f0;
  --muted:    #94a3b8;
  --green:    #22c55e;
  --red:      #ef4444;
  --radius:   8px;
  --font:     'Segoe UI', system-ui, sans-serif;
}

/* ── Сброс и база ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font);
       font-size: 14px; min-height: 100vh; }
.hidden { display: none !important; }
.muted  { color: var(--muted); font-size: 13px; }

/* ── Шапка ───────────────────────────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.header__logo  { font-size: 18px; font-weight: 700; color: var(--accent);
                 letter-spacing: 0.5px; }
.header__status { font-size: 12px; color: var(--muted); }
.header__status.ok  { color: var(--green); }
.header__status.err { color: var(--red);   }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout  { display: flex; gap: 16px; padding: 16px; min-height: calc(100vh - 49px); }
.sidebar { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.content { flex: 1; min-width: 0; }

/* ── Карточка ────────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 16px; }
.card__title { font-size: 11px; font-weight: 600; color: var(--accent);
               text-transform: uppercase; letter-spacing: 0.6px;
               margin-bottom: 12px; }
.card__title--sub { margin-top: 14px; color: var(--muted); }

/* ── Форма ───────────────────────────────────────────────────────────────── */
.field       { display: flex; flex-direction: column; gap: 5px; }
.field-row   { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field + .field, .field-row + .field-row,
.field-row + .field, .field + .field-row { margin-top: 10px; }

.label { font-size: 11px; color: var(--muted); font-weight: 500; }

.input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 10px; font-size: 13px; font-family: var(--font);
  width: 100%; transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--accent); }
select.input { cursor: pointer; }

/* ── Тоггл (checkbox) ────────────────────────────────────────────────────── */
.field--checkbox { flex-direction: row; align-items: center;
                   justify-content: space-between; padding-top: 4px; }
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 20px; cursor: pointer; transition: .2s;
}
.toggle__slider::before {
  content: ''; position: absolute; width: 14px; height: 14px;
  left: 3px; bottom: 3px; background: var(--muted);
  border-radius: 50%; transition: .2s;
}
.toggle input:checked + .toggle__slider { background: var(--accent); }
.toggle input:checked + .toggle__slider::before
  { transform: translateX(16px); background: #fff; }

/* ── Кнопка ──────────────────────────────────────────────────────────────── */
.btn { width: 100%; padding: 10px; border: none; border-radius: 6px;
       font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s;
       margin-top: 16px; }
.btn--primary { background: var(--accent); color: #0f1724; }
.btn--primary:hover { background: var(--accent2); }
.btn--primary:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }

/* ── История ─────────────────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; cursor: pointer; transition: border-color .15s;
}
.history-item:hover { border-color: var(--accent); }
.history-item__pair  { font-size: 12px; font-weight: 600; color: var(--text); }
.history-item__meta  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.history-item__pnl   { font-size: 12px; font-weight: 700; float: right; }
.history-item__pnl.pos { color: var(--green); }
.history-item__pnl.neg { color: var(--red); }

/* ── Метрики ─────────────────────────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
           gap: 10px; margin-bottom: 12px; }
.metric { background: var(--card); border: 1px solid var(--border);
          border-radius: var(--radius); padding: 14px 16px; }
.metric__label { font-size: 11px; color: var(--muted); text-transform: uppercase;
                 letter-spacing: 0.4px; margin-bottom: 6px; }
.metric__value { font-size: 22px; font-weight: 700; color: var(--text); }
.metric__value.pos { color: var(--green); }
.metric__value.neg { color: var(--red); }

/* ── График ──────────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; height: 240px; }

/* ── Таблица ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { color: var(--muted); font-weight: 600; text-align: left;
             padding: 7px 10px; border-bottom: 1px solid var(--border);
             white-space: nowrap; }
.table td { padding: 6px 10px; border-bottom: 1px solid #1a2a40;
             white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #1a2d48; }
.pnl-pos { color: var(--green); font-weight: 600; }
.pnl-neg { color: var(--red);   font-weight: 600; }

.badge { background: var(--border); color: var(--accent); font-size: 11px;
         padding: 2px 8px; border-radius: 4px; font-weight: normal;
         text-transform: none; letter-spacing: 0; }

/* ── Плейсхолдер ─────────────────────────────────────────────────────────── */
.placeholder { display: flex; flex-direction: column; align-items: center;
               justify-content: center; height: 300px; gap: 12px; color: var(--muted); }
.placeholder__icon { font-size: 48px; }
.placeholder__text { font-size: 14px; }
.placeholder__text b { color: var(--accent); }

/* ── Лоадер ──────────────────────────────────────────────────────────────── */
.loader { display: flex; flex-direction: column; align-items: center;
          justify-content: center; height: 300px; gap: 16px; }
.loader__spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader__text { color: var(--muted); font-size: 13px; }
