@font-face {
  font-family: "Plex";
  src: url("/fonts/plex-sans.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --paper: #fafaf9;
  --surface: #ffffff;
  --ink: #1c1917;
  --quiet: #78716c;
  --line: #e7e5e4;
  --tint: #f5f5f4;
  --up: #15803d;
  --down: #dc2626;
  --slow: #b45309;
  --hold: #2563eb;
  --down-tint: #fef2f2;
  --slow-tint: #fffbeb;
  --hold-tint: #eff6ff;
  --up-tint: #f0fdf4;
  --radius: 10px;
  --font: "Plex", system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Arabic", "Noto Sans Bengali", "Noto Sans Devanagari", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --tabbar-h: 0px;
}
/* Donker: als het systeem donker is (tenzij je licht kiest), of als je zelf donker kiest. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141312;
    --surface: #1c1b19;
    --ink: #f5f5f4;
    --quiet: #a8a29e;
    --line: #2e2c2a;
    --tint: #24221f;
    --up: #4ade80;
    --down: #f87171;
    --slow: #fbbf24;
    --hold: #60a5fa;
    --down-tint: #2a1616;
    --slow-tint: #2a2111;
    --hold-tint: #15202f;
    --up-tint: #13241a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141312;
  --surface: #1c1b19;
  --ink: #f5f5f4;
  --quiet: #a8a29e;
  --line: #2e2c2a;
  --tint: #24221f;
  --up: #4ade80;
  --down: #f87171;
  --slow: #fbbf24;
  --hold: #60a5fa;
  --down-tint: #2a1616;
  --slow-tint: #2a2111;
  --hold-tint: #15202f;
  --up-tint: #13241a;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
.theme-corner { position: fixed; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; }
.lang-pick { position: relative; display: inline-flex; align-items: center; height: 38px; border-radius: 8px; color: var(--quiet); transition: background .12s, color .12s; }
.lang-pick:hover, .lang-pick:focus-within { background: var(--tint); color: var(--ink); }
.lang-pick > svg.i { position: absolute; inset-inline-start: 10px; pointer-events: none; }
.lang-pick select { width: auto; min-height: 38px; padding-block: 0; padding-inline: 36px 30px; border: 0; background-color: transparent; color: inherit; font-weight: 500; cursor: pointer; }
.lang-pick select:focus { box-shadow: none; }
.lang-pick select:focus-visible { outline: 2px solid var(--hold); outline-offset: 2px; }
[dir="rtl"] .i.flip { transform: scaleX(-1); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--font); font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }
code, pre { font-family: var(--mono); font-size: 13px; }
pre { background: var(--tint); border-radius: 8px; padding: 12px 14px; margin: 8px 0 0; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.hidden { display: none !important; }
.quiet { color: var(--quiet); }
.small { font-size: 13px; }
.error { color: var(--down); font-size: 14px; min-height: 1.4em; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--hold); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- merkteken ---------- */
.mark { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 2px solid var(--paper); }
.mark::before { content: ""; position: absolute; left: 9px; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--up); z-index: 1; }

/* ---------- top & tabbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 max(24px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; color: var(--quiet); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--tint); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--tint); }
.nav a svg { display: none; }
.tabbar { display: none; }
main { max-width: 1040px; margin: 0 auto; padding: 40px 24px 80px; outline: none; }

/* ---------- knoppen & velden ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s; }
.btn:hover { background: var(--tint); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { opacity: .9; background: var(--ink); }
.btn.danger { color: var(--down); }
.btn.plain { border-color: transparent; background: transparent; }
.btn.plain:hover { background: var(--tint); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--quiet); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--tint); color: var(--ink); }
.icon-btn.danger:hover { color: var(--down); }
.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
select { -webkit-appearance: none; appearance: none; padding-inline-end: 34px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8580' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 16px; background-position: right 10px center; }
[dir="rtl"] select { background-position: left 10px center; }
select option { background: var(--surface); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.5; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.field { display: block; }
.field > span { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field .help { display: block; margin-top: 5px; font-size: 13px; color: var(--quiet); font-weight: 400; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check b { font-weight: 500; display: block; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.form .full { grid-column: 1 / -1; }

/* ---------- blokken ---------- */
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.head .grow > p { margin-top: 6px; }
.section { margin-top: 40px; }
.section > .bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel.pad { padding: 20px; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.item .meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--quiet); font-size: 13px; }
.empty { padding: 48px 20px; text-align: center; }
.empty p { color: var(--quiet); margin: 6px auto 20px; max-width: 40ch; }
.note { padding: 12px 14px; border-radius: 8px; background: var(--tint); font-size: 14px; }
.note.down { background: var(--down-tint); color: var(--down); }
.note.warn { background: var(--slow-tint); color: var(--slow); }

