:root {
  --bg: #0b0e14;
  --panel: #141821;
  --panel-2: #1b2030;
  --border: #252b3b;
  --text: #d8dee9;
  --muted: #8a93a8;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, .12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, .12);
  --grey: #8a93a8;
  --grey-bg: rgba(138, 147, 168, .14);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, .12);
  --blue: #3b82f6;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 16px; }
h2 { font-size: 14px; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.sub { margin: 0; color: var(--muted); font-size: 12px; }
.logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex: none; }
.logo-dot.ok { background: var(--green); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
.logo-dot.err { background: var(--red); }
.logo-dot.busy { background: var(--amber); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: var(--radius); border: 1px solid var(--border); }
.tab { background: none; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 6px; cursor: pointer; font: inherit; }
.tab.active { background: var(--panel-2); color: var(--text); }
.actions { display: flex; gap: 8px; }

.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 6px; cursor: pointer; font: inherit; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #3a4256; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.order { background: var(--green-bg); border-color: rgba(34,197,94,.35); color: var(--green); text-decoration: none; padding: 5px 10px; font-size: 13px; display: inline-block; }
.btn.order.off { background: transparent; border-color: var(--border); color: var(--muted); }

main { padding: 16px 20px; flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.15; }
.stat-value.small { font-size: 16px; }
.stat-value.mono { font-family: var(--mono); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-hint { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 3px; background: var(--panel-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.progress-bar { height: 100%; width: 0; background: var(--blue); transition: width 1s linear; }

.banner {
  background: var(--amber-bg); border: 1px solid rgba(245,158,11,.35); color: #fbbf24;
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px;
}
.banner.red { background: var(--red-bg); border-color: rgba(239,68,68,.35); color: #fca5a5; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 12px; }
.footnote { color: var(--muted); font-size: 12px; margin: 0; padding: 10px 14px; border-top: 1px solid var(--border); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--panel); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty { text-align: center; color: var(--muted); padding: 28px; white-space: normal; }
.model-name { font-weight: 600; }
.model-code { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.rel { display: block; color: var(--muted); font-size: 12px; }
tr.is-available td:first-child { box-shadow: inset 3px 0 0 var(--green); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.grey { color: var(--grey); background: var(--grey-bg); }
.badge.amber { color: var(--amber); background: var(--amber-bg); }

.filters select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font: inherit;
}
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: 360px;
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--blue);
  padding: 10px 14px; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.toast.error { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }

.foot { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 16px 20px; }

@media (max-width: 760px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; }
  main { padding: 12px 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-value { font-size: 22px; }
}

@media (max-width: 960px) {
  /* Modeltabel als kaarten op kleine schermen */
  table.models thead { display: none; }
  table.models, table.models tbody, table.models tr, table.models td { display: block; width: 100%; }
  table.models tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.models td { border: 0; padding: 3px 0; white-space: normal; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.models td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  table.models td:first-child { display: block; text-align: left; }
  table.models td:first-child::before { content: none; }
  table.models td:last-child::before { content: none; }
  table.models td:last-child { justify-content: flex-end; padding-top: 8px; }
  table.models td.num { text-align: right; }
  tr.is-available td:first-child { box-shadow: none; }
  tr.is-available { box-shadow: inset 3px 0 0 var(--green); }
  .rel { display: inline; margin-left: 4px; }
}
