/* Design-Tokens 1:1 von drachenfels-rp.de */
@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap; src: url('/fonts/inter.woff2') format('woff2-variations'); }
@font-face { font-family: 'Oswald'; font-weight: 200 700; font-display: swap; src: url('/fonts/oswald.woff2') format('woff2-variations'); }

:root {
  --bg: #0d0e10; --surface: #17191c; --surface-2: #222427; --surface-3: #2c2e31;
  --border: #333538; --border-strong: #535558; --text: #eceef1; --muted: #aeafb2;
  --accent: #d11f2f; --accent-hover: #d73e4c; --accent-soft: #3c1a20; --accent-text: #dc5561; --on-accent: #fff;
  --success: #2fae6a; --success-soft: #12291d; --warn: #e0a030; --warn-soft: #2e2412; --info: #5a9bd8; --info-soft: #14222f;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --radius: 4px; --header-h: 68px; --shadow: 0 10px 30px rgb(0 0 0 / .35);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.6 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .01em; line-height: 1.15; margin: 0; font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
a { color: var(--accent-text); }
a:hover { color: var(--accent-hover); }
.container { width: min(960px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgb(13 14 16 / .94); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.site-header-inner { display: flex; align-items: center; gap: 16px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand img { width: 40px; height: 40px; }
.brand b { font: 600 1.25rem var(--font-head); text-transform: uppercase; letter-spacing: .03em; }
.brand span { color: var(--muted); font-size: .875rem; border-left: 1px solid var(--border); padding-left: 12px; }
.spacer { flex: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 20px; border: 1px solid transparent; border-radius: var(--radius); font: 600 .95rem/1.2 var(--font-body); text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--accent-text); border-color: var(--accent-soft); }
.btn-danger:hover { background: var(--accent-soft); color: var(--text); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Karten / Formulare */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-weight: 500; font-size: .925rem; }
input[type=text], input[type=url], input[type=password], input[type=number], input[type=email], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
input[type=color] { width: 56px; height: 42px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: .925rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.error-msg { color: var(--accent-text); font-size: .9rem; min-height: 1.3em; }

/* Badges / Status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.up { background: var(--success-soft); color: var(--success); }
.badge.down { background: var(--accent-soft); color: var(--accent-text); }
.badge.partial, .badge.warning { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.paused, .badge.unknown { background: var(--surface-3); color: var(--muted); }

main { flex: 1; padding: 40px 0 64px; }
.footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: .875rem; }
.footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Status-Seite */
.hero { padding: 8px 0 28px; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 10px 0 0; }
.banner { display: flex; align-items: center; gap: 16px; padding: 20px 24px; border-radius: var(--radius); border: 1px solid var(--border); border-left-width: 4px; background: var(--surface); margin-bottom: 24px; }
.banner h2 { font-size: 1.4rem; }
.banner.up { border-left-color: var(--success); background: linear-gradient(90deg, var(--success-soft), var(--surface) 60%); }
.banner.partial { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-soft), var(--surface) 60%); }
.banner.down { border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--surface) 60%); }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; }
.up > .dot { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.partial > .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.down > .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.notice { padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--border); border-left: 4px solid var(--info); background: var(--info-soft); margin-bottom: 12px; }
.notice.warning { border-left-color: var(--warn); background: var(--warn-soft); }
.notice.maintenance { border-left-color: var(--info); }
.notice b { display: block; }
.notice p { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; }

