:root {
    --primary-color: #1b4332;   
    --accent-color: #2d6a4f;    
    --bg-color: #f0f2f5;        .flowButton svg, 
    .flowButton span {
        grid-area: stack;             /* Beide belegen denselben Platz */
    }
    
    .flowButton span {
        place-self: end end;          /* Der "Dirty Trick": Schiebt nur das span nach unten rechts */
        font-size: 9px;
        padding: 2px;
        line-height: 1;
    }
    --text-color: #1a1a1a;
    --border-color: #d1d9e0;
    --white: #ffffff;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%; margin: 0; padding: 0;
    font-family: -apple-system, system-ui, sans-serif;
    font-size: 16px; background-color: var(--bg-color);
    color: var(--text-color); overflow: hidden;
    display: flex; flex-direction: column; /* Wichtig für das Layout-Gerüst */
}

header {
    background-color: var(--primary-color);
    /* Wichtig: Safe-Area-Top sorgt für den Abstand zur Notch beim iPhone */
    padding: calc(var(--safe-area-top) + 10px) 15px 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header h1 {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 10px 0 0;
    font-size: 1rem;
    font-weight: 600;
}
#logout-btn {
    flex-shrink: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 6px;
    color: white;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
@media (pointer: fine) {
    #logout-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }
    
    #logout-btn:active {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0.95);
    }
}
@media (pointer: coarse) {
    #logout-btn {
        display: none;
    }
}#app-content {
    flex: 1; overflow-y: auto; padding: 15px;
    -webkit-overflow-scrolling: touch;
}


/* --- FORM SYSTEM (Kompakt) --- */
.formContainer {
    display: flex; flex-wrap: wrap; gap: 8px; /* Weniger Gap spart Platz */
    width: 100%;
}

.formCell {
    display: flex; flex-direction: column; 
    flex: 1 1 calc(50% - 8px); /* 2 Spalten nebeneinander */
    min-width: 140px;
}

/* Volle Breite für Header oder große Felder */
.formCell.full-width, .blockHeader { flex: 1 1 100%; }

/* Versteckte Felder komplett neutralisieren */
.formCell:has(input[type="hidden"]) { display: none; }

.formLabel {
    font-size: 0.7rem; font-weight: 700; color: var(--primary-color);
    margin: 0 0 2px 2px; text-transform: uppercase; opacity: 0.7;
}

.formEditor {
    background: var(--white); border: 1px solid var(--border-color);
    border-radius: 6px; padding: 8px; font-size: 0.95rem;
    color: var(--text-color); outline: none; width: 100%;
}

.formEditor:focus { border-color: var(--accent-color); border-width: 1px; }
input:read-only, 
textarea:read-only {
    background-color: #e9ecef; /* Ein dezentes Hellgrau */
    color: #6c757d;            /* Graue Schriftfarbe für weniger Kontrast */
    cursor: not-allowed;       /* Zeigt das "Verboten"-Symbol beim Hover */
    border-color: #dee2e6;     /* Optional: Rand etwas aufhellen */
}
/* --- FEATURES --- */
.blockHeader {
    font-size: 1rem; font-weight: 600; color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px; margin: 10px 0 5px 0;
}

.flowButton {
    position: fixed; width: 44px; height: 44px; border-radius: 50%;
    background: white; color: black; 
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 2000;
}
.flowButton svg, 
.flowButton span {
    grid-area: stack;             /* Beide belegen denselben Platz */
}
.flowButton span {
    font-size: 1rem;
    padding: 2px;
    line-height: 1;
}
@media (pointer: coarse) {
    .flowButton span {
      display: none;
    }
}

/* --- NAVIGATION & TILES --- */
.pwa-nav {
    background-color: var(--white); border-top: 1px solid var(--border-color);
    display: flex; padding-bottom: var(--safe-area-bottom);
    height: calc(65px + var(--safe-area-bottom)); flex-shrink: 0;
}

.pwa-nav button {
    flex: 1; border: none; background: none; color: #888;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; font-size: 0.8rem;
}

.menu-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); 
    gap: 12px; padding: 10px;
}
.menu-tile {
    display: flex; flex-direction: column; align-items: center;
    background: var(--white); border-radius: 12px; padding: 12px 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.tile-label { margin-top: 6px; font-size: 0.75rem; color: var(--primary-color); text-align: center; }