body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    margin: 0;
    padding: 0;
    /* Wichtig: Wir entfernen hier alle Flexbox- und Höhen-Eigenschaften,
       damit der Browser "Pull-to-Refresh" wieder uneingeschränkt erlaubt. */
}

.app-container {
    /* === START: DIE ENTSCHEIDENDE ÄNDERUNG === */
    /* Wir nehmen den Container aus dem normalen Fluss und nageln ihn
       an den Bildschirmrändern fest. */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto;
    /* Zentriert den Container, falls der Bildschirm breiter ist */
    /* === ENDE: DIE ENTSCHEIDENDE ÄNDERUNG === */

    width: 100%;
    max-width: 640px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: white;
    /* Die innere Flexbox-Struktur bleibt erhalten */
    display: flex;
    flex-direction: column;
}

.main-content {
    flex-grow: 1;
    /* Füllt den verfügbaren Platz zwischen Header und Footer */
    overflow-y: auto;
    /* Erlaubt NUR diesem Bereich zu scrollen */
    min-height: 0;
    /* Ein wichtiger Flexbox-Fix, der das Schrumpfen erlaubt */
    padding: 1rem;
    box-sizing: border-box;
    background-color: #f7f7f9;
}

.card {
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid white;
    width: 1.25rem;
    height: 1.25rem;
    animation: spin 1s linear infinite;
    display: none;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.fullscreen-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.fullscreen-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.fullscreen-loading-spinner {
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 6px solid white;
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
}

.fullscreen-loading-text {
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.view {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.view.active {
    display: flex;
}

.user-active-toggle:checked~.dot {
    transform: translateX(100%);
    background-color: #ef4444;
    /* Rot */
}

.user-active-toggle:checked~.block {
    background-color: #fca5a5;
    /* Hellrot */
}

@keyframes blink-border {
    0% {
        border-color: #3b82f6;
    }

    /* Blau */
    50% {
        border-color: #bfdbfe;
    }

    /* Hellblau */
    100% {
        border-color: #3b82f6;
    }

    /* Blau */
}

.blink-border-blue {
    border: 2px solid #3b82f6;
    animation: blink-border 1.5s infinite;
    padding: 0.5rem;
    /* Etwas Innenabstand, damit der Rahmen gut aussieht */
    border-radius: 0.5rem;
    /* Abgerundete Ecken */
}

@keyframes pushmail-siren {
    0%, 49% {
        background-color: #dc2626;
    }

    50%, 100% {
        background-color: #f97316;
    }
}

.pushmail-siren {
    animation: pushmail-siren 0.8s infinite;
}

.btn-gray-acknowledged {
    background-color: #9ca3af;
    /* Tailwind gray-400 */
    color: white;
    font-weight: 600;
}

.btn-gray-acknowledged:hover {
    background-color: #6b7280;
    /* Tailwind gray-500 */
}

/* --- ZAHLUNGSVERWALTUNG STYLES --- */

/* NEU: Styling für die Gruppen-Überschriften in Dropdowns (Fett & Farbig) */
optgroup {
    font-weight: 900 !important;
    background-color: #e0e7ff; /* Helles Indigo */
    color: #3730a3; /* Dunkles Indigo */
    font-style: normal;
}
option {
    background-color: white;
    color: black;
    font-weight: normal;
    padding: 4px;
}

/* Status Farben */
.payment-status-open {
    background-color: #fee2e2;
    /* Red-100 */
    color: #991b1b; /* Red-800 */
}
.payment-status-pending {
    background-color: #fef3c7;
    /* Amber-100 */
    color: #92400e; /* Amber-800 */
}
.payment-status-paid {
    background-color: #dcfce7;
    /* Green-100 */
    color: #166534; /* Green-800 */
}

/* Druck-Ansicht: Versteckt alles außer dem Modal-Inhalt, wenn gedruckt wird */
@media print {
    body * {
        visibility: hidden;
    }
    #paymentDetailModal, #paymentDetailModal * {
        visibility: visible;
    }
    #paymentDetailModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white;
        box-shadow: none;
    }
    /* Verstecke Knöpfe beim Drucken */
    .no-print {
        display: none !important;
    }
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ========================================
   FILTER & KATEGORIEN: Zweibox-Layout
   ======================================== */
.filterbox-panel {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #64748b;
    border-radius: 0.75rem;
    padding: 0.75rem;
}

.kategorienbox-panel {
    background: #fffbeb;
    border: 1px dashed #f59e0b;
    border-left: 4px solid #f59e0b;
    border-radius: 0.75rem;
    padding: 0.75rem;
}

.filter-box-title,
.kategorien-box-title {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.filter-box-title {
    color: #475569;
}

.kategorien-box-title {
    color: #b45309;
}

/* ========================================
   HAUSHALTSZAHLUNGEN: Scrollbar immer sichtbar
   ======================================== */

/* Für die Haushaltszahlungen-Ansicht: Scrollbar immer anzeigen */
#haushaltszahlungenView {
    overflow-y: auto !important;
    scrollbar-gutter: stable;
}

/* Scrollbar-Styling für Webkit-Browser (Chrome, Safari, Edge) */
#haushaltszahlungenView::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#haushaltszahlungenView::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

#haushaltszahlungenView::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

#haushaltszahlungenView::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Für Firefox */
#haushaltszahlungenView {
    scrollbar-width: auto;
    scrollbar-color: #888 #f1f1f1;
}

/* Tabellen-Container mit sichtbarer Scrollbar */
#haushaltszahlungenView .overflow-x-auto {
    overflow-x: auto !important;
    scrollbar-gutter: stable;
}