/* ---------- status ---------- */
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--quiet); flex: none; }
.dot.up { background: var(--up); }
.dot.down { background: var(--down); box-shadow: 0 0 0 0 var(--down); animation: beat 1.6s infinite; }
.dot.degraded { background: var(--slow); }
.dot.paused { background: var(--hold); }
@keyframes beat { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--down) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 13px; font-weight: 500; background: var(--tint); color: var(--quiet); white-space: nowrap; }
.tag.up, .tag.ok { background: var(--up-tint); color: var(--up); }
.tag.down, .tag.failed { background: var(--down-tint); color: var(--down); }
.tag.degraded, .tag.running { background: var(--slow-tint); color: var(--slow); }
.tag.paused, .tag.maintenance, .tag.redirect, .tag.offline { background: var(--hold-tint); color: var(--hold); }

.verdict { font-size: 34px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; max-width: 22ch; }
.verdict.down { color: var(--down); }
.verdict.slow { color: var(--slow); }
.facts { display: flex; gap: 6px 20px; flex-wrap: wrap; margin-top: 10px; color: var(--quiet); font-size: 14px; }
.facts .bad { color: var(--down); }

/* hartslag: de laatste 40 controles */
.beat { display: flex; align-items: flex-end; gap: 2px; height: 24px; }
.beat i { flex: 1; min-width: 2px; height: 100%; border-radius: 1.5px; background: var(--up); opacity: .75; transform-origin: bottom; }
.beat i.slow { background: var(--slow); opacity: 1; }
.beat i.fail { background: var(--down); opacity: 1; }
.beat i.none { background: var(--line); opacity: 1; }
.intro .beat i { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--n) * 12ms); }
@keyframes rise { from { transform: scaleY(0.15); opacity: 0; } }

.site { display: grid; grid-template-columns: 9px minmax(140px, 1.2fr) minmax(120px, 2fr) 72px 64px 18px; align-items: center; gap: 18px; padding: 16px 18px; text-decoration: none; }
.site:hover { background: var(--tint); }
.list > .site:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.list > .site:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.site .name { font-weight: 500; }
.site .sub { font-size: 13px; color: var(--quiet); }
.site .num { text-align: end; font-size: 14px; }
.site .num small { display: block; color: var(--quiet); font-size: 12px; }
.site .err { grid-column: 2 / -1; font-size: 13px; color: var(--down); margin-top: -6px; }
.site .err.warn { color: var(--slow); }
.site > svg { color: var(--quiet); }

