:root {
  --bg: #070b10;
  --panel: #101820;
  --panel-2: #0c131a;
  --line: #1e2a36;
  --text: #e8eef4;
  --muted: #8aa0b5;
  --green: #3dd68c;
  --red: #ff6b6b;
  --blue: #4da3ff;
  --accent: #f5c542;
  --ghost: #1a2430;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #121b24, #0b1117);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: #143d2a; color: var(--green); font-weight: 800;
}
h1 { margin: 0; font-size: 20px; letter-spacing: .04em; }
.subtitle, .muted, .hint { color: var(--muted); }
.top-status { display: flex; gap: 12px; align-items: center; font-size: 14px; }
a.logout { font-size: 13px; padding: 6px 12px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #666; display: inline-block;
}
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: #667; }
.pill {
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #b7c7d6;
}
.panel h3 {
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #b7c7d6;
}
.password-form { margin-top: 4px; }
.password-fields > label:first-child { grid-column: 1 / -1; }
.form-msg {
  font-size: 13px;
  margin: 12px 0 0;
  border-radius: 8px;
  padding: 10px 12px;
}
.form-msg.ok {
  background: #142a1c;
  border: 1px solid #245c3a;
  color: var(--green);
}
.form-msg.err {
  background: #2a1414;
  border: 1px solid #6b2a2a;
  color: var(--red);
}
.grid-2, .grid-3 {
  display: grid;
  gap: 12px 16px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
input, select, button, .button {
  font: inherit;
  color: var(--text);
}
input, select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
button, .button {
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.primary { background: #1f6feb; }
button.accent { background: #0f7b4a; }
button.ghost, a.button.ghost { background: var(--ghost); border: 1px solid var(--line); }
button:disabled {
  opacity: .38;
  filter: grayscale(0.55);
  cursor: not-allowed;
  box-shadow: none;
}
.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.cards article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.cards span { color: var(--muted); font-size: 11px; display: block; }
.cards strong { font-size: 18px; }
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.kpi-row div, .muted-grid div, .spot-row div {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.kpi-row span { color: var(--muted); font-size: 11px; display: block; }
.status-line { font-weight: 700; margin: 8px 0 4px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; }
.empty { color: var(--muted); text-align: center; }
.profit { color: var(--green); }
.loss { color: var(--red); }
.manual { color: #c79bff; }
.log {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  background: #070d13;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 22px 20px;
  color: var(--muted);
  font-size: 12px;
}
.spot-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #1a2734;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 20;
}
@media (max-width: 1100px) {
  .cards, .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3, .spot-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, #143d2a55, transparent 60%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px 24px;
  box-shadow: 0 16px 40px #0006;
}
.login-brand { margin-bottom: 22px; }
.login-form { display: grid; gap: 14px; }
.login-submit { width: 100%; margin-top: 6px; }
.login-error {
  background: #2a1414;
  border: 1px solid #6b2a2a;
  color: var(--red);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 0 0 16px;
}
@media (max-width: 700px) {
  .grid-2, .cards, .kpi-row, .grid-3, .spot-row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
}
