/* Панель копитрейдера — тёмная тема, без внешних зависимостей. */

:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1c232d;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4c8dff;
  --accent-dim: #1f3a66;
  --green: #3fb950;
  --red: #f85149;
  --amber: #d29922;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── шапка ─────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; margin-right: auto; }
.topbar nav a {
  color: var(--muted); padding: 6px 12px; border-radius: 6px; font-size: 14px;
}
.topbar nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.topbar nav a.active { background: var(--panel-2); color: var(--text); }
.topbar .who { color: var(--muted); font-size: 13px; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ─── карточки ──────────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.card > h2 {
  margin: 0 0 4px; font-size: 15px; font-weight: 600; letter-spacing: .2px;
}
.card > .hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.card > h2 + .grid, .card > h2 + .row, .card > h2 + table { margin-top: 16px; }

/* ─── статус-строка ─────────────────────────────────────────────── */
.statusbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; border: 1px solid transparent;
}
.pill.on   { background: rgba(63,185,80,.13); color: var(--green); border-color: rgba(63,185,80,.3); }
.pill.off  { background: var(--panel-2); color: var(--muted); border-color: var(--border); }
.pill.dry  { background: rgba(76,141,255,.13); color: var(--accent); border-color: rgba(76,141,255,.3); }
.pill.live { background: rgba(248,81,73,.13); color: var(--red); border-color: rgba(248,81,73,.35); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.on .dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ─── плитки метрик ─────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px;
}
.tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.tile .value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .value.sm { font-size: 15px; font-weight: 500; }

/* ─── формы ─────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field .note { font-size: 12px; color: var(--muted); opacity: .85; }

input[type=text], input[type=password], input[type=number], input[type=email], select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 9px 11px; font-size: 14px; font-family: inherit; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input.mono { font-family: var(--mono); font-size: 13px; }
input:disabled { opacity: .5; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

button {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 9px 16px; font-size: 14px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: background .12s, border-color .12s;
}
button:hover:not(:disabled) { background: #263040; border-color: #3a4553; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: #3d7ced; border-color: #3d7ced; }
button.danger { color: var(--red); border-color: rgba(248,81,73,.35); }
button.danger:hover:not(:disabled) { background: rgba(248,81,73,.12); }
button.sm { padding: 5px 10px; font-size: 13px; }

/* переключатель */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 40px; height: 22px; border-radius: 999px;
  background: var(--border); position: relative; transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch .text { font-size: 14px; }

/* ─── предупреждения ────────────────────────────────────────────── */
.warn {
  border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.5;
  border: 1px solid; margin-bottom: 16px;
}
.warn.red   { background: rgba(248,81,73,.09); border-color: rgba(248,81,73,.3); color: #ffb3ae; }
.warn.amber { background: rgba(210,153,34,.09); border-color: rgba(210,153,34,.3); color: #e5c07b; }
.warn.blue  { background: rgba(76,141,255,.09); border-color: rgba(76,141,255,.28); color: #a9c8ff; }
.warn b { color: inherit; }

/* ─── таблицы ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid rgba(42,50,61,.55); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.tag.buy  { background: rgba(63,185,80,.15); color: var(--green); }
.tag.sell { background: rgba(248,81,73,.15); color: var(--red); }
.tag.ok   { background: rgba(63,185,80,.15); color: var(--green); }
.tag.skip { background: var(--panel-2); color: var(--muted); }
.tag.err  { background: rgba(248,81,73,.15); color: var(--red); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 0; }

/* ─── журнал ────────────────────────────────────────────────────── */
.log {
  background: #0a0e14; border: 1px solid var(--border); border-radius: 8px;
  height: 320px; overflow-y: auto; padding: 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
}
.log .line { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; }
.log .t { color: #55606d; flex: none; }
.log .m { flex: 1; }
.log .INFO .m { color: #c9d5e1; }
.log .WARNING .m { color: var(--amber); }
.log .ERROR .m { color: var(--red); }

/* ─── вход ──────────────────────────────────────────────────────── */
.auth-wrap { max-width: 380px; margin: 9vh auto; padding: 0 20px; }
.auth-wrap .brand { font-size: 20px; text-align: center; margin-bottom: 6px; }
.auth-wrap .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.auth-wrap .card { padding: 24px; }
.auth-wrap .field { margin-bottom: 14px; }
.auth-wrap button { width: 100%; margin-top: 6px; }
.auth-wrap .alt { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

/* ─── тост ──────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 8px; font-size: 14px; max-width: 520px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(248,81,73,.5); color: #ffb3ae; }
#toast.ok  { border-color: rgba(63,185,80,.5); color: #9be0a5; }

.section-sep { height: 1px; background: var(--border); margin: 20px 0; border: 0; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 0 14px; gap: 12px; }
  .topbar .who { display: none; }
}
