:root {
    color-scheme: light;
    --bg: #f6f8f4;
    --surface: #ffffff;
    --surface-2: #eef4ed;
    --text: #172018;
    --muted: #5b685e;
    --line: #dbe4da;
    --brand: #155b36;
    --brand-2: #0f3f27;
    --accent: #e56a1f;
    --shadow: 0 20px 60px rgba(24, 43, 31, 0.10);
    --radius: 24px;
    --r1-bg: #dff2d3;
    --r1-text: #18520e;
    --r2-bg: #fff2b8;
    --r2-text: #614900;
    --r3-bg: #ffd6a6;
    --r3-text: #673900;
    --r4-bg: #ffb3a8;
    --r4-text: #711b12;
    --r5-bg: #d9b6ff;
    --r5-text: #3d1463;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #e8f1e5 0, transparent 36rem), var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--brand); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
code { padding: .1rem .35rem; border-radius: .4rem; background: #edf2ee; }

.container { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.skip-link { position: absolute; left: -999px; top: 1rem; background: var(--brand); color: #fff; padding: .75rem 1rem; border-radius: .75rem; z-index: 10; }
.skip-link:focus { left: 1rem; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(246, 248, 244, .90);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}
.header-grid { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: .8rem; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--brand); color: white; font-size: 1.25rem; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: -.15rem; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.nav a { color: var(--muted); text-decoration: none; padding: .55rem .75rem; border-radius: 999px; font-weight: 650; }
.nav a:hover, .nav a.active, .nav a[aria-current="page"] { background: var(--surface-2); color: var(--brand-2); }

.hero { padding: 5rem 0 3rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 2rem; align-items: center; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 800; margin: 0 0 .65rem; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 1rem; }
h1 { font-size: clamp(2.5rem, 7vw, 5rem); letter-spacing: -.06em; max-width: 860px; }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -.035em; }
h3 { font-size: 1.25rem; }
.lead { font-size: clamp(1.05rem, 2vw, 1.35rem); color: var(--muted); max-width: 760px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 999px; padding: .75rem 1.05rem; text-decoration: none; font-weight: 800; }
.button.primary { background: var(--brand); color: white; }
.button.secondary { background: var(--surface); color: var(--brand); border: 1px solid var(--line); }
.button:hover { transform: translateY(-1px); }

.emergency-card { background: linear-gradient(145deg, #fff, #fff5ed); border: 1px solid #ffd9bd; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); position: relative; }
.emergency-card strong { display: block; font-size: 1.25rem; }
.pulse { width: .75rem; height: .75rem; border-radius: 50%; background: var(--accent); display: inline-block; box-shadow: 0 0 0 0 rgba(229, 106, 31, .55); animation: pulse 1.8s infinite; margin-bottom: .75rem; }
@keyframes pulse { to { box-shadow: 0 0 0 1rem rgba(229, 106, 31, 0); } }

.dashboard { padding: 2rem 0 5rem; }
.section-heading, .panel-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.status { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .55rem .8rem; color: var(--muted); font-size: .92rem; }
.status.ok { color: var(--brand-2); background: #e5f3e7; border-color: #c9e5cf; }
.status.warn { color: #7a4900; background: #fff1d2; border-color: #ffd78d; }
.status.error { color: #7b1616; background: #ffe2df; border-color: #ffc2bb; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card, .panel, .source-box { background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card { padding: 1.25rem; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1; margin: .45rem 0; letter-spacing: -.06em; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.panel { padding: 1.25rem; }
.panel p { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1rem 0; }
.badge { display: inline-flex; align-items: center; min-height: 34px; border-radius: 999px; padding: .35rem .7rem; font-weight: 800; }
.risk-1 { background: var(--r1-bg); color: var(--r1-text); }
.risk-2 { background: var(--r2-bg); color: var(--r2-text); }
.risk-3 { background: var(--r3-bg); color: var(--r3-text); }
.risk-4 { background: var(--r4-bg); color: var(--r4-text); }
.risk-5 { background: var(--r5-bg); color: var(--r5-text); }
.risk-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.risk-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem .75rem; border-radius: 1rem; background: var(--surface-2); }

.station-panel { margin-top: 1rem; }
.station-tools { align-items: end; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: end; }
.filters label { display: grid; gap: .25rem; color: var(--muted); font-size: .86rem; font-weight: 700; }
input, select { min-height: 42px; border-radius: .8rem; border: 1px solid var(--line); padding: .55rem .7rem; background: #fff; color: var(--text); font: inherit; }
input[type="search"] { min-width: min(320px, 72vw); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 1rem; }
table { width: 100%; border-collapse: collapse; background: white; }
caption { text-align: left; padding: .75rem 1rem; color: var(--muted); font-weight: 700; }
th, td { text-align: left; padding: .75rem 1rem; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { background: #f4f7f3; color: var(--muted); font-size: .86rem; }
td.station-name { font-weight: 800; color: var(--text); white-space: normal; min-width: 220px; }
.index-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 34px; border-radius: .8rem; font-weight: 900; }
.source-box { padding: 1.25rem; margin-top: 1rem; }
.small { font-size: .92rem; color: var(--muted); }
.notice { padding: 1rem; background: #fff7df; border: 1px solid #ffde91; border-radius: 1rem; color: #624000 !important; }

.page { padding: 4rem 0 5rem; }
.page h1 { font-size: clamp(2.2rem, 5vw, 3.7rem); }
.legal-page h2 { margin-top: 2rem; }
.check-list { padding-left: 1.1rem; }
.check-list li { margin: .55rem 0; }

.site-footer { border-top: 1px solid var(--line); background: #132417; color: #eef6ed; padding: 2rem 0; }
.site-footer a { color: #d8f8c8; }
.site-footer p { color: #c4d1c5; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

@media (max-width: 900px) {
    .hero-grid, .content-grid, .footer-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .header-grid { align-items: flex-start; flex-direction: column; padding: .9rem 0; }
    .site-header { position: static; }
}
@media (max-width: 560px) {
    .stat-grid { grid-template-columns: 1fr; }
    .section-heading, .panel-header, .station-tools { display: block; }
    .filters { justify-content: stretch; }
    input[type="search"], select { width: 100%; min-width: 0; }
}

/* Admin, Installation und Status */
.admin-body { background: radial-gradient(circle at top right, #eef7ee 0, transparent 38rem), var(--bg); }
.admin-page h1 { max-width: 920px; }
.admin-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.admin-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.admin-stat-grid .stat-card strong { font-size: clamp(2rem, 5vw, 3.25rem); }
.narrow-grid { grid-template-columns: minmax(0, 480px) minmax(0, 1fr); align-items: start; }
.admin-form { display: grid; gap: .85rem; }
.admin-form label { display: grid; gap: .35rem; font-weight: 750; color: var(--muted); }
.admin-form input[type="text"], .admin-form input[type="password"] { width: 100%; }
.inline-form { margin-top: 1rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.status-table th { width: 42%; }
.status-inline { display: inline-flex; align-items: center; min-height: 28px; border-radius: 999px; padding: .18rem .55rem; font-weight: 850; font-size: .86rem; }
.status-inline.ok { color: var(--r1-text); background: var(--r1-bg); }
.status-inline.warn { color: var(--r3-text); background: var(--r3-bg); }
.status-inline.error { color: var(--r4-text); background: var(--r4-bg); }
.notice.success { background: #e5f3e7; border-color: #c9e5cf; color: var(--brand-2) !important; }
.notice.danger { background: #ffe2df; border-color: #ffc2bb; color: #7b1616 !important; }
.code-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.block-code { display: block; white-space: normal; word-break: break-all; padding: .85rem; border: 1px solid var(--line); background: #f7faf6; border-radius: 1rem; }
.auth-page .panel { align-self: start; }

@media (max-width: 900px) {
    .admin-topbar, .code-grid, .narrow-grid { display: block; }
    .code-grid > div, .narrow-grid > * { margin-bottom: 1rem; }
    .admin-actions { justify-content: flex-start; }
}


.notice.warning { background: #fff7df; border-color: #ffde91; color: #624000 !important; }
.install-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.install-grid .full { grid-column: 1 / -1; }
.admin-form .install-grid label { display: block; margin: .35rem 0; }
.admin-form textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 14px; padding: .85rem 1rem; font: inherit; }
.code-box { white-space: pre-wrap; overflow: auto; max-height: 360px; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #f7faf7; }
.muted { color: var(--muted); }
@media (max-width: 800px) { .install-grid { grid-template-columns: 1fr; } }
