:root {
    --red: #E2001A;
    --red-dark: #b80015;
    --bg: #f4f6f8;
    --card: #fff;
    --soft: #f1f2f4;
    --text: #222;
    --muted: #6b6f76;
    --line: #d9dce0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* sonst überschreibt "input { display: block }" das hidden-Attribut */

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    overflow-wrap: anywhere; /* lange Namen ohne Leerzeichen umbrechen statt das Layout zu sprengen */
}

.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 24px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .08);
}

@media (max-width: 760px) {
    .container { margin: 0; border-radius: 0; min-height: calc(100vh - 52px); padding: 16px; }
}

/* Navigation */
.topbar {
    position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap;
    padding: 10px 16px;
    background: var(--red);
    font-size: .95rem;
}
.topbar a, .topbar .link { color: #fff; text-decoration: none; }
.topbar a:hover, .topbar .link:hover { text-decoration: underline; background: none; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-right: auto; }
.topbar .brand img { width: 28px; height: 28px; background: #fff; border-radius: 6px; padding: 2px; }
.topbar form { margin: 0; }
.nav { display: flex; gap: 16px; }
.nav svg { display: none; }
.nav .narrow-only { display: none; }
.nav a.active { text-decoration: underline; text-underline-offset: 4px; }

/* Handy: Navigation als Leiste unten, Abmelden steht auf der Konto-Seite */
@media (max-width: 760px) {
    .topbar .logout { display: none; }
    .topbar .nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
        gap: 0; background: #fff; border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .topbar .nav a {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 8px 0 6px; color: var(--muted); font-size: .75rem; text-decoration: none;
    }
    .topbar .nav a.active { color: var(--red); font-weight: 600; }
    .nav svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .nav .wide { display: none; }
    .nav .narrow-only { display: inline; }
    body.has-nav { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    body.has-nav .container { min-height: calc(100vh - 52px - 64px); }
}
button.link { background: none; padding: 0; font-weight: inherit; font-size: inherit; }

h1 { margin: 0 0 4px; font-size: 1.6rem; line-height: 1.2; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: .85rem; color: var(--muted); font-weight: 600; margin: 18px 0 4px; }
p { margin: 0 0 8px; }
.subtitle { color: var(--muted); margin-bottom: 20px; }
.muted { color: var(--muted); font-size: .9rem; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; }

/* Formulare & Buttons */
label { display: block; font-size: .9rem; color: var(--muted); }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 11px 12px;
    font: inherit;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: transparent; }
input[type=file] { padding: 8px; }

button, .button {
    display: inline-block;
    padding: 11px 18px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--red);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
}
button:hover, .button:hover { background: var(--red-dark); }
button.secondary, .button.secondary { background: #e3e5e8; color: var(--text); }
button.secondary:hover, .button.secondary:hover { background: #d3d6da; }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > input, .row > label { flex: 1 1 200px; }
.row form { margin: 0; }
.form { display: grid; gap: 14px; }
.search { margin-bottom: 20px; }

/* Ergebnisse */
.results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.results a {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 2px 10px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}
.results a:hover { background: var(--soft); }
.results a > strong, .results a > .muted, .results a > small { grid-column: 2; }
.results .badge { grid-column: 3; grid-row: 1 / 4; align-self: center; }
.thumb-sm { grid-column: 1; grid-row: 1 / 4; width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--soft); }
.results li[hidden] { display: none; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; background: #e3e5e8; }
.badge.aktiv { background: #dff3e4; color: #1d6b34; }
.badge.stillgelegt { background: #fde2e4; color: #8c1d24; }

.notice { padding: 10px 14px; border-radius: 8px; background: var(--soft); }
.notice.error { background: #fde2e4; color: #8c1d24; }
.notice.ok { background: #dff3e4; color: #1d6b34; }
.notice.warn { background: #fff1d6; color: #7a4b00; }
.stale { color: #a25e00; font-weight: 600; }

/* Detail */
.card { background: var(--soft); padding: 18px; border-radius: 10px; margin-bottom: 20px; }
.facts { display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 0; }
dt { font-size: .85rem; color: var(--muted); }
dd { margin: 0; }
.coords { display: inline-flex; align-items: center; gap: 8px; font-family: ui-monospace, monospace; color: inherit; white-space: nowrap; }
.coords img { width: 24px; height: 24px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border-radius: 8px; display: block; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.thumb { display: block; max-width: 160px; border-radius: 6px; margin: 6px 0; }

.actions { margin-top: 24px; }
.admin { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }

.between { justify-content: space-between; align-items: center; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; font-size: .85rem; }
.filters a { padding: 4px 10px; border-radius: 99px; background: var(--soft); color: var(--text); text-decoration: none; }
.filters a.active { background: var(--red); color: #fff; }
.button.block { display: block; margin-bottom: 20px; }
button.danger { background: #fff; color: #b3261e; border: 1px solid #e3b4b0; }
button.danger:hover { background: #fde2e4; }
.confirm { margin-top: 24px; }
.confirm h2:first-child { margin-top: 0; }
.history { margin: 0; padding-left: 18px; font-size: .9rem; }
.changes summary { cursor: pointer; font-weight: 600; }
.changes .history { margin-top: 10px; }
.changes li + li { margin-top: 8px; }
.meta { margin-top: 16px; font-size: .8rem; }
.narrow { max-width: 360px; }
.container:has(.narrow) { max-width: 420px; } /* Login: Karte so schmal wie das Formular statt leerer Fläche rechts */
@media (max-width: 760px) {
    /* Login am Handy: mittige Karte wie am PC, Formular nutzt die ganze Kartenbreite */
    .container:has(.narrow) { margin: 32px auto; width: calc(100% - 32px); min-height: 0; border-radius: 12px; padding: 24px; }
    .narrow { max-width: none; }
}
fieldset.image-field { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
label.check { display: flex; align-items: center; gap: 6px; color: var(--text); }
label.check input { width: auto; margin: 0; }
.users li { display: grid; gap: 6px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.users li > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.users details[open] { display: grid; gap: 8px; }
.new-user { gap: 10px; }
.new-user .row.between { align-items: center; }
.logout-page { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.users summary { cursor: pointer; color: var(--red); }
#map { height: 70vh; min-height: 360px; border-radius: 10px; margin-top: 8px; }
.toolbar { margin-bottom: 4px; }
.sort { margin: 0; }
.sort label { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.sort select { width: auto; margin: 0; padding: 6px 10px; font-size: .9rem; }

/* Detailseite: wichtigste Aktionen oben */
.quick-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.quick-actions > * { flex: 1; }
.quick-actions form { margin: 0; display: flex; }
.quick-actions button, .quick-actions .button { width: 100%; padding-left: 8px; padding-right: 8px; }
.confirm details { margin-top: 12px; }
.confirm summary { cursor: pointer; color: var(--red); }
.confirm details .form { margin-top: 10px; }
.confirm h2 { margin-top: 0; }

/* Koordinaten im Formular */
.coords-field { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.coords-field legend { padding: 0; margin-bottom: 4px; font-size: .9rem; color: var(--muted); }
.coords-field .row > button { flex: 0 0 auto; }
.image-field .camera { justify-self: start; }
@media (pointer: fine) { .image-field .camera { display: none; } } /* nur auf Touch-Geräten mit Kamera sinnvoll */

/* Weg auf der Satellitenkarte */
.route-map { height: 360px; border-radius: 10px; margin: 6px 0 10px; }
.route { margin-bottom: 20px; }
.route h2 { margin: 0; }
.route-field { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.route-field legend { padding: 0; margin-bottom: 4px; font-size: .9rem; color: var(--muted); }
.route-field .row > button { flex: 1 1 auto; }
.park-icon { background: #1a73e8; color: #fff; border: 2px solid #fff; border-radius: 6px; font: 700 16px/24px system-ui, sans-serif; text-align: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
@media (min-width: 1000px) { .route-map { height: 480px; } } /* auf großen Bildschirmen mehr Kartenfläche */