#haushaltszahlungenView .overflow-x-auto::-webkit-scrollbar {
    height: 8px;
}

#haushaltszahlungenView .overflow-x-auto::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 4px;
}

#haushaltszahlungenView .overflow-x-auto::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

#haushaltszahlungenView .overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Main-Content Scrollbar für PC immer sichtbar */
@media (min-width: 768px) {
    .main-content {
        overflow-y: scroll !important; /* Scrollbar immer anzeigen */
        scrollbar-width: auto;
        scrollbar-color: #888 #f1f1f1;
    }
    
    .main-content::-webkit-scrollbar {
        width: 12px;
        display: block !important;
    }
    
    .main-content::-webkit-scrollbar-track {
        background: #e5e7eb;
        border-radius: 0;
    }
    
    .main-content::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #9ca3af 0%, #6b7280 100%);
        border-radius: 6px;
        border: 2px solid #e5e7eb;
        min-height: 40px;
    }
    
    .main-content::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, #6b7280 0%, #4b5563 100%);
    }
    
    .main-content::-webkit-scrollbar-button {
        display: none;
    }
}

/* Scrollbar auch auf kleineren Bildschirmen sichtbar wenn nötig */
.main-content {
    overflow-y: scroll;
}

/* Gästelink: keine erzwungene leere Haupt-Scrollbar */
.main-content.guest-main-content {
    overflow-y: auto !important;
    scrollbar-gutter: auto !important;
    scrollbar-width: none;
}

.main-content.guest-main-content::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

#entranceView {
    gap: 0.25rem;
    margin: -0.35rem;
}

.gardena-valve-name {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    line-height: 1.1;
}

.gardena-status-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.gardena-led {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 9999px;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 10px currentColor;
}

.gardena-led--green {
    color: #10b981;
    background: #10b981;
}

.gardena-led--red {
    color: #ef4444;
    background: #ef4444;
}

.gardena-led--amber {
    color: #f59e0b;
    background: #f59e0b;
}

.gardena-led--slate {
    color: #94a3b8;
    background: #94a3b8;
}

.gardena-led--blink {
    animation: gardenaLedPulse 1.2s ease-in-out infinite;
}

@keyframes gardenaLedPulse {
    0%,
    100% {
        opacity: 0.35;
        transform: scale(0.95);
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 6px currentColor;
    }
    50% {
        opacity: 1;
        transform: scale(1.08);
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 14px currentColor;
    }
}

#gardenaEntranceSection .loading-spinner,
#gardenaDurationModal .loading-spinner {
    margin-left: 0;
}

#gardenaDurationModal > div {
    max-height: min(90vh, 42rem);
    overflow-y: auto;
}

@media (max-width: 640px) {
    #gardenaDurationModal > div {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}