/* Terminal-Design (nur dunkel, Bernstein). Vorbild: htop / k9s, alte Phosphor-Monitore.
   Alle Farben als Tokens; Seiten-CSS nutzt nur diese Tokens und die Bausteine unten. */

@font-face { font-family: 'Geist Mono'; font-weight: 400; font-display: swap; src: url('/fonts/geist-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-weight: 500; font-display: swap; src: url('/fonts/geist-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-weight: 700; font-display: swap; src: url('/fonts/geist-mono-latin-700-normal.woff2') format('woff2'); }

:root {
	color-scheme: dark;
	--bg: #0e0c0a;
	--panel: #14110e;
	--sel: #201a14;      /* Hover / Auswahl / Statusleiste */
	--line: #2c251d;     /* Rahmen */
	--dim: #43382b;      /* leerer Teil von Metern */
	--fg: #e8dfd2;
	--muted: #8a7e6e;
	--accent: #f0a648;   /* Bernstein: Titel, Links, Werte */
	--ok: #9bd67a;
	--warn: #ff8552;     /* orange-rot, damit es sich vom Bernstein abhebt */
	--bad: #ff6363;
	--info: #d9c08f;
	--chart-2: #7fb6d6;  /* zusätzliche Graph-Farben, kühl als Kontrast zum Bernstein */
	--chart-3: #c29be0;
	--mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
	--radius: 0;
}

* { box-sizing: border-box; }
/* hidden muss immer verstecken – sonst überschreibt jede eigene display-Regel (flex, grid …) das Attribut */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--mono); }
body { min-height: 100vh; display: flex; flex-direction: column; }
::selection { background: var(--accent); color: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-size: inherit; font-weight: 500; margin: 0; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* ── Kopf (Statusleiste + Tabs) oben fest ── */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); }

/* ── Statusleiste oben ── */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 6px 16px; background: var(--sel); color: var(--muted); }
.bar .brand { color: var(--accent); font-weight: 500; }
.bar .brand .bar-host { color: var(--muted); font-weight: 400; }
.bar .brand:hover { text-decoration: none; }
.bar .r { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ── Navigation als Tabs ── */
.nav { display: flex; flex-wrap: wrap; gap: 0 18px; padding: 8px 16px 0; border-bottom: 1px solid var(--line); }
.nav a { color: var(--muted); padding: 4px 0 6px; border-bottom: 1px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--fg); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Werkzeugleiste unter den Tabs (Layout `toolbar`), steht mit dem Kopf oben fest ── */
.toolbar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 28px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.toolbar > * { min-width: 0; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 18px 16px 32px; flex: 1; }

/* ── Box mit Titel im Rahmen: <section class="box"><h2 class="box-t">titel</h2>…</section> ── */
/* Abstand zwischen Bereichen auf allen Seiten gleich (Handy etwas weniger, siehe unten) */
.box { position: relative; border: 1px solid var(--line); padding: 14px 12px 10px; margin-top: 44px; min-width: 0; }
/* Erste sichtbare Box nicht weit weg von den Tabs – auch wenn davor ein verstecktes Formular (Admin) oder ein
   Wrapper (öffentliche Statusseite) steht */
.container > .box:first-child, .container > .box[hidden]:first-child + .box, .container > :first-child:not(.box) > .box:first-child { margin-top: 12px; }
.box-t { position: absolute; top: -10px; left: 10px; background: var(--bg); padding: 0 6px; color: var(--accent); font-weight: 500; line-height: 18px; }
.box-t::before { content: '┤ '; color: var(--line); }
.box-t::after { content: ' ├'; color: var(--line); }
.box-r { position: absolute; top: -10px; right: 10px; background: var(--bg); padding: 0 6px; color: var(--muted); line-height: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 0 24px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }

/* ── Text & Werte ── */
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .info { color: var(--info); }
.dot::before { content: '●'; }
.empty { color: var(--muted); padding: 4px 0; }
.empty::before { content: '— '; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; }
.meter { color: var(--accent); letter-spacing: -1px; white-space: nowrap; }
.meter .off { color: var(--dim); }
.meter.ok { color: var(--ok); } .meter.warn { color: var(--warn); } .meter.bad { color: var(--bad); }
.cursor { display: inline-block; width: .6em; height: 1.1em; background: currentColor; vertical-align: -2px; margin-left: 2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ── Tabellen / Listen ── */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li, .row { padding: 4px 6px; margin: 0 -6px; }
.rows > li:hover, .row:hover { background: var(--sel); }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; color: var(--muted); font-weight: 400; padding: 2px 12px 4px 0; border-bottom: 1px solid var(--line); }
table.t td { padding: 3px 12px 3px 0; vertical-align: top; font-variant-numeric: tabular-nums; }
table.t tr:hover td { background: var(--sel); }
.scroll { overflow-x: auto; }

/* ── Formulare & Buttons ── */
button, .btn { font: inherit; color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: 0; padding: 3px 10px; cursor: pointer; }
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
button.primary { color: var(--bg); background: var(--accent); border-color: var(--accent); }
button.primary:hover { color: var(--bg); filter: brightness(1.1); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); }
label { display: block; color: var(--muted); margin: 10px 0 2px; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 0; padding: 4px 8px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

kbd { font: inherit; color: var(--bg); background: var(--muted); padding: 0 5px; }

/* Buttons: klein, Gefahr, scharf geschaltete Bestätigung („wirklich löschen?“), gesperrt */
button.sm { padding: 0 7px; line-height: 1.6; }
button.danger { color: var(--bad); }
button.armed, button.armed:hover { color: var(--bg); background: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .6; cursor: wait; }

/* ── Handy: Tabs in einer wischbaren Zeile ── */
.nav .short { display: none; }
@media (max-width: 640px) {
	/* Statusleiste: eine Zeile = status … Countdown · abmelden. Host, E-Mail, Uhr weg. */
	.bar { gap: 2px 12px; }
	.bar-host, .bar-email, .bar-clock { display: none; }
	.nav .long { display: none; }
	.nav .short { display: inline; }
	.nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
	.nav::-webkit-scrollbar { display: none; }
	.nav a { white-space: nowrap; }
	html, body { font-size: 14.5px; }
	/* Werkzeugleiste: eine Zeile, nichts darf breiter als der Bildschirm werden */
	.toolbar { padding: 5px 12px; gap: 8px; flex-wrap: nowrap; align-items: center; justify-content: space-between; }
	.bar { padding: 5px 12px; font-size: 13.5px; }
	.nav { gap: 0 14px; padding: 8px 12px 0; }
	.container { padding: 14px 12px 24px; }
	.box { margin-top: 40px; }
}

/* ── Countdown oben rechts (Klick = jetzt neu laden) ── */
.bar-refresh { border: 0; padding: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.bar-refresh:hover { color: var(--accent); }

