/* Glimmerwald Grundstil. Ruhig, gut lesbar, Tablet/Laptop/Handy.
   Farben aus der SVG-Palette (docs/architektur_app_v1.md, Abschnitt Gestaltung). */

:root {
    --ink: #1a1a1a;
    --paper: #ffffff;
    --muted: #5d6470;          /* dunkler als #8a8f98, damit Text lesbar bleibt */
    --line: #e6e9ee;
    --soft: #f5f7fa;
    --accent: #1565c0;
    --accent-dark: #0f4a8f;
    --ok: #2e7d32;
    --bad: #c62828;
    --hint: #ef6c00;
    --wood: #eef3ea;           /* sehr heller Waldton für den Seitenhintergrund */
    --radius: 14px;
    --shadow: 0 1px 2px rgba(26, 26, 26, .06), 0 4px 14px rgba(26, 26, 26, .06);
}

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

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--wood);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); font-size: .9rem; }
.lead { font-size: 1.15rem; }
code { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: .05em .35em; font-size: .92em; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }

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

.skip-link { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 8px; top: 8px; }

/* Kopf */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-header__inner {
    max-width: 62rem; margin: 0 auto; padding: .5rem 1rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand img { border-radius: 50%; display: block; }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1 1 auto; }
.site-nav a {
    color: var(--ink); text-decoration: none; padding: .5rem .8rem; border-radius: 999px; min-height: 44px;
    display: inline-flex; align-items: center;
}
.site-nav a:hover { background: var(--soft); }
.site-nav a[aria-current="page"] { background: #e3edf9; color: var(--accent-dark); font-weight: 600; }
.site-user { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.site-user__name { color: var(--muted); font-size: .95rem; }

/* Inhalt */
.site-main { flex: 1 0 auto; width: 100%; max-width: 62rem; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem; }
.site-footer p { margin: 0; }

.card {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.5rem; margin: 0 0 1.25rem;
}
.card--narrow { max-width: 28rem; margin-left: auto; margin-right: auto; }
.card--wide { max-width: 40rem; margin-left: auto; margin-right: auto; }
.card--center { text-align: center; }
.hero-img { display: block; margin: 0 auto 1rem; max-width: 60%; height: auto; }

/* Begrüßung und Kacheln */
.hello { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }
.hello__img { flex: 0 0 auto; height: auto; max-width: 28vw; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; height: 100%;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.1rem; color: var(--ink); text-decoration: none;
    transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile img { height: auto; }
.tile__title { font-size: 1.2rem; font-weight: 700; color: var(--accent-dark); }
.tile__text { color: var(--muted); font-size: .95rem; }

/* Formulare */
.form { display: flex; flex-direction: column; gap: .35rem; }
.form label { font-weight: 600; margin-top: .6rem; }
.form input[type="text"], .form input[type="password"], .form input[type="email"] {
    width: 100%; min-height: 48px; padding: .6rem .8rem; font: inherit; color: var(--ink);
    background: var(--paper); border: 2px solid #c9ced6; border-radius: 10px;
}
.form select { width: 100%; min-height: 48px; padding: .6rem .8rem; font: inherit; color: var(--ink); background: var(--paper); border: 2px solid #c9ced6; border-radius: 10px; }
.form select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(21, 101, 192, .25); }
.form input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(21, 101, 192, .25); }
.form .btn { margin-top: 1rem; align-self: flex-start; }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .5rem 1rem 1rem; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .2rem; }
.form legend { font-weight: 700; padding: 0 .4rem; }
.form--box { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; background: var(--soft); }

/* Tabellen (Admin) */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; vertical-align: top; padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
.table th { font-size: .85rem; color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .4rem; }
.inline-form input[type="password"] { min-height: 44px; padding: .4rem .6rem; font: inherit; border: 2px solid #c9ced6; border-radius: 10px; max-width: 12rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Knöpfe */
.btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .55rem 1.2rem;
    font: inherit; font-weight: 600; color: var(--accent-dark); background: var(--paper);
    border: 2px solid var(--accent); border-radius: 999px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #e3edf9; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); color: #fff; }
.btn--quiet { border-color: transparent; color: var(--ink); background: transparent; }
.btn--quiet:hover { background: var(--soft); }

/* Meldungen (Farbe nie allein: Rand links plus Text) */
.alert { margin: 0 0 1rem; padding: .75rem 1rem; border-radius: 10px; border-left: 6px solid; background: var(--soft); }
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert--ok { border-color: var(--ok); background: #eaf5eb; }
.alert--error { border-color: var(--bad); background: #fbeaea; }
.alert--hint { border-color: var(--hint); background: #fdf1e3; }

.debug { text-align: left; margin-top: 1rem; }
.debug pre { overflow: auto; background: var(--soft); border: 1px solid var(--line); padding: .75rem; border-radius: 8px; font-size: .8rem; }

/* Platz für den Käfer-Button (P5): rund, schwebend, unten links */
.kaefer-button {
    position: fixed; left: 16px; bottom: 16px; width: 56px; height: 56px; padding: 0;
    border: 2px solid var(--line); border-radius: 50%; background: var(--paper); box-shadow: var(--shadow); cursor: pointer; z-index: 20;
}
.kaefer-button img { width: 100%; height: 100%; display: block; }
/* Platz unter dem Seitenende, damit der Käfer nie die letzten Zeilen verdeckt */
body:has(.kaefer-button) .site-footer { padding-bottom: 88px; }
@media (max-width: 48rem) {
    .kaefer-button { width: 46px; height: 46px; left: 10px; bottom: 10px; opacity: .92; }
}

.page-login .site-main { padding-top: 2rem; }

@media (max-width: 36rem) {
    html { font-size: 16.5px; }
    h1 { font-size: 1.5rem; }
    .site-header__inner { padding: .4rem .75rem; }
    .site-user { margin-left: 0; width: 100%; justify-content: space-between; }
    .hello { flex-direction: column; text-align: center; }
    .hello__img { max-width: 40vw; }
    .card { padding: 1.1rem; }
}

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

/* Meldungen (Käfer): bearbeitete Zeilen durchgestrichen und grau, Filterleiste */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.btn--active { font-weight: 700; border-color: var(--accent, currentColor); }
.kaefer-table tr.is-done td:nth-child(4) { text-decoration: line-through; }
.kaefer-table tr.is-done td { color: var(--muted); }
.inline-form--stack { display: flex; flex-direction: column; gap: .4rem; align-items: stretch; min-width: 12rem; }

/* Admin: Zustand der Sicherung */
.backup-health { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .95rem; border: 1px solid var(--line); }
.backup-health--ok { background: #eaf5eb; border-color: var(--ok); }
.backup-health--warn { background: #fdf1e3; border-color: var(--hint); }
.backup-health--error { background: #fdecec; border-color: var(--bad); }
