:root {
  --bg:        #0e1116;
  --surface:   #161a21;
  --surface-2: #1c222b;
  --line:      #262d38;
  --text:      #e4e8ef;
  --muted:     #8b97a8;
  --accent:    #4e9cf5;
  --you:       #4e9cf5;
  --bm:        #c9a227;
  --in:        #5a6677;
  --up:        #3fbf7f;
  --down:      #e4605a;
  --radius:    10px;
}

* { box-sizing: border-box; }

/* Moet boven alles staan: zonder !important verliest het hidden-attribuut van
   elke regel die display zet, zoals .gate en .view hieronder. Dan blijft het
   inlogscherm staan en staan alle tabbladen tegelijk open. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }

code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.muted  { color: var(--muted); }
.small  { font-size: 13px; }
.error  { color: var(--down); font-size: 13px; margin: 4px 0 0; }
.r      { text-align: right; }
.pos    { color: var(--up); }
.neg    { color: var(--down); }

/* ── inloggen ── */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  gap: 12px;
}
.gate-card p { margin: 0; font-size: 13px; }

/* ── chrome ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.brand { font-weight: 600; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.tab {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { color: var(--text); background: var(--surface-2); }

main { padding: 24px; max-width: 1240px; margin: 0 auto; display: grid; gap: 20px; }
.view { display: grid; gap: 20px; }

/* ── knoppen ── */
button, .ghost {
  font: inherit;
  cursor: pointer;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 8px 14px;
  background: var(--accent);
  color: #06111f;
  font-weight: 600;
}
button:hover { filter: brightness(1.08); }
.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
}
.ghost:hover { background: var(--surface-2); filter: none; }
.ghost.small, button.small { padding: 5px 10px; font-size: 13px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 500;
}
.seg button.on { background: var(--surface-2); color: var(--text); }

/* ── kaarten ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card.accent { border-color: #2d4766; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  margin: 12px 0 0;
  max-width: 76ch;
}
.danger-zone { border-color: #3a2b2b; }

/* ── kpi's ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  gap: 3px;
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12.5px; }

/* ── meter ── */
.meter-wrap { margin-bottom: 14px; }
.meter {
  height: 9px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--up), var(--bm));
  transition: width 0.4s ease;
}
.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.stat { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.stat-label { display: block; font-size: 11.5px; color: var(--muted); }
.stat-value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── tabellen ── */
.table-scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 10px 8px 0;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line); }
table.mini { margin-top: 12px; }
.clickable { cursor: pointer; }
.sym { font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill.risico { color: var(--bm); border-color: #4a3d1a; }
.pill.holding { color: var(--accent); border-color: #2d4766; }
.x {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 15px;
}
.x:hover { color: var(--down); background: none; filter: none; }

/* ── grafieken ── */
.chart { width: 100%; height: 300px; position: relative; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 11px; }
.line-you  { fill: none; stroke: var(--you);  stroke-width: 2;   }
.line-bm   { fill: none; stroke: var(--bm);   stroke-width: 1.6; stroke-dasharray: 5 3; }
.line-in   { fill: none; stroke: var(--in);   stroke-width: 1.4; }
.line-ma50 { fill: none; stroke: var(--bm);   stroke-width: 1.4; }
.line-ma200{ fill: none; stroke: var(--in);   stroke-width: 1.4; }
.hover-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

.tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translate(-50%, -110%);
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 5;
}
.tip strong { display: block; margin-bottom: 3px; font-weight: 600; }
.tip-row { display: flex; justify-content: space-between; gap: 14px; }

.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}
.sw { display: inline-block; width: 11px; height: 3px; border-radius: 2px; vertical-align: 2px; margin-right: 5px; }
.sw-you { background: var(--you); }
.sw-bm { background: var(--bm); }
.sw-in { background: var(--in); }
.sw-ma50 { background: var(--bm); }
.sw-ma200 { background: var(--in); }

/* ── formulieren ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); }
.wide { grid-column: 1 / -1; }
input, select {
  font: inherit;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 10px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: end; }
.row-actions { display: flex; gap: 8px; }

.log {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  color: var(--muted);
}

.foot { padding: 8px 24px 32px; max-width: 1240px; margin: 0 auto; }

@media (max-width: 720px) {
  main { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .kpi-value { font-size: 21px; }
  .chart { height: 240px; }
}
