* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; background: #fff; color: #222; }

:root {
    --z-map: 1;
    --z-map-controls: 400;
    --z-fab: 500;
    --z-header: 600;
    --z-panel: 700;
    --z-modal: 900;
    --z-toast: 1000;
    --h-header: 64px;
    --h-navpills: 52px;
    --h-topstack: calc(var(--h-header) + var(--h-navpills));
}

/* Floating Buttons hinter offenen Panels verstecken statt sie ueberlagern zu
   lassen - body-Klasse wird beim Oeffnen/Schliessen von Modal/Sidebar gesetzt. */
body.panel-open .btn-report,
body.panel-open .btn-admin,
body.panel-open .btn-locate,
body.panel-open .map-search,
body.popup-open .btn-report,
body.popup-open .btn-admin,
body.popup-open .btn-locate,
body.popup-open .map-search {
    display: none;
}

/* Ein offenes Marker-Popup ist ein Panel wie jedes andere. Der Layer-Toggle liegt
   ueber dem Popup und verdeckt dessen Foto - und zwar nicht ueber z-index loesbar:
   Leaflets .leaflet-map-pane hat selbst z-index 400 und bildet damit einen eigenen
   Stacking-Kontext, in dem das Popup (Pane-z-index 700) eingesperrt bleibt. Die
   Controls liegen als Geschwister-Element davor, egal wie hoch das Popup zaehlt.
   Also werden sie ausgeblendet, solange ein Popup offen ist. */
body.popup-open .leaflet-control-container {
    display: none;
}

.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--h-header);
    z-index: var(--z-header);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 0 0;
    border-bottom: 1px solid #ebebeb;
    overflow: hidden;
}

