:root {
  --bg: #0f1419; --panel: #1a212b; --line: #2a3441; --text: #d6dde6;
  --muted: #7c8a9a; --accent: #4a9eff; --pos: #36d399; --neg: #f87272;
  --warn: #f5c451;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px 20px;
}
.nav .brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 19px; font-weight: 700; letter-spacing: .3px; color: var(--text);
}
.nav .brand:hover { text-decoration: none; }
.nav .brand b { color: var(--accent); font-weight: 700; }
.nav-center { display: flex; justify-content: center; gap: 28px; }
.nav-center a { font-size: 16px; font-weight: 600; color: var(--text); padding: 4px 6px; }
.nav-center a:hover { color: var(--accent); text-decoration: none; }
.nav-right { justify-self: end; color: var(--muted); }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 8px 0 16px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
h3 { font-size: 14px; margin: 0 0 10px; }
.muted { color: var(--muted); }
section { margin-bottom: 8px; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inline { display: flex; align-items: center; gap: 10px; }

table.grid { width: 100%; border-collapse: collapse; margin: 6px 0 18px; }
.grid th, .grid td {
  padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left;
}
.grid thead th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.grid tfoot th { border-top: 2px solid var(--line); }
.grid tr.total-row td { border-top: 2px solid var(--line); font-weight: 600; }
.grid tr.grand-total-row td {
  font-weight: 700; font-size: 14px;
  background: rgba(74, 158, 255, 0.10);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid.kv th { width: 280px; color: var(--muted); }

/* Compact label/value summary — shrink to content so the value sits right
   after the label instead of being pushed to the far right. */
.grid.kv-sum { width: auto; }
.grid.kv-sum th { text-align: left; color: var(--muted); font-weight: 600; padding-right: 32px; }
.grid.kv-sum td { padding-left: 0; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }

.state-cell { text-align: center; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); }
.dot-green { background: var(--pos); box-shadow: 0 0 5px var(--pos); }
.dot-yellow { background: #f5c451; box-shadow: 0 0 5px #f5c451; }
.dot-red { background: var(--neg); box-shadow: 0 0 5px var(--neg); }

.coin-table { margin-bottom: 22px; }
.coin-head {
  text-align: left; font-size: 15px; font-weight: 700; color: var(--accent);
  letter-spacing: .4px; padding-top: 14px; border-bottom: none;
}

button.sm { padding: 2px 10px; font-size: 12px; }
.inline-stop { display: inline; margin: 0; }
.bias-cell { white-space: nowrap; }
.bias-cell form { display: inline; margin-left: 6px; }
.bias-cell button.sm.ghost { padding: 1px 7px; }
button:disabled { opacity: .4; cursor: not-allowed; filter: none; }

input, button, select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; font: inherit;
}
button, a.btn {
  background: var(--accent); color: #04121f; border: none; cursor: pointer;
  font-weight: 600; border-radius: 6px; padding: 6px 12px; display: inline-block;
}
a.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
button.danger { background: var(--neg); color: #1a0606; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* Wallet graph series toggle dropdown */
.series-menu { position: relative; }
.series-menu > summary {
  cursor: pointer; list-style: none; user-select: none;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
  font-weight: 600;
}
.series-menu > summary::-webkit-details-marker { display: none; }
.series-menu[open] > summary { color: var(--text); }
.series-panel {
  position: absolute; right: 0; z-index: 20; margin-top: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; min-width: 180px; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.series-panel label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; color: var(--text); white-space: nowrap;
}

/* Start-coin modal */
dialog.modal {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px; width: min(720px, 92vw);
}
dialog.modal::backdrop { background: rgba(0,0,0,.55); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 12px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; }
.form-grid input { color: var(--text); }

.cards { display: flex; gap: 16px; flex-wrap: wrap; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; width: 360px; display: flex; flex-direction: column; gap: 8px;
}
.card label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.card input { color: var(--text); }

.flash { padding: 9px 14px; border-radius: 8px; margin: 10px 0; }
.flash.success { background: #14532d; color: var(--pos); }
.flash.error { background: #4c1d1d; color: var(--neg); }
.flash.info { background: var(--panel); }

.login-box {
  max-width: 320px; margin: 12vh auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 28px; text-align: center;
}
.login-box h1 { color: var(--accent); }
.login-box form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
