@font-face {
  font-family: Manrope;
  src: url("/fonts/manrope-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Manrope;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-cyrillic.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0c0f0e;
  --bg-2: #141916;
  --card: rgba(20, 25, 22, 0.92);
  --line: rgba(228, 210, 168, 0.14);
  --text: #f4f0e4;
  --muted: #a49c8c;
  --gold: #e4b75a;
  --gold-2: #f3d48a;
  --profit: #b6e37a;
  --loss: #ff7a68;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --font: Manrope, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(228, 183, 90, 0.16), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(182, 227, 122, 0.07), transparent 46%),
    var(--bg);
}
button, input { font: inherit; color: inherit; }
::selection { background: rgba(228, 183, 90, 0.28); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 26px 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(28, 34, 30, 0.96), rgba(16, 20, 18, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.candles { display: flex; gap: 7px; height: 28px; align-items: flex-end; }
.candles span {
  width: 7px;
  border-radius: 3px;
  background: var(--gold);
  display: block;
}
.candles span:nth-child(1) { height: 14px; background: var(--loss); }
.candles span:nth-child(2) { height: 26px; }
.candles span:nth-child(3) { height: 18px; background: var(--profit); }
.eyebrow {
  margin: 0;
  color: var(--gold-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
}
h1 { margin: 0; font-size: 32px; letter-spacing: -0.04em; line-height: 1.05; }
.lede, .fine, .note, .hint, .reason, .meta { color: var(--muted); }
.lede { margin: 0 0 6px; line-height: 1.45; }
.fine { margin: 4px 0 0; font-size: 12px; line-height: 1.45; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0e1210;
  outline: none;
}
input:focus { border-color: rgba(228, 183, 90, 0.7); }
button[type="submit"], .toggle button, #logout {
  border: 0;
  cursor: pointer;
}
button[type="submit"] {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--gold);
  color: #231b0c;
  font-weight: 700;
}
button[type="submit"]:disabled { opacity: 0.65; cursor: progress; }
.msg { min-height: 1.2em; margin: 0; font-size: 14px; }
.msg.bad { color: var(--loss); }

.dash {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 22px;
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    linear-gradient(#e4b75a, #e4b75a) center 12px / 4px 18px no-repeat,
    linear-gradient(#b6e37a, #b6e37a) 28px 16px / 4px 12px no-repeat,
    linear-gradient(#ff7a68, #ff7a68) 10px 18px / 4px 10px no-repeat,
    #1a211c;
  border: 1px solid var(--line);
}
.top h1 { font-size: 34px; }
.top h1 span { color: var(--gold-2); font-weight: 600; }
.top-side { display: flex; align-items: center; gap: 12px; }
.stamps { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.updated { margin: 0; color: var(--muted); font-size: 13px; }
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 0 16px;
  padding-bottom: 2px;
}
.tabs button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] {
  background: rgba(228, 183, 90, 0.16);
  color: var(--gold-2);
  border-color: rgba(228, 183, 90, 0.45);
}
#logout {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
}
.banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(228, 183, 90, 0.08);
  border: 1px solid rgba(228, 183, 90, 0.25);
  color: var(--gold-2);
  font-size: 14px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
.kpi { padding: 14px 14px 12px; min-width: 0; }
.kpi .label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kpi .value {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.04em;
  line-height: 1.15;
}
.kpi .hint { margin: 6px 0 0; font-size: 12px; }
.pos { color: var(--profit); }
.neg { color: var(--loss); }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}
.card { padding: 16px 16px 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.note { margin: 6px 0 0; font-size: 13px; line-height: 1.4; }
.split { align-items: center; }
.toggle { display: flex; padding: 3px; border-radius: 999px; background: #0e1210; border: 1px solid var(--line); }
.toggle button {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
}
.toggle button[aria-pressed="true"] { background: rgba(228, 183, 90, 0.16); color: var(--gold-2); }
.chart-box { position: relative; height: 340px; margin-top: 8px; }
.chart-box.short { height: 210px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.empty { margin: 24px 0; color: var(--muted); }
.side { display: flex; flex-direction: column; gap: 16px; }
.positions { display: flex; flex-direction: column; gap: 12px; }
.position {
  padding: 12px;
  border-radius: 14px;
  background: #101512;
  border: 1px solid var(--line);
}
.position-head, .position-grid { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ticker { font-size: 20px; letter-spacing: -0.03em; }
.meta, .reason { margin: 6px 0 0; font-size: 13px; }
.position-grid { margin-top: 10px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.position-grid .k { color: var(--muted); font-size: 12px; }
.position-grid .v { font-family: var(--mono); text-align: right; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pill.bot { color: var(--gold-2); border-color: rgba(228, 183, 90, 0.45); background: rgba(228, 183, 90, 0.08); }
.table-card { padding-bottom: 6px; }
.table-scroll { overflow-x: auto; }
.trades { width: 100%; border-collapse: collapse; min-width: 860px; }
.trades th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 8px;
}
.trades td {
  padding: 12px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}
.trades .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.trades .ticker { font-weight: 700; }
.rule { display: flex; flex-direction: column; gap: 3px; min-width: 140px; }
.rule-code { font-family: var(--mono); color: var(--gold-2); }
.fees { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.pnl { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pnl span { font-size: 12px; }
.empty-row { text-align: center; color: var(--muted); }
.panel-gap { display: flex; flex-direction: column; gap: 16px; }
[data-panel] { display: flex; flex-direction: column; gap: 16px; }
.hero, .two {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 16px;
}
.hero h2, .strategy-id {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}
.desc { margin: 10px 0 0; line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--gold-2);
}
.pair { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }
.pair + .pair { border-top: 1px solid var(--line); }
.pair .k { color: var(--muted); font-size: 12px; }
.pair .v { font-family: var(--mono); font-size: 18px; }
.stats { width: 100%; border-collapse: collapse; min-width: 640px; }
.stats th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 8px;
}
.stats td {
  padding: 11px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}
.stats .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.timeline { display: flex; flex-direction: column; }
.tl {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 8px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.tl .when { color: var(--muted); font-size: 13px; }
.flows { display: flex; flex-direction: column; }
.flow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.flow span:last-child { font-family: var(--mono); }

@media (max-width: 900px) {
  .layout, .hero, .two { grid-template-columns: 1fr; }
  .dash { width: min(100% - 24px, 1180px); }
  .top { align-items: flex-start; flex-direction: column; }
  .stamps { align-items: flex-start; }
  .top h1, h1 { font-size: 28px; }
  .chart-box { height: 260px; }
  .tl { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 18px; }
  .trades { min-width: 0; }
  .trades thead { display: none; }
  .trades tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 14px 2px;
    border-top: 1px solid var(--line);
  }
  .trades td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 0;
    padding: 0;
    text-align: left;
  }
  .trades td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .trades .num, .pnl { text-align: left; align-items: flex-start; font-family: var(--mono); }
  .trades td:nth-child(1),
  .trades td:nth-child(3),
  .trades td:nth-child(4),
  .trades td:nth-child(9) { grid-column: 1 / -1; }
  .empty-row { display: block; }
}

/* Native overview charts do not depend on the optional Chart.js bundle. */
.chart-box svg[data-chart] { display: block; width: 100%; height: 100%; overflow: visible; }
