/* eazy-gist – schlichtes, lokal ausgeliefertes Stylesheet (keine externen Ressourcen) */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-mono-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #eef1ef;
  --ink: #0f1519;
  --muted: #56636c;
  --line: #dde2df;
  --brand: #0b7a6f;
  --brand-ink: #ffffff;
  --up: #197f45;
  --down: #c62828;
  --warn: #9a5b00;
  --idle: #9aa6ae;
  --up-bg: #e5f4ea;
  --down-bg: #fbe9e9;
  --warn-bg: #fbf0dc;
  --idle-bg: #eceff1;
  --focus: #0b7a6f;
  --shadow: 0 1px 2px rgba(15, 21, 25, 0.05), 0 6px 20px rgba(15, 21, 25, 0.05);
  --radius: 12px;
  --max: 1100px;
  --page-pad: 28px; /* oberer Abstand des Seiteninhalts */
  --header-h: 61px; /* Höhe des fixierten Headers (wird per JS an die echte Höhe angepasst) */
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0b0f12;
  --surface: #12191d;
  --surface-2: #1a2328;
  --ink: #e8eef1;
  --muted: #95a3ad;
  --line: #243038;
  --brand: #3ad6c2;
  --brand-ink: #04201c;
  --up: #46d37f;
  --down: #ff7676;
  --warn: #f3b24a;
  --idle: #5d6b74;
  --up-bg: #122a1b;
  --down-bg: #321818;
  --warn-bg: #302410;
  --idle-bg: #1d272c;
  --focus: #3ad6c2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
  /* clip statt hidden: verhindert seitliches Wackeln, macht body aber NICHT zum Scroll-Container (sonst verliert der klebende Header sein Verhalten) */
  overflow-x: clip;
}
@supports not (overflow: clip) { body { overflow-x: hidden; } }
/* Scroll-Sperre bei geöffnetem Menü nur auf html (wird auf den Viewport übertragen); auf body würde der Header mit wegscrollen */
html.no-scroll { overflow: hidden; }
main { flex: 1 0 auto; width: 100%; max-width: var(--max); margin: 0 auto; padding: var(--page-pad) 20px 48px; outline: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--brand); }
code, kbd { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript, .loading-line { padding: 24px 0; color: var(--muted); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 10px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 60; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { max-width: var(--max); margin: 0 auto; padding: 8px 20px; min-height: 60px; display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 1.1rem; letter-spacing: -0.02em; min-width: 0; flex: 0 1 auto; }
.brand-icon { flex: 0 0 auto; color: var(--brand); }
.brand-title { overflow-wrap: anywhere; line-height: 1.15; }
.nav-desktop { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-link, .nav-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font: inherit; font-weight: 500; text-decoration: none; background: none; border: 0; cursor: pointer; }
.nav-link:hover, .nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-link[aria-current='page'] { color: var(--ink); background: var(--surface-2); }
.user-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px 5px 10px; margin: 0 4px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--brand) 42%, var(--line)); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); font-weight: 600; font-size: 0.88rem; line-height: 1.3; text-decoration: none; max-width: 200px; transition: background 0.12s, border-color 0.12s; }
.user-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pill:hover, .user-pill[aria-current='page'] { background: color-mix(in srgb, var(--brand) 22%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 65%, var(--line)); }
.mobile-menu .user-pill { align-self: flex-start; margin: 6px 4px 8px; max-width: calc(100% - 8px); }
.menu-group-label { margin: 10px 12px 2px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; }
.mobile-menu .nav-link.nav-sub { padding-left: 20px; gap: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; flex: 0 0 auto; }
.icon-btn:hover { background: var(--surface-2); }
.lang-switch { display: inline-flex; flex: 0 0 auto; margin-left: 0; padding: 3px; gap: 2px; height: 40px; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.lang-switch button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.78rem; font-weight: 650; letter-spacing: 0.03em; padding: 0 9px; border-radius: 7px; cursor: pointer; }
.lang-switch button:hover { color: var(--ink); background: var(--surface-2); }
.lang-switch button[aria-pressed='true'] { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--brand); }
.theme-btn { margin-left: 0; }
/* Werkzeuge (Sprache, Hell/Dunkel) rücken zusammen und sind durch einen feinen Strich von der Navigation getrennt */
.header-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: 4px; padding-left: 16px; border-left: 1px solid var(--line); min-height: 32px; }
/* Konto-Menü (Desktop) */
.account { position: relative; margin: 0 4px; }
.account .user-pill { margin: 0; cursor: pointer; font: inherit; font-size: 0.88rem; font-weight: 600; line-height: 1.2; }
.account .user-pill .chev { transition: transform 0.15s ease; opacity: 0.8; }
.account .user-pill[aria-expanded='true'] .chev { transform: rotate(180deg); }
.account .user-pill[aria-expanded='true'] { background: color-mix(in srgb, var(--brand) 22%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 65%, var(--line)); }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; max-width: 320px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 80; display: flex; flex-direction: column; gap: 2px; }
.dropdown[hidden] { display: none; }
.dd-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; min-width: 0; }
.dd-head .dd-label { color: var(--muted); font-size: 0.78rem; }
.dd-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 0.98rem; }
.dd-head .dd-role { color: var(--muted); font-size: 0.82rem; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.dd-item:hover, .dd-item:focus-visible { background: var(--surface-2); outline: none; }
.dd-item:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 55%, transparent); }
.dd-item[aria-current='page'] { color: var(--brand); }
.dd-item svg { flex: 0 0 auto; color: var(--muted); }
.dd-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.burger { display: none; }
.mobile-menu { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - var(--header-h) - 8px); max-height: calc(100dvh - var(--header-h) - 8px); overflow-y: auto; overscroll-behavior: contain; }
.mobile-menu[hidden], .backdrop[hidden] { display: none; }
.mobile-menu .nav-link, .mobile-menu .nav-btn { padding: 12px; font-size: 1rem; width: 100%; justify-content: flex-start; }
.mobile-menu .nav-user { padding: 8px 12px; }
.backdrop { position: fixed; inset: 0; background: rgba(4, 8, 10, 0.58); z-index: 55; }
@media (max-width: 900px) {
  .nav-desktop { display: none; }
  .burger { display: inline-flex; }
  .header-tools { margin-left: auto; padding-left: 0; border-left: 0; }
}
@media (max-width: 760px) {
  main { padding: 20px 14px 40px; }
  .header-inner { padding: 8px 14px; }
}
@media (min-width: 901px) {
  .mobile-menu, .backdrop { display: none !important; }
}

