:root {
    --primary: #2563eb; --success: #22c55e; --danger: #ef4444;
    --bg: #f8fafc; --card: #ffffff;
}
body { 
    font-family: sans-serif; 
    background: var(--bg); 
    padding: 15px; 
    margin: 0;
    overflow-x: hidden; /* Verhindert horizontales Ausbrechen */
    width: 100%;
    box-sizing: border-box;
}
.container { 
    max-width: 800px; 
    margin: 0 auto; 
    width: 100%;
    box-sizing: border-box;
}
form, table { 
    background: var(--card); 
    padding: 15px; 
    border-radius: 12px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto; /* Erlaubt horizontales Scrollen NUR innerhalb der Tabelle, falls nötig */
}
.form-group { margin-bottom: 15px; }
label { display: block; font-weight: bold; margin-bottom: 5px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { 
    display: block;
    width: 100%; 
    max-width: 100%;
    margin: 0; /* Verhindert Standard-Margins von Browsern */
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 6px; 
    box-sizing: border-box; 
    font-family: inherit;
    font-size: 16px; 
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: normal; /* Vereinheitlicht die Höhe */
}
input[type="checkbox"], input[type="radio"] {
    width: auto;
    display: inline-block;
    margin-right: 5px;
}
textarea {
    resize: none;
    overflow-y: hidden;
    min-height: 42px;
}
select {
    appearance: none; /* Entfernt das Standard-Design des Browsers */
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Eigener moderner Dropdown-Pfeil */
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23333' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
    cursor: pointer;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
button { padding: 10px 20px; background: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; }

/* Bild-Vorschau und Lightbox */
.preview-container { margin-top: 10px; }
.preview-img { max-width: 150px; border-radius: 8px; cursor: pointer; border: 2px solid #ddd; transition: transform 0.2s; }
.preview-img:hover { transform: scale(1.05); }

.thumbnail { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid #ddd; vertical-align: middle; }

.modal { 
    display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.8); align-items: center; justify-content: center; flex-direction: column;
}
.modal-content { background: var(--bg); padding: 25px; border-radius: 12px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 5px 20px rgba(0,0,0,0.3); }
.modal-close-form { position: absolute; top: 15px; right: 20px; font-size: 28px; cursor: pointer; color: #666; line-height: 1; }
.modal-close-form:hover { color: var(--danger); }
.modal img { max-width: 95%; max-height: 85%; border-radius: 8px; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.modal-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 40px; font-weight: bold; cursor: pointer; }

table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }

.detail-badge { font-size: 0.7rem; background: #eee; padding: 2px 5px; cursor: help; }
#printSection { display: none; }

@media (max-width: 600px) {
    table { 
        display: block; 
        width: 100%; 
        border: none;
        box-shadow: none;
        padding: 0;
        background: transparent;
        overflow-x: hidden;
    }
    thead { display: none; }
    tbody { display: block; width: 100%; }
    tr { 
        display: block; 
        margin-bottom: 15px; 
        border: 1px solid #e2e8f0; 
        border-radius: 8px; 
        padding: 10px;
        background: var(--card);
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    td { 
        display: flex; 
        justify-content: space-between; 
        align-items: center;
        text-align: right; 
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.95rem;
        word-break: break-word;
    }
    td:last-child { border-bottom: none; }
    td::before { 
        content: attr(data-label); 
        font-weight: bold; 
        color: #475569;
        text-align: left;
        padding-right: 15px;
        flex-shrink: 0;
        max-width: 45%;
    }

    #calendar, #adminCalendar {
        display: none !important;
    }
    .mobile-hint {
        display: block !important;
    }
}