/* ---------- detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--quiet); text-decoration: none; font-size: 14px; margin-bottom: 16px; }
.back:hover { color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); }
.stat { padding: 16px 18px; }
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.stat span { font-size: 13px; color: var(--quiet); }
.chart { width: 100%; height: 150px; display: block; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--ink); opacity: .05; }
.chart .fail { fill: var(--down); }
.chart .grid { stroke: var(--line); vector-effect: non-scaling-stroke; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--quiet); margin-top: 6px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--tint); flex-wrap: wrap; }
.seg button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--quiet); font: inherit; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.ic { width: 36px; height: 36px; border-radius: 8px; background: var(--tint); display: grid; place-items: center; color: var(--quiet); flex: none; }
details > summary { cursor: pointer; font-size: 14px; font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary svg { transform: rotate(90deg); }
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 20px; font-size: 14px; }
.kv dt { color: var(--quiet); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 8px; width: fit-content; margin: 0 auto; }
.qr svg { width: 200px; height: 200px; display: block; }

/* ---------- pagina-editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.editor textarea { min-height: 420px; }
.preview { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--quiet); font: inherit; font-size: 14px; cursor: pointer; }
.pills button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }

/* ---------- modal & meldingen ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(12, 10, 9, .45); animation: fade .15s; }
.modal { width: min(600px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: 0 24px 64px rgba(0, 0, 0, .25); }
.modal > header { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.modal > .body { padding: 18px 20px; overflow-y: auto; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; left: 50%; bottom: calc(20px + var(--tabbar-h) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: fade .15s; white-space: pre-wrap; }
.toast.err { background: var(--down); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(360px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-box .mark { width: 36px; height: 36px; border-radius: 9px; }
.login-box .mark::after { inset: 9px; border-width: 3px; }
.login-box .mark::before { left: 15px; top: 15px; width: 6px; height: 6px; }
.login-box h1 { font-size: 24px; }
#login-creds { display: flex; flex-direction: column; gap: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- telefoon ---------- */
@media (max-width: 760px) {
  :root { --tabbar-h: 64px; }
  body { font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  .topbar { height: 54px; padding: 0 16px; padding-top: env(safe-area-inset-top); height: calc(54px + env(safe-area-inset-top)); }
  .topbar .nav { display: none; }
  .brand { flex: 1; }
  main { padding: 24px 16px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--quiet); text-decoration: none; font-size: 11px; font-weight: 500; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  h1 { font-size: 24px; }
  .verdict { font-size: 27px; }
  .head { margin-bottom: 24px; flex-direction: column; align-items: stretch; gap: 14px; }
  .head h1.truncate { white-space: normal; overflow-wrap: anywhere; }
  .head p.quiet a { overflow-wrap: anywhere; }
  .head > .btn { width: 100%; }
  .head > .row .btn { flex: 1; }
  .section { margin-top: 32px; }
  .form, .editor { grid-template-columns: 1fr; }
  .site { grid-template-columns: 9px 1fr auto; gap: 6px 12px; padding: 14px 16px; }
  .site .beat { grid-column: 2 / -1; grid-row: 2; height: 20px; }
  .site .num.ms { display: none; }
  .site > svg { display: none; }
  .site .err { grid-column: 2 / -1; margin-top: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat + .stat { border-inline-start: 0; }
  .stat:nth-child(even) { border-inline-start: 1px solid var(--line); }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .item { padding: 14px 16px; flex-wrap: wrap; }
  .item .acts { width: 100%; justify-content: flex-start; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .seg button { justify-content: center; padding: 0 8px; white-space: nowrap; }
  .seg.three { grid-template-columns: repeat(3, 1fr); }
  .section > .bar h2.grow { flex-basis: 100%; }
  .section > .bar .btn { flex: 1; }
  .backdrop { place-items: end stretch; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal > footer .btn { flex: 1; }
  .preview, .editor textarea { height: 320px; min-height: 320px; }
}

/* ---------- server ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.meter { height: 6px; border-radius: 3px; background: var(--tint); overflow: hidden; margin: 8px 0 2px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--up); transition: width .4s ease; }
.meter i.warn { background: var(--slow); }
.meter i.bad { background: var(--down); }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px 18px; }
.cores > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.cores .meter { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--quiet); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--ink); font-weight: 600; }
.legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.chart .line.s1, .legend i.s1 { stroke: var(--ink); background: var(--ink); }
.chart .line.s2, .legend i.s2 { stroke: var(--hold); background: var(--hold); }
.chart .line.s3, .legend i.s3 { stroke: var(--slow); background: var(--slow); }
.item .num { font-size: 14px; white-space: nowrap; }
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .tabbar a { font-size: 10px; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
}
.kv.specs dd { font-family: inherit; font-size: 14px; }
.nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
@media (max-width: 980px) and (min-width: 761px) {
  .topbar { gap: 12px; padding: 0 16px; }
  .nav a { padding: 7px 9px; }
  .brand span:last-child { display: none; }
}