/* ---------- Footer / Toasts ---------- */
.site-footer { flex: 0 0 auto; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
/* gleiche Breite und gleicher Seitenabstand wie Header (.header-inner) und Inhalt (main), damit die Kanten fluchten */
.footer-inner { box-sizing: border-box; max-width: var(--max); margin: 0 auto; padding: 18px 20px 26px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; text-align: left; }
.footer-text { min-width: 0; overflow-wrap: anywhere; }
.footer-right { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 18px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; padding: 3px 0; border-radius: 4px; }
.footer-link:hover { color: var(--ink); text-decoration: underline; }
.footer-version { font-variant-numeric: tabular-nums; opacity: 0.85; }
@media (max-width: 760px) { .footer-inner { padding-left: 14px; padding-right: 14px; } }
@media (max-width: 560px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-right { margin-left: 0; justify-content: flex-start; }
}
.footer-preview { border: 1px dashed var(--line); border-radius: 10px; padding: 14px 16px; background: var(--surface-2); color: var(--muted); font-size: 0.85rem; }
.footer-preview .footer-inner { max-width: none; padding: 0; }
.footer-preview .empty { text-align: center; }
.links-title { margin: 18px 0 10px; font-size: 0.95rem; }
.input-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1 1 220px; min-width: 0; width: auto; }
.input-row .btn { flex: 0 0 auto; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.tab { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 550; padding: 7px 18px; border-radius: 9px; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 0 0 1px var(--line); }
.link-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) minmax(0, 1.5fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 760px) { .link-row { grid-template-columns: minmax(0, 1fr) auto; } .link-row > .input:nth-child(1) { grid-column: 1 / -1; } .link-row > .input:nth-child(3) { grid-column: 1 / -1; } .link-row > button { grid-row: 2; grid-column: 2; } }
.toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 11px 12px; box-shadow: var(--shadow); animation: toast-in 0.18s ease-out; }
.toast.success { border-left-color: var(--up); }
.toast.error { border-left-color: var(--down); }
.toast.warning { border-left-color: var(--warn); }
.toast.info { border-left-color: var(--brand); }
.toast-msg { flex: 1; overflow-wrap: anywhere; }
.toast button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; display: inline-flex; border-radius: 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons & Formulare ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 40px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; transition: background 0.12s, border-color 0.12s; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--brand); }
.btn.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, var(--line)); }
.btn.danger:hover:not(:disabled) { background: var(--down-bg); }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 0.88rem; }
.btn.icon { padding: 0; width: 36px; min-height: 36px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-spin { display: flex; justify-content: center; padding: 32px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 550; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.82rem; }
.input, select.input, textarea.input { width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
textarea.input { min-height: 90px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: 0 0 auto; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.inline-error { color: var(--down); background: var(--down-bg); padding: 9px 12px; border-radius: 9px; font-size: 0.9rem; }
.inline-note { color: var(--ink); background: var(--warn-bg); padding: 9px 12px; border-radius: 9px; font-size: 0.9rem; }

/* ---------- Karten, Badges, Status ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.up { color: var(--up); background: var(--up-bg); }
.status-pill.down { color: var(--down); background: var(--down-bg); }
.status-pill.pending, .status-pill.paused { color: var(--muted); background: var(--idle-bg); }
.status-pill.nodot::before { display: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.type-badge { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 600; }

/* ---------- Kennzahlen ---------- */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 8px 0 12px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; align-items: start; }
.admin-content { min-width: 0; }
/* Haftpunkt = natürliche Position (Header + Seitenabstand), damit das Menü beim Scrollen nicht ein paar Pixel nach oben rutscht */
.subnav { position: sticky; top: calc(var(--header-h) + var(--page-pad)); max-height: calc(100vh - var(--header-h) - var(--page-pad) - 16px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.subnav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.subnav-link svg { flex: 0 0 auto; }
.subnav-link:hover { background: var(--surface-2); color: var(--ink); }
.subnav-link[aria-current='page'] { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.subnav-link[aria-current='page'] svg { color: var(--brand); }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 1.65rem; letter-spacing: -0.025em; }
.page-head p { margin-top: 2px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel > h2 { font-size: 1.02rem; margin-bottom: 10px; }
.panel > .notice { margin-bottom: 16px; }
.panel > .notice:last-child { margin-bottom: 0; }
.panel > h2 + .notice { margin-bottom: 0; }
.cmd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 2px; }
.cmd-row .cmd { user-select: all; padding: 3px 8px; overflow-wrap: anywhere; }
.copy-btn { color: var(--muted); }
.copy-btn:hover { color: var(--ink); }
.update-note { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 0.88rem; }
.update-note svg { color: var(--brand); flex: 0 0 auto; }
.update-note strong { color: var(--ink); font-weight: 600; }
.hint-box > * + * { margin-top: 8px; }
.hint-box:empty { display: none; }
.panel-body > .notice.warn { margin-bottom: 14px; }
.notice code { font-size: 0.85em; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .subnav { display: none; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 14px; }
}
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-head h1 { font-size: 1.6rem; }
.login-card { max-width: 400px; margin: 40px auto; }
.login-card h1 { font-size: 1.4rem; margin-bottom: 4px; }
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.login-extra { margin-top: 14px; font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.login-extra:empty { display: none; }
.login-extra .link-btn { margin-left: 0; }
.login-card .inline-note { margin-top: 16px; }
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.dash .stat { padding: 12px 14px; }
.terminal-wrap { margin: 0; }
/* Ressourcen-Monitor im Konsolen-Stil – nutzt ausschließlich die Theme-Farben der übrigen Kacheln */
.terminal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); overflow: hidden; }
.term-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 0.98rem; }
.term-head svg { color: var(--brand); }
.term-body { padding: 14px 18px 16px; font-family: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace; font-size: 0.88rem; line-height: 1.85; font-variant-numeric: tabular-nums; }
.term-prompt { color: var(--muted); }
.term-prompt .pr { color: var(--brand); }
.term-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; }
.term-row .tk { color: var(--muted); min-width: 11ch; }
.term-row .tv { color: var(--ink); min-width: 20ch; }
.term-row .tx { color: var(--muted); }
.tbar { display: inline-flex; align-items: center; gap: 2px; }
.tbar i { width: 7px; height: 12px; border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.tbar i.on { background: var(--brand); box-shadow: none; }
.tbar.warm i.on { background: var(--warn); }
.tbar.hot i.on { background: var(--down); }
.term-cursor { display: inline-block; width: 0.6em; height: 1.05em; vertical-align: text-bottom; background: var(--brand); animation: term-blink 1.15s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }
@media (max-width: 560px) { .term-body { padding: 12px 14px 14px; font-size: 0.82rem; } .term-head { padding: 12px 14px; } .tbar i { width: 6px; } }
.sysline { color: var(--muted); font-size: 0.82rem; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 4px 18px; }
details.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
details.section > summary { flex-wrap: wrap; list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-radius: var(--radius); }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary:hover { background: var(--surface-2); }
details.section > summary .chev { transition: transform 0.15s; color: var(--muted); display: inline-flex; }
details.section[open] > summary .chev { transform: rotate(180deg); }
details.section[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px solid var(--line); }
.section-title { font-weight: 650; font-size: 1.02rem; display: flex; flex-direction: column; gap: 1px; flex: 1 1 0; min-width: 0; }
details.section > summary .chev { flex: 0 0 auto; }
.section-title small { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.section-body { padding: 18px; }
.section-preview { flex: 1 0 100%; cursor: default; }
.notice { border: 1px solid; border-radius: 9px; padding: 10px 12px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 3px; }
.notice.ok { background: var(--up-bg); border-color: color-mix(in srgb, var(--up) 40%, var(--line)); }
.notice.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.notice.off { background: var(--surface-2); border-color: var(--line); }
.notice strong { font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; margin-left: 4px; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; border-radius: 4px; }
.sub { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.sub > h3 { margin-bottom: 12px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.editor { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.editor h3 { margin-bottom: 14px; }

table.rtable { width: 100%; border-collapse: collapse; }
.rtable th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.82rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rtable td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: break-word; }
@media (min-width: 1181px) { .rtable tr:last-child td { border-bottom: 0; } } /* nur in der Tabellen-Ansicht; als Karte behält jede Zeile ihre Trennlinie */
.rtable .actions { white-space: nowrap; }
.rtable .actions .btn-row { flex-wrap: nowrap; }
@media (max-width: 1180px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin-bottom: 10px; background: var(--surface); }
  .rtable td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); text-align: right; }
  .rtable td:last-child { border-bottom: 0; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: 0.82rem; font-weight: 500; text-align: left; flex: 0 0 38%; }
  .rtable td.actions { flex-direction: column; align-items: stretch; text-align: left; }
  .rtable td.actions::before { display: none; }
  .rtable .actions .btn-row { flex-wrap: wrap; }
}
.file-list { display: grid; gap: 8px; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.file-row .name { overflow-wrap: anywhere; font-weight: 550; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Modales Fenster ---------- */
body.modal-open { overflow: hidden; }
dialog.modal { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); animation: modal-in 0.18s ease-out; margin: auto; overscroll-behavior: contain; }
dialog.modal::backdrop { background: rgba(4, 8, 10, 0.62); backdrop-filter: blur(3px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 4px; }
.modal-titles { flex: 1; min-width: 0; }
.modal-titles h2 { font-size: 1.2rem; }
.modal-icon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.modal-icon.danger { background: var(--down-bg); color: var(--down); }
.modal-icon.success { background: var(--up-bg); color: var(--up); }
.modal-x { width: 36px; height: 36px; border: 0; background: transparent; }
.modal-body { padding: 14px 20px 20px; display: grid; gap: 16px; }
.modal-body-form { display: grid; gap: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 22px 16px; border: 2px dashed var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface-2)); }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone .dz-icon { color: var(--brand); }
.dropzone input[type='file'] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone.has-file { border-style: solid; border-color: color-mix(in srgb, var(--up) 45%, var(--line)); background: var(--up-bg); cursor: default; }
.dropzone.has-file input[type='file'] { display: none; }
.dz-file { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.dz-file .name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.modal-state { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 18px 4px 6px; }
.modal-state .spinner { width: 28px; height: 28px; border-width: 3px; color: var(--brand); }
@media (max-width: 560px) {
  dialog.modal { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; }
}
/* Chips für die Empfängerliste */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 0.9rem; overflow-wrap: anywhere; }
.chip button { display: inline-flex; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 999px; }
.chip button:hover { background: var(--down-bg); color: var(--down); }
.add-row { display: flex; gap: 8px; align-items: flex-end; }
.add-row .field { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Browser-Autofill: keine gelbe/olivfarbene Hinterlegung, Theme-Farben bleiben erhalten ---------- */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill:active,
textarea:-webkit-autofill, textarea:-webkit-autofill:hover, textarea:-webkit-autofill:focus,
select:-webkit-autofill, select:-webkit-autofill:hover, select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 600000s 0s, color 600000s 0s;
}
input:autofill, textarea:autofill, select:autofill { box-shadow: 0 0 0 1000px var(--surface) inset; -webkit-text-fill-color: var(--ink); background-color: var(--surface) !important; color: var(--ink) !important; }
input:-moz-autofill, input:-moz-autofill-preview { box-shadow: 0 0 0 1000px var(--surface) inset !important; background-color: var(--surface) !important; color: var(--ink) !important; filter: none; }

/* ---------- Touch-Geräte / Handy ---------- */
/* iOS Safari zoomt beim Fokussieren von Feldern unter 16 px automatisch hinein und bleibt gezoomt → mindestens 16 px */
@media (pointer: coarse), (max-width: 760px) {
  input, select, textarea, .input, select.input, textarea.input { font-size: 16px; }
  textarea.input { font-size: 16px; }
}
/* Doppeltipp-Zoom auf bedienbaren Elementen vermeiden (Pinch-Zoom bleibt möglich) */
a, button, input, select, textarea, summary, label, .icon-btn { touch-action: manipulation; }
/* Datum/Zeit-Felder sprengen auf iOS gern ihren Container */
input[type='date'], input[type='time'], input[type='datetime-local'] { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; display: block; line-height: 1.2; }
input[type='date']::-webkit-date-and-time-value, input[type='time']::-webkit-date-and-time-value, input[type='datetime-local']::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
code { overflow-wrap: anywhere; }
@media (max-width: 560px) { dialog.modal { width: 100%; max-width: 100%; } }
@media (max-width: 760px) {
  .editor { padding: 14px; }
  .section-body { padding: 14px; }
}

/* ======================================================================
   Vorlage: Startseite und Breiten-Variante
   ====================================================================== */
/* breite Seiten (main.wide, z. B. Verwaltung): Header, Inhalt und Footer teilen sich dieselbe Breite */
:root:has(main.wide) { --max: 1480px; }
.dd-item.danger { color: var(--down); }
.dd-item.danger svg { color: var(--down); }
.dropdown.pop { position: fixed; right: auto; z-index: 96; min-width: 210px; }

/* ---------- Startseite ---------- */
.landing-hero { padding: 38px 0 30px; max-width: 760px; }
.landing-hero h1 { font-size: clamp(2rem, 5.6vw, 3.2rem); letter-spacing: -0.035em; font-weight: 700; }
.landing-hero h1 span { color: var(--brand); }
.landing-hero p { margin-top: 14px; color: var(--muted); font-size: 1.08rem; max-width: 56ch; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.landing-cta .btn { min-height: 46px; padding-inline: 22px; font-size: 1rem; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 22px 0 10px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: minmax(0, 1fr); } }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature .f-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: color-mix(in srgb, var(--brand) 13%, var(--surface)); color: var(--brand); margin-bottom: 12px; }
.feature h3 { margin-bottom: 4px; }
.feature p { color: var(--muted); font-size: 0.92rem; }
.landing-demo { margin-top: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.landing-demo .demo-bar { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.landing-demo .demo-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.landing-demo .demo-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 190px; }
.demo-side { padding: 12px; border-right: 1px solid var(--line); display: grid; gap: 4px; align-content: start; font-size: 0.88rem; color: var(--muted); }
.demo-side div { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; }
.demo-side .on { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--ink); }
.demo-page { padding: 16px 20px; }
.demo-page h3 { font-size: 1.2rem; margin-bottom: 8px; }
.demo-page p { color: var(--muted); margin-bottom: 6px; }
@media (max-width: 560px) { .landing-demo .demo-body { grid-template-columns: minmax(0, 1fr); } .demo-side { display: none; } }

/* ---------- Allgemeine Hilfsklassen ---------- */
/* einheitlicher Abstand zwischen den Blöcken der Verwaltungs-Übersicht, Ereignislisten, Hinweise */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 2px 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--muted); font-size: 0.85rem; }
.stack { display: grid; gap: 14px; }
.notice .link-btn { margin-left: 0; }
.notice > div:has(> .link-btn:only-child) { margin-top: 2px; }
.form-note { margin-top: 12px; }
.move-list { max-height: 260px; overflow-y: auto; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.move-list label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.move-list label:hover { background: var(--surface-2); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width 0.15s; }

/* ---------- Gists ---------- */
.mono, .ce, .cv { font-family: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.gists-page { display: grid; gap: 16px; }
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.filter-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-bottom: 8px; }
.sub-tight { margin-top: 8px; }
.gist-link { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.gist-link:hover { color: var(--brand); text-decoration: underline; }
.gist-title-cell { min-width: 0; }
@media (max-width: 1180px) { .gist-title-cell { display: block; text-align: left; } .gist-title-cell::before { display: none; } }
.vis-badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: var(--idle-bg); color: var(--muted); }
.vis-badge.public { background: var(--up-bg); color: var(--up); }
.label-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.label-row .fake-label { font-weight: 600; font-size: 0.9rem; }
.label-row .muted { margin-left: auto; }
.gist-form { display: grid; gap: 16px; }
.gist-h1 { font-size: 1.5rem; overflow-wrap: anywhere; }
.gist-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.gist-actions { margin: 12px 0; }
.gist-view .notice { margin-bottom: 12px; }

/* Code-Editor: Textfeld liegt transparent über der eingefärbten Ebene; beide teilen Schrift, Abstände und Zeilenhöhe */
.ce-wrap { display: grid; gap: 6px; min-width: 0; }
.ce { display: flex; height: clamp(260px, 55vh, 640px); min-height: 200px; resize: vertical; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; line-height: 20px; }
.ce:focus-within { outline: 2px solid var(--focus); border-color: var(--focus); }
.ce-gutter, .cv-gutter { margin: 0; padding: 10px 10px 10px 12px; text-align: right; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--line); overflow: hidden; user-select: none; font: inherit; line-height: inherit; flex: 0 0 auto; }
.ce-gutter { padding-bottom: 26px; }
.ce-stage { position: relative; flex: 1 1 auto; min-width: 0; }
.ce-hl, .ce-input { position: absolute; inset: 0; margin: 0; padding: 10px 14px 26px 12px; border: 0; font: inherit; line-height: inherit; tab-size: 2; white-space: pre; letter-spacing: normal; word-spacing: normal; }
.ce-hl { overflow: hidden; pointer-events: none; color: var(--ink); background: transparent; padding-right: 30px; }
.ce-hl code, .cv-code code { background: none; padding: 0; font: inherit; border-radius: 0; }
.ce-input { width: 100%; height: 100%; overflow: auto; resize: none; background: transparent; color: transparent; caret-color: var(--ink); -webkit-text-fill-color: transparent; outline: none; }
.ce-input::selection { background: color-mix(in srgb, var(--brand) 32%, transparent); -webkit-text-fill-color: transparent; }
.ce-input::placeholder { -webkit-text-fill-color: var(--muted); }