.nav-pills {
    position: fixed;
    top: var(--h-header); left: 0; right: 0;
    height: var(--h-navpills);
    z-index: var(--z-header);
    background: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    border-bottom: 1px solid #ebebeb;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-pills::-webkit-scrollbar { display: none; }
.nav-pills > button { flex: none; }

/* Riss (Sprung-Design): das Bild hat eine gezackte Kante (rechts) und eine gerade
   Kante (links). object-fit:cover + object-position:right zeigt nur die gezackte
   Seite, die gerade Seite wird ausserhalb der kleinen Box abgeschnitten. */
.riss-corner {
    position: absolute;
    width: 30px;
    height: 70px;
    object-fit: cover;
    object-position: right center;
    pointer-events: none;
    opacity: 0.5;
    z-index: 5;
}
.riss-tr { top: 0; right: 0; }
.riss-tl { top: 0; left: 0; transform: scaleX(-1); }
.riss-br { bottom: 0; right: 0; transform: scaleY(-1); }
.riss-bl { bottom: 0; left: 0; transform: scale(-1, -1); }
.riss-header { height: var(--h-header); width: 22px; opacity: 0.3; }
.header-brand { line-height: 1.1; display: flex; align-items: center; min-width: 0; }
/* Logo fuellt die volle Topbar-Hoehe und laeuft links buendig aus; max-width statt
   fester Breite, damit es auf schmalen Displays proportional schrumpft statt zu verzerren. */
.header-logo { height: auto; max-height: var(--h-header); max-width: 100%; width: auto; display: block; }

.btn-toggle-sidebar {
    background: linear-gradient(135deg, #ff385c, #ff6b35);
    border: none;
    color: #fff;
    border-radius: 20px;
    padding: 9px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255,56,92,0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-toggle-sidebar:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,56,92,0.45); }

/* Kartenwechsel (mobil) sitzt im Header neben "Podio" - dezenter/dunkler als der
   Podio-Verlauf, damit klar bleibt: das ist Navigation, nicht die Haupt-Aktion.
   Nur auf Mobile sichtbar (siehe @media unten) - Desktop zeigt Liste+Karte gleichzeitig. */
.btn-view-toggle {
    display: none;
    background: #222;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-view-toggle:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.35); }

/* Account-Button - wie .btn-view-toggle optisch, aber im Gegensatz dazu immer sichtbar
   (nicht nur mobil), da Login/Logout auf allen Bildschirmgroessen erreichbar sein muss. */
.btn-account {
    background: #222;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-account:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.35); }

/* Calles-Toggle: nur relevant, wenn die Karte sichtbar ist - auf Mobile also nur in
   der Kartenansicht, auf Desktop immer (siehe @media unten fuer die Desktop-Regel). */
.btn-calles-toggle {
    display: none;
    background: #222;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-calles-toggle:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.35); }
.btn-calles-toggle.active {
    background: linear-gradient(135deg, #ff385c, #ff6b35);
    box-shadow: 0 2px 8px rgba(255,56,92,0.35);
}
body.view-map .btn-calles-toggle { display: inline-flex; align-items: center; }

/* --- Airbnb-style split layout: card list left, map right --- */
.layout {
    position: absolute;
    top: var(--h-topstack); bottom: 0; left: 0; right: 0;
    display: flex;
}

.list-panel {
    width: 42%;
    max-width: 560px;
    min-width: 320px;
    overflow-y: auto;
    padding: 16px 24px 80px;
    border-right: 1px solid #ebebeb;
}
.list-panel-header { margin-bottom: 12px; }
.list-title { font-size: 1.3rem; font-weight: 800; margin: 14px 0 2px; }
.list-subtitle { font-size: 0.85rem; color: #717171; margin-bottom: 4px; }

/* Segmented control: der aktive Zustand traegt den Marken-Verlauf, der inaktive
   bleibt bewusst ruhig, damit klar ist, welcher der beiden gerade gilt. */
.list-mode-toggle {
    display: inline-flex;
    gap: 4px;
    margin-top: 12px;
    padding: 4px;
    background: #f2f2ea;
    border-radius: 20px;
}
.list-mode-btn {
    background: transparent;
    color: #666;
    border: none;
    border-radius: 16px;
    padding: 7px 16px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.list-mode-btn:hover:not(.active) { background: rgba(0,0,0,0.05); color: #333; }
.list-mode-btn.active {
    background: linear-gradient(135deg, #ff385c, #ff6b35);
    color: #fff;
    box-shadow: 0 2px 6px rgba(255,56,92,0.35);
}

.btn-quick-report {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    background: linear-gradient(135deg, #ff385c, #ff6b35);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 12px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255,56,92,0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-quick-report:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255,56,92,0.45); }
.btn-quick-report:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(255,56,92,0.35); }

.offline-pending-badge {
    margin-top: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #8a6d00;
    background: #fff6da;
    border: 1px solid #f0d375;
    border-radius: 10px;
    padding: 6px 10px;
}
.offline-pending-badge.hidden { display: none; }

.pothole-cards { display: flex; flex-direction: column; gap: 18px; }
.cards-loading, .cards-empty { color: #999; font-size: 0.9rem; padding: 20px 0; }

.pothole-card {
    display: flex;
    gap: 12px;
    border-radius: 14px;
    padding: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    border: 1px solid transparent;
}
.pothole-card:hover { background: #f7f7f7; border-color: #ebebeb; }
.pothole-card.active { background: #fff4f0; border-color: #ff385c; }
.pothole-card-rank {
    flex: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #222;
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
}
.pothole-card-thumb {
    flex: none;
    width: 96px; height: 96px;
    border-radius: 10px;
    overflow: hidden;
    background: #f2f2ea;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
}
.pothole-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Gefahren-Illustration statt Foto: anders als beim Foto darf hier nicht
   formatfuellend beschnitten werden (cover), sonst faellt das Schild aus dem
   Bild - daher contain plus Rahmen in der Schwere-Farbe (inline gesetzt). */
.pothole-card-thumb .hazard-thumb-icon {
    object-fit: contain;
    padding: 8px;
    border: 3px solid #212121;
    border-radius: 10px;
    background: #fff;
}
.pothole-card-body { flex: 1; min-width: 0; }
.pothole-card-title { font-weight: 700; font-size: 0.95rem; display: flex; align-items: flex-start; gap: 6px; }
/* Titel ist der Kommentar des Melders - auf zwei Zeilen begrenzen, damit ein langer
   Text die Kartenhoehe nicht sprengt. Der Totenkopf bleibt daneben stehen. */
.pothole-card-title .skull-row { flex: none; margin-top: 1px; }
.pothole-card-title-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pothole-card-street { font-size: 0.8rem; color: #717171; margin-top: 2px; }
.pothole-card-meta { font-size: 0.8rem; color: #555; margin-top: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pothole-card-reactions { font-size: 0.8rem; margin-top: 6px; color: #ff385c; font-weight: 700; }
.pothole-card-fixed { font-size: 0.75rem; color: #8a6d00; margin-top: 4px; }

.map-wrap { position: relative; flex: 1; }
#map { position: absolute; inset: 0; }

.vehicle-marker-icon { transition: transform 0.15s ease, filter 0.15s ease; transform-origin: center bottom; }
.vehicle-marker-icon:hover { transform: scale(1.35); filter: drop-shadow(0 3px 6px rgba(0,0,0,0.45)); z-index: 1000 !important; }
.vehicle-marker-skull {
    width: 100%; height: 100%;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

.vehicle-marker-dot {
    display: block;
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.vehicle-marker-dot.dot-green  { background: #2e7d32; }
.vehicle-marker-dot.dot-yellow { background: #9e9d24; }
.vehicle-marker-dot.dot-orange { background: #f9a825; }
.vehicle-marker-dot.dot-red    { background: #ef6c00; }
.vehicle-marker-dot.dot-black  { background: #212121; }

/* Gefahren-Kategorie-Icon (Kartenmarker): monochrome Silhouette aus img/hazards/,
   per CSS-Maske in der Schwere-Farbe eingefaerbt (background-color kommt inline
   aus VEHICLE_META.color, siehe vehicleDivIcon in app.js). */
.vehicle-marker-hazard {
    display: block;
    width: 100%; height: 100%;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

.pending-pin-icon { transform-origin: center bottom; }
.pending-pin { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); animation: pending-pin-bounce 0.6s ease infinite alternate; }
@keyframes pending-pin-bounce { from { transform: translateY(0); } to { transform: translateY(-4px); } }

.skull-row { display: inline-flex; gap: 2px; vertical-align: middle; }
.skull-icon { display: inline-block; vertical-align: middle; }

.popup-btn-open-editor {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #ff385c, #ff6b35);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255,56,92,0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.popup-btn-open-editor:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,56,92,0.45); }
.popup-btn-open-editor span { transition: transform 0.12s ease; }
.popup-btn-open-editor:hover span { transform: translateX(3px); }

@media (max-width: 900px) {
    .nav-pills { padding: 0 14px; }
    .layout { flex-direction: column; }
    .list-panel {
        width: 100%; max-width: none; min-width: 0;
        border-right: none;
        padding: 12px 14px calc(90px + env(safe-area-inset-bottom));
    }
    .map-wrap { display: none; }
    .btn-view-toggle { display: inline-flex; align-items: center; }

    body.view-map .list-panel { display: none; }
    body.view-map .map-wrap { display: block; flex: 1; }

    /* .btn-locate/.btn-admin sind Kartenwerkzeuge - in der Listenansicht (Standard
       auf Mobile) sinnlos und liegen sonst ueber den unteren Listeneintraegen. */
    body:not(.view-map) .btn-locate,
    body:not(.view-map) .btn-admin,
    body:not(.view-map) .map-search {
        display: none;
    }
}

/* Desktop zeigt Liste+Karte gleichzeitig, `view-map` wird dort nie gesetzt - die
   Calles-Pille muss trotzdem erscheinen, da die Karte immer sichtbar ist. */
@media (min-width: 901px) {
    .btn-calles-toggle { display: inline-flex; align-items: center; }
}

.btn-report {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom)); right: 24px;
    z-index: var(--z-fab);
    width: 60px; height: 60px;
    border-radius: 50%;
    background: #ff6b35;
    color: #fff;
    border: none;
    font-size: 2rem;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: right 0.2s ease;
}
.btn-report:active { transform: scale(0.95); }

/* Sidebar liegt rechts ueber dem Report-Button - solange sie offen ist, wird
   der Button nach links versetzt statt vom Sidebar-Inhalt verdeckt zu werden. */
.sidebar:not(.hidden) ~ .btn-report { right: calc(min(340px, 90vw) + 24px); }

/* Leaflet gibt seinen Control-Containern per Default z-index: 1000. Damit liegen sie
   ueber dem Marker-Popup (Leaflet-Popup-Pane: 700) und verdecken dessen Foto. Die
   Controls gehoeren unter Popup, Header und Panels - dafuer war --z-map-controls
   gedacht, es war nur nirgends angewendet. */
.leaflet-top, .leaflet-bottom {
    z-index: var(--z-map-controls);
}

.btn-admin {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom)); left: 24px;
    z-index: var(--z-fab);
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
}
.btn-admin.active {
    background: #ff6b35;
    color: #fff;
    border-color: #ff6b35;
}

.btn-locate {
    position: fixed;
    bottom: calc(76px + env(safe-area-inset-bottom)); left: 24px;
    z-index: var(--z-fab);
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #fff;
    color: #1e88e5;
    border: 1px solid #1e88e5;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
}
.btn-locate.locating { opacity: 0.6; cursor: wait; }

.map-search {
    position: fixed;
    top: calc(var(--h-topstack) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-fab);
    width: min(320px, calc(100vw - 32px));
}
.map-search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 0.95rem;
    color: #222;
}
.map-search-input:focus { outline: 2px solid #ff6b35; }
.map-search-results {
    list-style: none;
    margin: 6px 0 0;
    padding: 4px 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    max-height: 260px;
    overflow-y: auto;
}
.map-search-results.hidden { display: none; }
.map-search-result {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}
.map-search-result:last-child { border-bottom: none; }
.map-search-result:hover, .map-search-result:active { background: #fff3ee; }
.map-search-result.empty { color: #888; cursor: default; }
.map-search-result.empty:hover { background: #fff; }

.admin-banner {
    position: fixed;
    bottom: calc(78px + env(safe-area-inset-bottom)); left: 24px;
    z-index: var(--z-fab);
    background: #ff6b35;
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    max-width: 200px;
}
.admin-banner.hidden { display: none; }

.sidebar {
    position: fixed;
    top: var(--h-topstack); right: 0; bottom: 0;
    z-index: var(--z-panel);
    width: min(340px, 90vw);
    background: #fff;
    box-shadow: -4px 0 16px rgba(0,0,0,0.15);
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.2s ease;
}
.sidebar.hidden { transform: translateX(100%); }
.sidebar h2 { margin-top: 8px; font-size: 1.2rem; }
.sidebar h3 { font-size: 0.9rem; color: #666; margin-bottom: 8px; }

#sidebar-podium { position: relative; margin: -20px -20px 0; padding: 0 20px 20px; overflow: hidden; }
.podium-jeep-header {
    display: block;
    width: calc(100% + 40px);
    margin: 12px -20px 8px;
    max-height: 130px;
    object-fit: cover;
    object-position: center 35%;
}

.sidebar-editor.hidden { display: none; }
#sidebar-podium.hidden { display: none; }
.sidebar-editor-vehicle { font-size: 1.4rem; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sidebar-editor-street { font-size: 0.85rem; color: #666; margin-top: 2px; }
.sidebar-editor-reason { font-size: 0.9rem; margin: 12px 0; font-style: italic; }
.sidebar-editor-photo { max-width: 100%; border-radius: 10px; margin: 8px 0; }
.sidebar-editor-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid #eee; }
.sidebar-editor-section h3 { margin: 0 0 8px; }

/* Eigenes Loeschen bewusst von "Marcar como reparado" abgesetzt (eigener Abschnitt,
   Rot statt der sonstigen Markenfarbe) - Fehlklicks sollen hier nicht passieren. */
.sidebar-editor-danger-zone { border-top-color: #f3caca; }
.sidebar-editor-btn-delete {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #c00;
    border: 1px solid #c00;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}
.sidebar-editor-btn-delete:hover { background: #fff5f5; }

.sidebar-editor-photo-upload { display: flex; flex-direction: column; gap: 8px; }
.sidebar-editor-photo-upload input[type=file] { border: 1px solid #ddd; border-radius: 8px; padding: 8px; }
.sidebar-editor-photo-upload button { align-self: flex-start; }

.status-menu summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: #444; list-style: none; }
.status-menu summary::-webkit-details-marker { display: none; }
.status-menu summary::before { content: '▸ '; }
.status-menu[open] summary::before { content: '▾ '; }
.status-menu .status-menu-body { margin-top: 8px; }

.comments-block {
    background: #faf9f6;
    border: 1px solid #ebebeb;
    border-radius: 14px;
    padding: 14px;
    margin-left: -14px;
    margin-right: -14px;
    width: calc(100% + 28px);
}
.comments-block h3 { margin-top: 0; }

.comments-sort { display: flex; gap: 6px; margin-bottom: 10px; }
.comments-sort button {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
}
.comments-sort button.active { background: #222; color: #fff; border-color: #222; }

.comment-form-toggle {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #999;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}
.comment-form-toggle:hover { background: #f7f7f7; }
.comment-form-toggle.hidden { display: none; }

.comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.comment-form.hidden { display: none; }

.btn-giphy-toggle { align-self: flex-start !important; padding: 6px 14px !important; border: 1px solid #ddd; border-radius: 999px; background: #fff; color: #212121; font-weight: 700; cursor: pointer; }
.btn-giphy-toggle:hover { background: #f0f0f0; }
.giphy-panel { padding: 8px; border: 1px solid #ddd; border-radius: 8px; background: #f7f7f7; }
.giphy-panel.hidden { display: none; }
.giphy-search { width: 100%; padding: 7px 8px; border: 1px solid #ddd; border-radius: 6px; font: inherit; }
.giphy-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 220px; margin-top: 8px; overflow-y: auto; }
.giphy-result { align-self: stretch !important; padding: 0 !important; border: none; border-radius: 6px; background: none; cursor: pointer; overflow: hidden; }
.giphy-results img { width: 100%; height: 80px; display: block; border-radius: 6px; object-fit: cover; }
.giphy-status { grid-column: 1 / -1; padding: 10px; color: #777; text-align: center; font-size: 0.82rem; }
.giphy-error { color: #b3261e; }
.giphy-attribution { margin-top: 6px; color: #777; text-align: right; font-size: 0.7rem; }
.comment-sticker { width: 72px; height: 72px; display: block; margin-top: 4px; }
.comment-image { max-width: 160px; max-height: 160px; display: block; margin-top: 4px; border-radius: 8px; }
.popup-top-comment-sticker { width: 22px; height: 22px; vertical-align: middle; }
.comment-image-preview { position: relative; display: inline-block; }
.comment-image-preview.hidden { display: none; }
.comment-image-preview img { max-width: 120px; max-height: 120px; display: block; border-radius: 8px; }
.comment-image-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #212121;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}
.comment-form textarea {
    width: 100%;
    min-height: 50px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
}
.comment-form button { align-self: flex-end; padding: 6px 16px; font-size: 0.85rem; }

.comment-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; padding-right: 2px; }
.comment-empty { font-size: 0.85rem; color: #999; padding: 8px 0; }

/* Twitter/X-Style: Avatar links, rechts Name+Zeit oben, Text darunter, Aktionen
   in eigener Zeile am Fuss - statt der frueheren Card-mit-Rahmen-Optik. */
.comment-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.comment-avatar {
    flex: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #e8e8e8;
    color: #555;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.comment-author { font-weight: 700; font-size: 0.88rem; }
.comment-time { font-size: 0.8rem; color: #999; }
.comment-text { font-size: 0.88rem; line-height: 1.35; margin-top: 2px; overflow-wrap: break-word; }
.comment-actions { display: flex; margin-top: 6px; }
.comment-btn-like {
    border: none;
    background: none;
    color: #888;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 14px;
}
.comment-btn-like:hover { background: #ffe9e0; }
.comment-btn-like.active { color: #ff385c; font-weight: 700; }

.stats-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.stat-tile {
    flex: 1 1 calc(50% - 8px);
    background: #f7f7f2;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.stat-tile .stat-value { font-size: 1.3rem; font-weight: 800; }
.stat-tile .stat-label { font-size: 0.7rem; color: #777; }

.podium-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.podium-item {
    padding: 12px 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    border-radius: 8px;
}
.podium-item:hover { background: #f7f7f7; }
.podium-item.active { background: #fff4f0; }
.podium-rank { font-weight: 800; color: #ff6b35; margin-right: 4px; }
.podium-name { font-weight: 700; }
.podium-district { font-size: 0.75rem; color: #888; }
.podium-count { font-size: 0.85rem; margin-top: 2px; }
.podium-tagline { font-size: 0.8rem; color: #666; font-style: italic; margin-top: 2px; }
.podium-loading, .podium-empty { color: #999; font-size: 0.85rem; }

.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal.hidden { display: none; }
.modal-content {
    background: #fff;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}
.modal-content h2 { margin-top: 0; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.field textarea, .field input[type=file], .field input[type=text], .field input[type=password] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
}
.field textarea { min-height: 70px; resize: vertical; }

#auth-form.hidden { display: none; }
.auth-switch { text-align: center; font-size: 0.85rem; color: #666; }
.auth-switch.hidden { display: none; }
.auth-switch-link {
    background: none;
    border: none;
    color: #ff385c;
    font-weight: 700;
    cursor: pointer;
    padding: 0 0 0 4px;
    font-size: 0.85rem;
}

.location-status { font-size: 0.85rem; color: #666; }
.location-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-retry-location {
    border: 1px solid #ccc;
    background: #f7f7f2;
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}
.btn-retry-location.hidden { display: none; }

.photo-buttons { display: flex; gap: 10px; }
/* Sekundaeraktionen: gleiche Pillenform wie die Primaerbuttons, aber ohne Farbflaeche,
   damit sie den "Reportar"-Button darunter nicht ueberstrahlen. */
.btn-photo {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 10px;
    border: 1.5px solid #e4e4e4;
    border-radius: 24px;
    background: #fafafa;
    color: #333;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.btn-photo:hover {
    background: #fff;
    border-color: #ff6b35;
    color: #ff385c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.btn-photo:active { transform: translateY(0); box-shadow: none; background: #f2f2f2; }
.photo-name { margin-top: 6px; font-size: 0.85rem; color: #666; word-break: break-all; }

.severity-options { display: flex; flex-direction: column; gap: 6px; }
.severity-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 2px solid #eee;
    border-radius: 10px;
    cursor: pointer;
}
.severity-option input { margin: 0; }
.severity-option:has(input:checked) { border-color: #ff6b35; background: #fff4ef; }
.sev-icon { font-size: 1.2rem; }
.sev-label { font-weight: 600; font-size: 0.85rem; }

.btn-submit {
    width: 100%;
    padding: 14px;
    background: #ff6b35;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-delete {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background: #fff;
    color: #c00;
    border: 1px solid #c00;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}
.btn-delete.hidden { display: none; }

.popup-admin-actions { margin-top: 8px; display: flex; gap: 8px; }
.popup-admin-actions button {
    border: 1px solid #ddd;
    background: #f7f7f2;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}

.form-error {
    background: #fee;
    color: #c00;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.form-error.hidden { display: none; }
/* #status-field und #chronic-field sind nur im Admin-Edit-Modus gemeint - ohne diese
   Regel greift ihr "hidden" im Markup nirgends und beide waren immer sichtbar. */
.field.hidden { display: none; }

.popup-severity { font-weight: 700; }
.popup-peligro-logo { display: block; width: 100%; max-width: 180px; margin: -4px auto 4px; }
.popup-vehicle { margin-top: 6px; font-size: 1.1rem; display: flex; align-items: center; gap: 6px; }
.popup-vehicle-label { font-size: 0.75rem; color: #666; font-weight: 600; }

/* Gefahren-Kategorie-Illustration (Popup/Sidebar): farbige Grafik aus
   img/hazards_color/, Rahmenfarbe zeigt die Schwere (inline border-color). */
.popup-hazard { margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.hazard-color-icon {
    width: 44px; height: 44px;
    object-fit: contain;
    border: 3px solid #212121;
    border-radius: 10px;
    background: #fff;
    padding: 2px;
}
.popup-hazard-label { font-size: 0.8rem; color: #444; font-weight: 600; }

.popup-reactions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.popup-reactions button {
    border: 1px solid #eee;
    background: #f7f7f2;
    border-radius: 14px;
    padding: 3px 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.popup-reactions button:active { transform: scale(0.95); }
.popup-reactions button.active { background: #ff6b35; border-color: #ff6b35; color: #fff; }
.popup-reactions button.active .reaction-count { color: #fff; }
.popup-reactions .reaction-count { font-size: 0.7rem; color: #777; font-weight: 700; }
.popup-reason { margin: 4px 0; font-size: 0.85rem; }
.popup-street { font-size: 0.8rem; color: #666; }

.popup-top-comment {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #555;
    background: #f7f7f2;
    border-radius: 8px;
    padding: 6px 8px;
    font-style: italic;
}
.popup-top-comment-likes { font-style: normal; color: #ff385c; font-weight: 700; margin-left: 4px; }

.grade-vote { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #ddd; }
.grade-vote-question { font-size: 0.82rem; font-weight: 600; color: #444; margin-bottom: 6px; }
.grade-vote-buttons { display: flex; gap: 8px; }
.grade-vote-btn {
    flex: 1;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 10px;
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.grade-vote-btn.active { background: #222; color: #fff; border-color: #222; }
.grade-vote-count { font-weight: 800; }
.grade-vote-hint { font-size: 0.7rem; color: #999; margin-top: 6px; }

.popup-fixed-badge {
    margin-top: 8px;
    background: #fff8e1;
    color: #8a6d00;
    border: 1px solid #f0d878;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.75rem;
}
.popup-btn-mark-fixed {
    display: block;
    margin-top: 8px;
    width: 100%;
    border: 1px solid #2e7d32;
    background: #f1f9f1;
    color: #2e7d32;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

/* Toast statt alert() - unten mittig, verschwindet nach ein paar Sekunden von allein. */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(90px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(20px);
    z-index: var(--z-toast);
    background: #222;
    color: #fff;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: min(320px, 85vw);
    text-align: center;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: #2e7d32; }
.toast-offline { background: #555; }
.toast-error { background: #c62828; }

/* Banner "Datos guardados - sin conexión" - erscheint wenn loadPotholes() auf den
   localStorage-Fallback zurueckfaellt (siehe app.js). */
.offline-data-banner {
    position: fixed;
    top: calc(var(--h-topstack) + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    background: #fff3cd;
    color: #7a5c00;
    border: 1px solid #ffe08a;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.offline-data-banner.hidden { display: none; }

/* Optimistischer Marker fuer noch nicht hochgeladene Meldungen - halbtransparent,
   bis der echte Marker nach erfolgreichem Upload an seine Stelle tritt. */
.marker-pending { opacity: 0.55; }
.popup-btn-mark-fixed:disabled { opacity: 0.6; cursor: not-allowed; }

/* Rang-Badge im Tab "Mis huecos" - siehe auftrag-rangsystem.txt. */
.rank-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: 12px;
}
.rank-badge.hidden { display: none; }
.rank-badge-emoji { font-size: 1.8rem; line-height: 1; }
.rank-badge-text { display: flex; flex-direction: column; }
.rank-badge-title { font-weight: 700; font-size: 0.9rem; }
.rank-badge-progress { font-size: 0.75rem; color: #7a5c00; }

/* Trophaeen-Popup nach erfolgreichem Post - auffaelliger als der Toast, blockiert
   aber die App nicht (kein alert/confirm, siehe auftrag-rangsystem.txt). */
.trophy-popup {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.trophy-popup.hidden { display: none; }
.trophy-popup-content {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}
.trophy-popup-emoji { font-size: 4rem; line-height: 1; margin-bottom: 8px; }
.trophy-popup-headline { font-weight: 700; font-size: 1.1rem; color: #ff6b35; margin-bottom: 4px; }
.trophy-popup-title { font-weight: 700; font-size: 1.3rem; margin-bottom: 8px; }
.trophy-popup-sub { font-size: 0.9rem; color: #555; margin-bottom: 20px; }
