:root {
    --bg: #0b1220;
    --surface: #111c2e;
    --surface-2: #17243a;
    --border: #26364f;
    --text: #f4f7fb;
    --text-muted: #a8b5c7;
    --accent: #4f7cff;
    --accent-2: #20c5d8;
    --on-accent: #ffffff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius-card: 14px;
    --radius-button: 10px;
    --shadow: 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #f4f7fb;
        --surface: #ffffff;
        --surface-2: #eaf0f8;
        --border: #d5deea;
        --text: #0b1220;
        --text-muted: #55637a;
        --accent: #2f5fe8;
        --accent-2: #0c8797;
        --success: #15803d;
        --warning: #b45309;
        --danger: #c81e1e;
        --shadow: 0 8px 24px rgba(11, 18, 32, .08);
        color-scheme: light;
    }
}

:root[data-theme="light"] {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #eaf0f8;
    --border: #d5deea;
    --text: #0b1220;
    --text-muted: #55637a;
    --accent: #2f5fe8;
    --accent-2: #0c8797;
    --success: #15803d;
    --warning: #b45309;
    --danger: #c81e1e;
    --shadow: 0 8px 24px rgba(11, 18, 32, .08);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

h1, h2 { line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
.muted { color: var(--text-muted); font-size: .9rem; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    font-size: 1.2rem;
    text-decoration: none;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.button {
    display: inline-block;
    padding: .65rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-button);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s ease;
}
.button:hover { filter: brightness(1.1); }
.button-primary { background: var(--accent); color: var(--on-accent); }
.button-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.button-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }

.field { margin-bottom: 1rem; flex: 1 1 200px; min-width: 0; }
.field-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field input, .field select {
    width: 100%;
    padding: .6rem .75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-button);
    color: var(--text);
    font: inherit;
}
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-help { color: var(--text-muted); font-size: .85rem; margin: .3rem 0 0; }
.field-error { color: var(--danger); font-size: .85rem; margin: .3rem 0 0; }
.checkbox { display: flex; gap: .5rem; align-items: center; }

.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius-button);
    border: 1px solid var(--border);
    border-left-width: 4px;
    background: var(--surface-2);
}
.alert-success { border-left-color: var(--success); }
.alert-warning { border-left-color: var(--warning); }
.alert-error { border-left-color: var(--danger); }

.badge {
    display: inline-block;
    padding: .1rem .55rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
}
.badge-ok { color: var(--success); }
.badge-warning { color: var(--warning); }
.badge-failed { color: var(--danger); }

.summary { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: .35rem 1rem; margin: 0 0 1.25rem; }
.summary dt { color: var(--text-muted); }
.summary dd { margin: 0; overflow-wrap: anywhere; }

/* Installer und Anmeldung */
.centered-main { width: 100%; max-width: 620px; margin: 0 auto; padding: 2.5rem 1rem; }
.centered-main > .brand { margin-bottom: 1.25rem; }

.steps { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.steps li { display: flex; align-items: center; gap: .35rem; color: var(--text-muted); font-size: .8rem; }
.steps li + li::before { content: ""; width: 12px; height: 1px; background: var(--border); }
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 50%;
}
.steps .is-current { color: var(--text); font-weight: 600; }
.steps .is-current .step-number { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.steps .is-done .step-number { border-color: var(--success); color: var(--success); }
.steps li:not(.is-current) .step-label { display: none; }

.checklist { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.checklist li {
    display: grid;
    grid-template-columns: 4rem 1fr auto;
    gap: .75rem;
    align-items: center;
    padding: .4rem 0;
    border-bottom: 1px solid var(--border);
}

/* Oeffentliche Seiten */
.site-header, .site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.25rem 1rem;
}
.site-footer { color: var(--text-muted); font-size: .9rem; }
.site-main { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.hero { padding: 4rem 0 3rem; max-width: 720px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.hero-text { color: var(--text-muted); font-size: 1.1rem; }
.eyebrow { color: var(--accent-2); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; padding-bottom: 3rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.5rem; }
.tile p { color: var(--text-muted); margin: 0; }

.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.legal { max-width: 760px; padding: 2rem 0 3rem; overflow-wrap: anywhere; }
.legal h2 { margin-top: 1.75rem; }

/* Administration */
.admin-page { display: flex; min-height: 100vh; }
.sidebar { flex: 0 0 240px; background: var(--surface); border-right: 1px solid var(--border); padding: 1.25rem 1rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; margin-top: 1.5rem; }
.sidebar nav a { padding: .55rem .75rem; border-radius: var(--radius-button); color: var(--text-muted); text-decoration: none; }
.sidebar nav a:hover { background: var(--surface-2); }
.sidebar nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 600; }
.admin-content { flex: 1; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .75rem; padding: .75rem 1.5rem; border-bottom: 1px solid var(--border); }
.topbar form { margin: 0; }
.topbar-user { margin-right: auto; color: var(--text-muted); }
.menu-toggle { display: none; }
.admin-main { max-width: 900px; padding: 1.5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; margin: 0; }

/* Dashboard */
.inline-form { margin-bottom: 1.25rem; }
.avatar { border-radius: 50%; vertical-align: middle; margin-right: .4rem; }
.empty-state { text-align: center; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.server-card { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; height: 100%; margin: 0; color: var(--text); text-decoration: none; }
.server-card:hover { border-color: var(--accent); }
.server-icon { width: 48px; height: 48px; border-radius: 12px; }
.server-icon-empty { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); font-weight: 600; }
.server-name { font-weight: 600; overflow-wrap: anywhere; }
code { overflow-wrap: anywhere; }

@media (max-width: 760px) {
    .admin-page { display: block; }
    .sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar.is-open { display: block; }
    .menu-toggle { display: inline-block; }
    .topbar, .admin-main { padding-left: 1rem; padding-right: 1rem; }
    .checklist li { grid-template-columns: 4rem 1fr; }
    .checklist li .muted { grid-column: 2; }
}

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