/* Code-Anzeige */
.cv { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); font-size: 13px; line-height: 20px; }
.cv-scroll { display: flex; overflow: auto; max-height: 75vh; outline: none; }
.cv-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cv-gutter { position: sticky; left: 0; z-index: 1; min-height: 100%; }
.cv-code { margin: 0; padding: 10px 16px; flex: 1 0 auto; min-width: 0; tab-size: 2; white-space: pre; font: inherit; line-height: inherit; color: var(--ink); }

/* Farben der Syntaxelemente (hell/dunkel über die Variablen des Themes) */
:root { --tok-comment: #6a737d; --tok-keyword: #cf222e; --tok-string: #0a6b4f; --tok-number: #0550ae; --tok-title: #8250df; --tok-attr: #953800; --tok-meta: #6e7781; --tok-add: #116329; --tok-del: #82071e; }
:root[data-theme='dark'] { --tok-comment: #8b98a3; --tok-keyword: #ff8f8f; --tok-string: #7ee0b5; --tok-number: #7cc4ff; --tok-title: #c9a7ff; --tok-attr: #ffb872; --tok-meta: #9aa7b1; --tok-add: #7ee0a0; --tok-del: #ff9a9a; }
.hljs-comment, .hljs-quote { color: var(--tok-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag, .hljs-type, .hljs-built_in { color: var(--tok-keyword); }
.hljs-string, .hljs-regexp, .hljs-template-variable, .hljs-addition { color: var(--tok-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-variable, .hljs-link { color: var(--tok-number); }
.hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-class .hljs-title, .hljs-selector-id, .hljs-selector-class { color: var(--tok-title); }
.hljs-attr, .hljs-attribute, .hljs-name, .hljs-params, .hljs-property { color: var(--tok-attr); }
.hljs-meta, .hljs-meta .hljs-keyword, .hljs-tag, .hljs-subst { color: var(--tok-meta); }
.hljs-addition { background: color-mix(in srgb, var(--tok-add) 14%, transparent); color: var(--tok-add); }
.hljs-deletion { background: color-mix(in srgb, var(--tok-del) 14%, transparent); color: var(--tok-del); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
@media (max-width: 640px) { .filter-grid { grid-template-columns: minmax(0, 1fr); } .ce { height: clamp(240px, 50vh, 520px); } .label-row .muted { margin-left: 0; } }

/* Lange Werte ohne Leerzeichen (Pfade, IP-Adressen, JSON) umbrechen, statt die Seite seitlich scrollbar zu machen */
.rtable td { min-width: 0; overflow-wrap: anywhere; }
.admin-content { min-width: 0; }

/* ---------- Update aus der Verwaltung ---------- */
.update-progress .steps { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.update-progress .steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.update-progress .steps li.done { color: var(--ink); }
.update-progress .steps li.done svg { color: var(--brand); }
.update-progress .steps li.now { color: var(--ink); font-weight: 600; }
.update-progress .steps li.now svg { color: var(--brand); animation: spin 1s linear infinite; }
.update-log { max-height: 220px; overflow: auto; margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.update-progress .steps li.fail { color: var(--down); font-weight: 600; }
.update-progress .steps li.fail svg { color: var(--down); }