.section-title { margin: 36px 0 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mon { margin-bottom: 12px; }
.mon-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mon-head h3 { text-transform: none; font-family: var(--font-body); font-weight: 600; font-size: 1.05rem; letter-spacing: 0; }
.mon-head .pct { margin-left: auto; color: var(--muted); font-size: .9rem; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; height: 34px; margin: 14px 0 6px; }
.bar { background: var(--surface-3); border-radius: 2px; min-width: 2px; }
.bar.ok { background: var(--success); }
.bar.mid { background: var(--warn); }
.bar.bad { background: var(--accent); }
.bar:hover { opacity: .7; }
.bars-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.mon-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 12px; font-size: .85rem; color: var(--muted); }
.mon-stats b { color: var(--text); font-weight: 600; }
.incident { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.incident:last-child { border-bottom: 0; }

/* Admin */
.login-box { width: min(400px, 100% - 32px); margin: 12vh auto 0; }
.login-box .card { padding: 28px; }
.login-box img { width: 64px; height: 64px; display: block; margin-bottom: 18px; }
.admin-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 32px; width: min(1180px, 100% - 32px); margin-inline: auto; }
.side { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; display: flex; flex-direction: column; gap: 4px; }
.side button { text-align: left; background: none; border: 0; color: var(--muted); font: 500 .95rem var(--font-body); padding: 10px 14px; border-radius: var(--radius); cursor: pointer; border-left: 3px solid transparent; }
.side button:hover { background: var(--surface); color: var(--text); }
.side button.active { background: var(--surface); color: var(--text); border-left-color: var(--accent); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat b { display: block; font: 600 2rem var(--font-head); }
.stat span { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.mini-bars { display: grid; grid-auto-flow: column; grid-auto-columns: 3px; gap: 1px; height: 22px; }
.mini-bars .bar { border-radius: 1px; min-width: 0; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0; width: min(560px, 100% - 24px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / .65); }
dialog form { padding: 24px; }
dialog h2 { margin-bottom: 18px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.chart { width: 100%; height: 160px; display: block; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 4px solid var(--success); padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow); z-index: 100; }
.toast.err { border-left-color: var(--accent); }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .admin-wrap { grid-template-columns: 1fr; gap: 16px; }
  .side { position: static; flex-direction: row; overflow-x: auto; }
  .side button { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .side button.active { border-bottom-color: var(--accent); }
  .brand span { display: none; }
}

/* ===== Moderne Status-Seite ===== */
body.status-page::before { content: ''; position: fixed; inset: 0 0 auto 0; height: 420px; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); opacity: .55; }
.hero { padding: 24px 0 24px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.btn-row { display: flex; gap: 10px; align-items: center; }
.banner { padding: 26px 28px; border-radius: 8px; gap: 18px; box-shadow: var(--shadow); }
.banner .sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.banner h2 { font-size: 1.7rem; }
.dot { width: 18px; height: 18px; }
.banner.up .dot, .banner.partial .dot, .banner.down .dot { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px transparent; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none !important; } }
.card { border-radius: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; }
.stat-tile span { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-tile b { display: block; font: 600 1.9rem/1.2 var(--font-head); margin-top: 4px; }
.group-title { margin: 28px 0 10px; font-size: .85rem; color: var(--muted); letter-spacing: .08em; }
.mon { transition: border-color .15s; }
.mon:hover { border-color: var(--border-strong); }
.mon-top { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.mon-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mon-desc { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.spark { width: 160px; height: 34px; flex: none; }
.bars { height: 36px; }
.bar { border-radius: 3px; transition: transform .1s; }
.bar:hover { opacity: 1; transform: scaleY(1.12); }
.tip { position: fixed; z-index: 200; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 6px; padding: 6px 10px; font-size: .8rem; box-shadow: var(--shadow); white-space: nowrap; }

.issue { margin-bottom: 14px; border-left: 4px solid var(--info); }
.issue.investigating { border-left-color: var(--accent); }
.issue.monitoring { border-left-color: var(--warn); }
.issue.resolved { border-left-color: var(--success); }
.issue-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.issue-head h3 { text-transform: none; font-family: var(--font-body); font-size: 1.1rem; font-weight: 600; letter-spacing: 0; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: .75rem; color: var(--muted); background: var(--surface-3); border-radius: 4px; padding: 2px 8px; }
.timeline { margin: 16px 0 0; padding: 0; list-style: none; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; left: 0; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.timeline li.investigating::after { background: var(--accent); }
.timeline li.monitoring::after { background: var(--warn); }
.timeline li.resolved::after { background: var(--success); }
.timeline b { font-weight: 600; }
.timeline p { margin: 2px 0 0; color: var(--text); white-space: pre-wrap; }
.timeline time { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.day-title { margin: 26px 0 10px; font-size: .85rem; color: var(--muted); letter-spacing: .08em; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
dialog.sub-dialog { width: min(460px, 100% - 24px); }
.ok-msg { color: var(--success); font-size: .9rem; min-height: 1.3em; }

/* Inline-Styles sind per CSP verboten, daher hier */
.site-header-inner.wide { width: min(1180px, 100% - 32px); }
.login-title { font-size: 1.8rem; margin-bottom: 8px; }
.login-sub { margin: 0 0 20px; }
.btn-block { width: 100%; }
p.muted.login-sub + form, .login-box p.muted { margin-top: 0; }
