:root {
  --bg:        #0B0D10;
  --panel:     #14171C;
  --panel-alt: #1A1E24;
  --line:      #262B33;
  --text:      #E8EAED;
  --text-dim:  #8B93A1;
  --green:     #3DDC84;
  --red:       #FF5C5C;
  --amber:     #F5A623;
  --accent:    #5B8CFF;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-name { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.08em; font-size: 14px; }
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(61,220,132,0.6);
  animation: pulse 2s infinite;
}
.brand-dot.stale { background: var(--red); animation: none; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61,220,132,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(61,220,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); }
}

.label { font-size: 10px; letter-spacing: 0.08em; color: var(--text-dim); display: block; text-transform: uppercase; }
.topbar-mtm, .topbar-status { text-align: right; }
.mtm-value { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }
.mtm-value.pos { color: var(--green); }
.mtm-value.neg { color: var(--red); }
.mono { font-family: var(--font-mono); }

.grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 18px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}
#roll-panel, #activity-panel { grid-column: span 1; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
}
.panel h2 {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 14px 0;
  font-weight: 600;
}

/* accounts */
.accounts-list { display: flex; flex-direction: column; gap: 10px; }
.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-alt);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
}
.account-card.role-worker { border-left-color: var(--text-dim); }
.account-name { font-weight: 600; font-size: 13px; }
.account-role { font-size: 10px; color: var(--text-dim); letter-spacing: 0.05em; }
.account-lots { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }
.login-badge {
  font-size: 10px; padding: 3px 8px; border-radius: 20px; font-weight: 600; letter-spacing: 0.04em;
  text-decoration: none;
}
.login-badge.logged_in  { background: rgba(61,220,132,0.15); color: var(--green); }
.login-badge.logged_out { background: rgba(255,92,92,0.15); color: var(--red); cursor: pointer; }
.login-badge.error      { background: rgba(245,166,35,0.15); color: var(--amber); cursor: pointer; }

/* strategies */
.strategies-list { display: flex; flex-direction: column; gap: 14px; }
.strategy-card {
  background: var(--panel-alt);
  border-radius: 8px;
  padding: 14px 16px;
}
.strategy-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.strategy-name { font-weight: 600; font-size: 14px; }
.strategy-mtm { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }
.status-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.status-badge.active  { background: rgba(61,220,132,0.15); color: var(--green); }
.status-badge.waiting { background: rgba(245,166,35,0.15); color: var(--amber); }
.status-badge.idle    { background: rgba(139,147,161,0.15); color: var(--text-dim); }
.status-badge.failed  { background: rgba(255,92,92,0.15); color: var(--red); }

.strategy-legs { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-bottom: 10px; }

.tp-sl-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.tp-sl-row label { font-size: 10px; color: var(--text-dim); display: flex; flex-direction: column; gap: 4px; }
.tp-sl-row input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 5px; padding: 6px 8px; font-family: var(--font-mono); width: 90px;
}

.strategy-actions { display: flex; gap: 8px; }

.btn {
  border: none; border-radius: 6px; padding: 7px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; letter-spacing: 0.02em;
}
.btn-green  { background: var(--green); color: #06210F; }
.btn-red    { background: var(--red); color: #2A0A0A; }
.btn-amber  { background: var(--amber); color: #2A1A00; }
.btn-ghost  { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* roll form */
.roll-form { display: flex; flex-direction: column; gap: 12px; }
.roll-form label { font-size: 11px; color: var(--text-dim); display: flex; flex-direction: column; gap: 5px; }
.roll-form input, .roll-form select {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 5px; padding: 8px 10px; font-family: var(--font-mono); font-size: 13px;
}
.hint { font-size: 11px; color: var(--text-dim); margin-top: 10px; line-height: 1.5; }

/* activity */
.activity-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.activity-row {
  display: flex; justify-content: space-between; font-size: 11px; font-family: var(--font-mono);
  color: var(--text-dim); border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.activity-row .status-done  { color: var(--green); }
.activity-row .status-error { color: var(--red); }
.activity-row .status-pending { color: var(--amber); }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
}
