/* mobile-first */
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0; padding: 0; background: #0f1115; color: #e6e6e6; font-size: 15px;
}
.topbar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; background: #161a20; border-bottom: 1px solid #262b33;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.mode { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.mode-paper { background: #12351f; color: #4ade80; }
.mode-real { background: #3a1212; color: #f87171; }
#model-selector {
  width: 100%; padding: 10px; font-size: 15px; border-radius: 8px;
  background: #0f1115; color: #e6e6e6; border: 1px solid #333;
}
main { padding: 12px; }
h2 { font-size: 18px; margin: 8px 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
.muted { color: #7a828c; }
.pos { color: #4ade80; }
.neg { color: #f87171; }

/* cards */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: block; text-decoration: none; color: inherit;
  background: #161a20; border: 1px solid #262b33; border-radius: 10px; padding: 12px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; }
.card-id { font-weight: 700; color: #9aa4b0; font-size: 13px; }
.card-title { font-size: 16px; margin: 4px 0 10px; }
.card-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.card-metrics .k { display: block; font-size: 11px; color: #7a828c; }
.card-metrics .v { display: block; font-size: 15px; font-weight: 600; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.on { background: #4ade80; }
.dot.off { background: #6b7280; }

/* metrics row */
.metrics-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.metric { background: #161a20; border: 1px solid #262b33; border-radius: 8px; padding: 8px; text-align: center; }
.metric .k { display: block; font-size: 11px; color: #7a828c; }
.metric .v { display: block; font-size: 16px; font-weight: 600; }

.model-head { display: flex; align-items: center; gap: 8px; }
.status { font-size: 13px; color: #9aa4b0; }

/* rules */
.rules { background: #161a20; border: 1px solid #262b33; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules-body { white-space: pre-wrap; font-size: 12px; color: #c0c6cf; overflow-x: auto; }

/* table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #262b33; }
th { color: #7a828c; font-weight: 600; }

/* tablet+ */
@media (min-width: 768px) {
  body { font-size: 16px; }
  .topbar { flex-direction: row; align-items: center; justify-content: space-between; }
  #model-selector { width: auto; min-width: 280px; }
  main { padding: 20px; max-width: 1100px; margin: 0 auto; }
  .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .metrics-row { grid-template-columns: repeat(6, 1fr); }
}

/* login page */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: #161a20; border: 1px solid #262b33; border-radius: 12px;
  padding: 28px 22px; width: 90%; max-width: 320px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; text-align: center; }
.login-sub { margin: 0 0 8px; text-align: center; color: #7a828c; font-size: 12px; }
.login-card input {
  padding: 12px; font-size: 16px; border-radius: 8px;
  background: #0f1115; color: #e6e6e6; border: 1px solid #333;
}
.login-card button {
  padding: 12px; font-size: 16px; font-weight: 600; border: none; border-radius: 8px;
  background: #2563eb; color: #fff; cursor: pointer;
}
.login-error { background: #3a1212; color: #f87171; padding: 8px; border-radius: 6px; font-size: 13px; text-align: center; }

/* nav right (selector + logout) */
.nav-right { display: flex; gap: 8px; align-items: center; }
.nav-right #model-selector { flex: 1; }
.logout { color: #7a828c; text-decoration: none; font-size: 13px; padding: 6px 10px; border: 1px solid #333; border-radius: 8px; white-space: nowrap; }
@media (min-width: 768px) { .nav-right { flex: none; } }

/* account bar (position size + balance) */
.account-bar { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 14px; font-size: 13px; color: #9aa4b0; }
.account-bar b { color: #e6e6e6; font-weight: 600; }
.acct-note { font-size: 12px; margin-top: -6px; }

/* equity chart */
.chart-block { background: #161a20; border: 1px solid #262b33; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.chart-head { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: #9aa4b0; margin-bottom: 8px; align-items: center; }
.chart-head b { color: #e6e6e6; }
.legend { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.lg-fixed { background: #fbbf24; }
.lg-comp { background: #22e06a; }
.equity-svg { width: 100%; height: 160px; display: block; background: #0d0f13; border-radius: 6px; }
.equity-svg .baseline { stroke: #4a5160; stroke-width: 1; stroke-dasharray: 4 4; }
.equity-svg .line-fixed { fill: none; stroke: #fbbf24; stroke-width: 2.2;
  filter: drop-shadow(0 0 2px rgba(251,191,36,0.6)); }
.equity-svg .line-comp { fill: none; stroke: #22e06a; stroke-width: 2.6;
  filter: drop-shadow(0 0 3px rgba(34,224,106,0.75)); }
.chart-axis { display: flex; justify-content: space-between; font-size: 10px; color: #7a828c; margin-top: 2px; }
