:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3fb950;
  --red: #f85149;
  --link: #58a6ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 28px 0 12px; color: var(--text); }
code { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 0.85em; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-icon { width: 22px; height: 22px; color: var(--accent); }
.brand-icon svg { width: 100%; height: 100%; }
.brand-name { font-weight: 700; font-size: 1.1rem; }

.badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-testnet { color: #58a6ff; border-color: #1f4a7a; background: #0d2440; }
.badge-mainnet { color: #f0883e; border-color: #7a4a1f; background: #40240d; }
.badge-muted { color: var(--muted); }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--bg-soft); color: var(--text); }
.nav-logout { margin-top: 12px; }

main { flex: 1; padding: 24px 28px; max-width: 1100px; min-width: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

.conn { font-size: 0.75rem; padding: 3px 10px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.conn-ok { color: var(--accent); background: #12261a; border: 1px solid #1f4a2c; }
.conn-err { color: var(--red); background: #2b1214; border: 1px solid #5c2326; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.card-value { font-size: 1.6rem; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.card-sub { color: var(--muted); font-size: 0.85rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; background: var(--bg-soft); }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.sym { font-weight: 600; }

.pos { color: var(--accent); }
.neg { color: var(--red); }
.muted { color: var(--muted); }

.flash { background: #12261a; border: 1px solid #1f4a2c; color: var(--accent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--bg-soft); }
.notice.pos { border-color: #1f4a2c; background: #12261a; }
.notice.neg { border-color: #5c2326; background: #2b1214; }

.hint { color: var(--muted); font-size: 0.85rem; }
.hint-inline { color: var(--muted); font-weight: 400; font-size: 0.85em; }

.empty { border: 1px dashed var(--border); border-radius: 10px; padding: 36px; text-align: center; color: var(--muted); }
.empty p { margin: 4px 0; }

.form { max-width: 480px; display: flex; flex-direction: column; gap: 14px; }
.form h2 { margin: 14px 0 0; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 0.9rem; }
input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--link); }
button {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  margin-top: 8px;
}
button:hover { filter: brightness(1.1); }

.btn-row { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }
.btn-row form { margin: 0; }
.btn-row button { margin-top: 0; }
.btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid #5c2326; }

.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }

.log-list { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); padding: 10px 14px; font-family: ui-monospace, monospace; font-size: 0.8rem; overflow-x: auto; }
.log-line { padding: 3px 0; white-space: nowrap; }
.log-ts { color: var(--muted); margin-right: 8px; }
.log-error { color: var(--red); }
.log-warn { color: #f0883e; }

.spark-wrap { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); padding: 14px; }
.spark-wrap svg { display: block; width: 100%; height: 80px; }

/* stat-tegels */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.tile-label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tile-value { font-size: 1.75rem; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile-sub { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

/* positiekaart */
.pos-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-top: 12px; }
.pos-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pos-symbol, .pick-symbol { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; }
.side-badge {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 6px;
}
.side-long { color: #0d1117; background: var(--accent); }
.side-short { color: #fff; background: var(--red); }
.chip {
  font-size: 0.75rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px 10px; font-variant-numeric: tabular-nums;
}
.chip-pos { color: var(--accent); border-color: #1f4a2c; }
.chip-neg { color: var(--red); border-color: #5c2326; }
.chip-dim { color: var(--muted); }
.pos-prices { display: flex; gap: 28px; margin: 14px 0 12px; flex-wrap: wrap; }
.pos-prices > div { display: flex; flex-direction: column; gap: 2px; }
.pos-prices span { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.pos-prices strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.liq-meter { height: 6px; border-radius: 3px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.liq-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.liq-fill.ok { background: var(--accent); }
.liq-fill.warn { background: #f0883e; }
.liq-fill.danger { background: var(--red); }
.liq-label { color: var(--muted); font-size: 0.78rem; margin-top: 6px; }

/* pijplijn */
.pipeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.stage { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.stage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stage-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stage-title { font-weight: 600; color: var(--text); }
.stage-time { margin-left: auto; color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.stage-summary { margin: 0; color: var(--text); font-size: 0.88rem; line-height: 1.55; overflow-wrap: anywhere; }
.pick-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.alt-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.8rem; }
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.reasons li { font-size: 0.84rem; line-height: 1.45; padding-left: 18px; position: relative; overflow-wrap: anywhere; }
.reason-pro::before { content: "+"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.reason-con::before { content: "\2212"; position: absolute; left: 2px; color: var(--red); font-weight: 700; }

@media (max-width: 980px) {
  .pipeline { grid-template-columns: 1fr; }
}

.report-list { display: flex; flex-direction: column; gap: 8px; }
.report { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.report-time { color: var(--muted); font-size: 0.75rem; margin-bottom: 4px; }
.report-text { font-size: 0.88rem; line-height: 1.5; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-brand { justify-content: center; margin-bottom: 8px; }
.login-card button { align-self: stretch; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 10px;
  }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .sidebar nav a span { display: none; }
  .sidebar nav a { padding: 8px; }
  .nav-logout { margin-top: 0; }
  .brand-name { display: none; }
  main { padding: 16px; }
}
