:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0; height: 100vh; display: flex; flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d1117; color: #e6edf3;
}
header {
  padding: 10px 16px; display: flex; gap: 10px; align-items: center;
  background: #161b22; border-bottom: 1px solid #30363d; position: relative; z-index: 10;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #1f2937; color: #e6edf3; border: 1px solid #30363d;
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.pill:hover { background: #2b3746; }
.pill .caret { font-size: 10px; opacity: .7; }
.pill.period { background: #1a4a82; border-color: #1a4a82; font-weight: 600; }
.pill.period:hover { background: #215ea2; }
.pill.on { background: #238636; border-color: #238636; }
.pill.on:hover { background: #2ea043; }
#status {
  margin-left: auto; font-size: 12px; padding: 4px 10px; border-radius: 12px;
  background: #30363d;
}
#status.ok { background: #238636; }
#status.err { background: #da3633; }

/* ----- Asset picker panel ----- */
.panel {
  position: absolute; top: 56px; left: 16px;
  width: 620px; max-width: calc(100vw - 32px);
  background: #0f1720; border: 1px solid #30363d; border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0,0,0,.6);
  display: none; overflow: hidden; z-index: 20;
}
.panel.open { display: flex; }
.panel .sidebar {
  width: 180px; padding: 12px; display: flex; flex-direction: column; gap: 6px;
  background: #0b1117; border-right: 1px solid #1e252e;
}
.panel .cat {
  background: #151e28; color: #cbd5e1; border: 1px solid transparent;
  border-radius: 8px; padding: 9px 12px; font-size: 13px; cursor: pointer;
  text-align: left; display: flex; align-items: center; gap: 8px;
}
.panel .cat:hover { background: #1c2734; }
.panel .cat.active { background: #1a4a82; color: #fff; }
.panel .main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.panel .search {
  padding: 12px; border-bottom: 1px solid #1e252e;
}
.panel .search input {
  width: 100%; background: #151e28; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; outline: none;
}
.panel .search input:focus { border-color: #1a4a82; }
.panel .col-head {
  display: flex; padding: 8px 14px; font-size: 11px;
  color: #94a3b8; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid #1e252e;
}
.panel .col-head .name { flex: 1; }
.panel .list {
  max-height: 420px; overflow-y: auto;
}
.panel .row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; font-size: 14px; cursor: pointer;
  border-bottom: 1px solid #141b23;
}
.panel .row:hover { background: #151e28; }
.panel .row.active { background: #1a4a82; }
.panel .row .sym { flex: 1; font-weight: 500; }
.panel .row .payout { color: #26a69a; font-weight: 600; font-size: 13px; }
.panel .row.inactive .payout { color: #64748b; }
.panel .row.inactive { opacity: .5; }

/* ----- Period picker panel ----- */
.panel.period-panel {
  width: 160px; left: auto;
}
.panel.period-panel .list { max-height: none; padding: 6px; }
.panel.period-panel .row { border-radius: 6px; border: 0; justify-content: center; padding: 10px; }

/* Scrollbar */
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
#chart { flex: 1; min-height: 0; }
#info {
  position: absolute; top: 70px; left: 24px; font-size: 12px;
  background: rgba(22,27,34,.85); padding: 6px 10px; border-radius: 6px;
  border: 1px solid #30363d; pointer-events: none;
}
.spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.spinner.active { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
