
#add-team-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background-color: #0f1880;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    z-index: 1000;
}

#add-team-btn:hover {
    background-color: #0056b3;
    transform: scale(1.1);
}

/* Zentrierte Karten */
.card {
    margin: 20px auto;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: fit-content; /* Passt die Breite an den Inhalt an */
    height: fit-content;
    text-align: center;
}

/* Schattierungseffekt beim Hover */
.card:hover {
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}

/* Zentrierter Inhalt */
.content {
    justify-content: center;
    padding: 2px 16px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

/* Zentrierte Boxen */
.flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.box {
    flex: 1;
    margin: 10px;
    min-width: 300px;
    text-align: center;
}

/* Zentrierte Overlays */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

/* Zentrierter Spinner */
#loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Zentrierte Inhalte bei klappbaren Abschnitten */
.content-section {
    display: none;
    padding: 20px;
    text-align: center;
}

.active {
    display: block;
}

.toggle-header {
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-header::before {
    content: '▶';
    margin-right: 8px;
    transition: transform 0.2s ease;
}

.toggle-header.active::before {
    transform: rotate(90deg);
}

/* Zentrierte klappbare Abschnitte */
.collapsible {
    display: none;
    padding: 10px;
    border: none;
    margin: 10px auto;
    border-radius: 5px;
    background-color: #f1f2f2;
    transition: box-shadow 0.3s ease;
    text-align: center;
}

.collapsible:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
/* Multi-Select Dropdown */
.dropdown {
    position: relative;
    width: 250px;
    font-family: Arial, sans-serif;
    margin: 5px;
}

/* Dropdown Toggle Button */
.dropdown-toggle {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    cursor: pointer;
    background: #fff;
    text-align: left;
    position: relative;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.dropdown-toggle::after {
    content: "▼";
    font-size: 12px;
    color: #666;
    transition: transform 0.3s ease;
}

.dropdown.active .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-toggle:hover {
    background: #f9f9f9;
}

/* Dropdown Menu */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%); /* Zentriert das Menü */
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    max-height: 300px; /* ERHÖHT von 200px auf 300px */
    overflow-y: auto;
    z-index: 1000; /* ERHÖHT von 100 auf 1000 */
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2); /* VERSTÄRKT den Schatten */
    opacity: 0;
    transform: translate(-50%, 5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-top: 4px; /* NEU: Kleiner Abstand zum Toggle */
}

.dropdown.active .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Dropdown Menu Items */
.dropdown-menu label {
    display: flex;
    align-items: center;
    padding: 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dropdown-menu label:hover {
    background: #f0f0f0;
}

/* Checkbox Styling */
.dropdown-menu input {
    margin-right: 10px;
    transform: scale(1.2);
}

/* Anzeige der gewählten Optionen */
#selectedValues {
    display: block;
    margin-top: 0px;
    font-size: 12px;
    color: #333;
    text-align: center; /* Zentriert die Anzeige der gewählten Optionen */
}


/* Entfernt jegliche Abstände zwischen den Zellen */
.gridjs-table {
    border-collapse: collapse;
    width: 100%; /* Statt 90% */
    max-width: none; /* max-width entfernen */
    font-size: 12px;
    margin: 0 auto;
}

/* Alle Zellen haben eine klare Gitterstruktur */
.gridjs-td, .gridjs-th {
    border: 1px solid #B0B0B0;
    padding: 0; /* Kein Innenabstand */
    text-align: center;
    height: 100%;
}

/* Kopfzeile */
.gridjs-th {
    background-color: #f8f8f8;
    font-weight: bold;
    padding: 5px;
}

/* Dropdowns ohne abgerundete Ecken, füllen die gesamte Zelle */
.gridjs-td select {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
    padding: 0;
    margin: 0;
    text-align: center;
    appearance: none; /* Entfernt Standard-Styling in Safari/Firefox */
    -webkit-appearance: none; /* Speziell für Safari */
    -moz-appearance: none; /* Speziell für Firefox */
    border-radius: 0px !important; /* Keine runden Ecken */
    outline: none; /* Entfernt den blauen Fokus-Rahmen */
    cursor: pointer;
}

.absence-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5em;
}

.absence-block {
    flex: 0 1 auto;
    display: flex;
    justify-content: center;
}

.dropdown-menu {
    text-align: left;     /* sorgt dafür, dass Texte im Menü links ausgerichtet werden */
    align-items: flex-start; /* bei Flex-Layouts (z. B. .dropdown-menu label { display: flex }) */
  }
  
/* 2) Optional: Stelle sicher, dass auch deine Labels volle Breite nutzen */
.dropdown-menu label {
    width: 100%;
    text-align: left;
}

#submitButtonAvail {
    flex: none !important;    /* verhindert, dass er sich streckt */
    display: block;           /* damit margin: auto greift */
    margin: 1em auto;         /* zentriert ihn horizontal */
  }



.std-btn {
    flex: 1;
    background-color: #0f1880;
    color: white;
    border: none;
    padding: 0.6rem;
    border-radius: 0.5rem;
    cursor: pointer;
}
.std-btn-slim {
    flex: 1;
    background-color: #0f1880;
    color: white;
    border: none;
    padding: 0.4rem;
    border-radius: 0.4rem;
    cursor: pointer;
    width: 100px;
}


.toast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #0f1880;
  color: white;
  padding: 0.8rem 1.2rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  font-size: 1rem;
  opacity: 0.95;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.toast.hidden {
  display: none;
}

/* Team Cards Styling - maximal 2 Karten pro Reihe */
#team-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    max-width: 800px; /* Begrenzt die Breite für maximal 2 Karten */
    gap: 20px;
    padding: 20px 0;
    margin: 0 auto; /* Zentriert den Container */
}

.team-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e9ecef;
    position: relative;
}

.team-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.team-card .card-info {
    padding: 20px;
    background: #0f1880;
    color: white;
    position: relative;
}

.team-card .card-name {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    text-align: center; /* Name zentriert */
}

.team-card .card-meta {
    font-size: 0.9em;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-card .card-meta::before {
    content: "👤";
    font-size: 1em;
}

.team-card .card-actions {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e9ecef;
}

.round-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.edit-btn {
    background: #0f1880; /* Einfarbig in Hausfarbe */
    color: white;
}

.edit-btn:hover {
    background: #1a2a99; /* Etwas heller beim Hover */
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(15, 24, 128, 0.3);
}

.delete-btn {
    background: #0f1880; /* Einfarbig in Hausfarbe */
    color: white;
}

.delete-btn:hover {
    background: #1a2a99; /* Etwas heller beim Hover */
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(15, 24, 128, 0.3);
}

/* Add Team Button - UNVERÄNDERT GELASSEN */
/* Das bestehende Styling für #add-team-btn bleibt wie es war */

/* Team Overlay/Modal Styling */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

#overlay.hidden {
    display: none;
}

#overlay .modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    animation: modalShow 0.2s ease forwards;
}

@keyframes modalShow {
    to {
        transform: scale(1);
    }
}

#overlay h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.5em;
    font-weight: 600;
}

#overlay .form-group {
    margin-bottom: 15px;
}

#overlay label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

#overlay input,
#overlay select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

#overlay input:focus,
#overlay select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#overlay input:disabled {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

#overlay .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    justify-content: flex-end;
}

#overlay button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Toast Notification */
#team_toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    color: white;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#team_toast:not(.hidden) {
    transform: translateX(0);
}

/* Responsive Design für Team Cards */
@media (max-width: 768px) {
    #team-container {
        grid-template-columns: 1fr;
        gap: 15px;
        max-width: 100%; /* Auf mobilen Geräten volle Breite */
    }
    
    .team-card .card-info {
        padding: 15px;
    }
    
    .team-card .card-name {
        font-size: 1.1em;
    }
    
    .team-card .card-actions {
        padding: 12px 15px;
    }
    
    .round-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    #overlay .modal-content {
        padding: 20px;
        margin: 20px;
    }
}

/* Shift Cards Styling - OHNE Änderung der team-card Klasse */
#shift-container .card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#shift-container .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.shift-header {
    background: #0f1880;
    color: white;
    padding: 20px;
}

.shift-header h3 {
    margin: 0 0 10px 0;
    font-size: 1.5em;
    font-weight: 600;
}

.shift-meta {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
}

.shift-meta .priority {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.shift-meta .priority.high {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.shift-meta .priority.normal {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.shift-meta .pause {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Schichtfarben-Spalte */
.shift-table .shift-color-cell {
    text-align: center;
    vertical-align: middle;
    padding: 8px 6px;
    min-width: 80px;
}

.shift-color-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin: 0 auto 4px auto;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shift-name-small {
    font-size: 0.75em;
    color: #6c757d;
    font-weight: 500;
    display: block;
    text-align: center;
    word-break: break-word;
    max-width: 70px;
    margin: 0 auto;
    line-height: 1.2;
}

.shift-table .no-roles {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Shift-Tabellen-Styling */
.shift-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.9em;
}

.shift-table thead {
    background: #f8f9fa;
}

.shift-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.shift-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.shift-table tr:hover {
    background: #f8f9fa;
}

.shift-table .number {
    text-align: center;
    font-weight: 500;
    color: #495057;
}

.shift-table .center {
    text-align: center;
}

.shift-table .slots {
    font-size: 0.85em;
    color: #6c757d;
    max-width: 150px;
}

.shift-table .pre-assigned-cell {
    max-width: 120px;
}

/* Role Badges für Shifts */
.role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
}

.role-badge.doctor {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.role-badge.nurse {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}

.role-badge.orga {
    background: #e8f5e8;
    color: #388e3c;
    border: 1px solid #c8e6c9;
}

.role-badge.pzr {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}

/* Exclusion Indicator für Shifts */
.exclusion {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-weight: bold;
    font-size: 0.8em;
}

.exclusion.yes {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.exclusion.no {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Pre-assigned Names für Shifts */
.pre-assigned {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    margin: 1px 0;
}

/* Responsive Design für Shift-Tabellen */
@media (max-width: 768px) {
    .shift-table {
        font-size: 0.8em;
    }
    
    .shift-table th,
    .shift-table td {
        padding: 8px 4px;
    }
    
    .shift-meta {
        flex-direction: column;
        gap: 8px;
    }
}

/* Card-Actions für Shift-Cards - FEHLTE! */
#shift-container .card .card-actions {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e9ecef;
}

#shift-container .card-actions .round-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: #0f1880; /* Hauptfarbe */
    color: white;
}

#shift-container .card-actions .round-btn:hover {
    background: #1a2a99; /* Etwas heller beim Hover */
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(15, 24, 128, 0.3);
}

/* Add Shift Button - gleicher Stil wie Add Team Button */
#add-shift-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0f1880; /* Hauptfarbe */
    color: white;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 24, 128, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#add-shift-btn:hover {
    background: #1a2a99;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(15, 24, 128, 0.4);
}

#add-shift-btn:active {
    transform: scale(0.95);
}

/* Team-Tabellen-Styling */
.team-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.9em;
}

.team-table thead {
    background: #f8f9fa;
}

.team-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.team-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.team-table tr:hover {
    background: #f8f9fa;
}

.team-table .role-cell {
    text-align: left;
}

.team-table .value-cell {
    text-align: center;
    font-weight: 500;
    color: #495057;
}

/* Role Badges für Team-Cards - erweitert */
.role-badge.zahnarzt,
.role-badge.doctor {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.role-badge.assistentin,
.role-badge.nurse {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}

.role-badge.hygieniker {
    background: #e8f5e8;
    color: #388e3c;
    border: 1px solid #c8e6c9;
}

.role-badge.auszubildender {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}

/* Fallback für unbekannte Rollen */
.role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: capitalize;
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

/* Responsive Design für Team-Tabellen */
@media (max-width: 768px) {
    .team-table {
        font-size: 0.8em;
    }
    
    .team-table th,
    .team-table td {
        padding: 8px 4px;
    }
}

.color-picker-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

.color-picker-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background-color: #95a5a6;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.color-picker-circle:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.field-label {
    font-weight: 600;
    text-align: center;
    margin: 0;
}

.pause-dropdown {
    position: relative;
    width: 100%;
}

.pause-toggle {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.pause-option {
    /* Use a two-column grid so the checkbox column is fixed
       and all checkboxes line up vertically. The name column
       takes the remaining space and is flush-left. */
    display: grid;
    grid-template-columns: 1fr 24px; /* name | checkbox */
    align-items: center;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
}
.pause-option:hover {
    background: #f2f4f7;
}

.pause-option span {
    justify-self: start;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; /* keep names flush-left and prevent shifting */
}

.pause-option input {
    justify-self: end;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #2563eb;
}

.pause-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 0.5rem;
    z-index: 1100;
}

.pause-dropdown-menu.hidden {
    display: none;
}

#roles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 12px;
}

.role-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "name actions"
        "opts opts";
    gap: 8px 10px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.role-name {
    grid-area: name;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
}

.role-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.role-options {
    grid-area: opts;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.role-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    gap: 8px;
    align-items: end;
}

.role-metrics .metric {
    display: grid;
    gap: 4px;
}

.role-metrics .metric label {
    font-size: 12px;
    color: #475467;
}

.role-metrics .metric .num-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    box-sizing: border-box;
}
/* optional: auf schmalen Screens 2-spaltig */
@media (max-width: 520px) {
    .role-metrics { grid-template-columns: repeat(2, minmax(72px, 1fr)); }
}

:root {
  --primary: #0f1880;
}

#shift-overlay .role-remove-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--primary, #0f1880);
  background: rgba(15, 24, 128, 0.08);
  color: var(--primary, #0f1880);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

#shift-overlay .role-remove-btn:hover {
  background: rgba(15, 24, 128, 0.14);
}

#shift-overlay .role-remove-btn:focus-visible {
  outline: 2px solid var(--primary, #0f1880);
  outline-offset: 2px;
}

/* Shift-Overlay Buttons wie Team-Overlay stylen */
#shift-overlay .button-row button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#save-shift-btn {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
}

#save-shift-btn:hover {
    background: linear-gradient(135deg, #00a085, #00b894);
    transform: translateY(-1px);
}

#cancel-shift-btn {
    background: #6c757d;
    color: white;
}

#cancel-shift-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.day-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 8px 12px;
    margin: 6px 0 4px;
}
@media (max-width: 480px) {
    .day-list { grid-template-columns: 1fr; }
}

/* Copy-Overlay Buttons wie Team-/Shift-Overlay */
#overlay-avail-copy .button-row button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#copy-btn-template {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
}

#copy-btn-template:hover {
    background: linear-gradient(135deg, #00a085, #00b894);
    transform: translateY(-1px);
}

#cancel-btn-copy-template {
    background: #6c757d;
    color: white;
}

#cancel-btn-copy-template:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

#overlay-avail-copy .day-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px; /* vertikaler Abstand zwischen Zeilen */
}

#overlay-avail-copy .day-table td {
    padding: 4px 6px;
    vertical-align: middle;
}

/* NEU: bündige Checkboxen im Save-Overlay (Avail) */
#overlay-avail .save-options {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 8px 10px;
    align-items: center;
    margin: 10px 0 12px;
}

#overlay-avail .save-option {
    display: contents; /* erlaubt bündige Ausrichtung in der Grid-Struktur */
}

#overlay-avail .save-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    justify-self: center;
}

#overlay-avail .save-option span {
    line-height: 1.2;
}


.round-auto-btn:hover {
    background-color: #0056b3;
    transform: scale(1.1) rotate(180deg);
}

.round-auto-btn:active {
    transform: scale(0.95) rotate(360deg);
}

/* Warnings Toggle Button */
.warnings-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin: 0; /* kein auto margin mehr */
    width: 220px; /* feste Breite statt max-width */
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    user-select: none;
}

.warnings-toggle:hover {
    background: linear-gradient(135deg, #ff5252, #ff1744);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.warning-text {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.warning-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.warnings-toggle.expanded .warning-arrow {
    transform: rotate(180deg);
}

/* Hidden state - zurück zu display: none */
.warnings-toggle.hidden {
    display: none !important;
}

/* Warnings Container - komplette Überarbeitung */
.warnings-container {
    margin: 0 auto; /* Alle Margins entfernt */
    max-width: 600px;
    background: #fae6e6;
    border-radius: 16px;
    padding: 16px;
    color: #c62828;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.1);
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-bottom: 0 !important; /* Erzwingt kein bottom margin */
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    margin-top: 0 !important;
}

.warnings-container.show {
    max-height: 400px;
    opacity: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    pointer-events: auto;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.warnings-container.hidden {
    display: none;
    margin-bottom: 0 !important; /* Sicherheit */
}

/* Working Hours Toggle - Blau */
.working-hours-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin: 0; /* kein auto margin mehr */
    width: 220px; /* feste Breite statt max-width */
    background: linear-gradient(135deg, #5c7cfa, #4c6ef5);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(92, 124, 250, 0.3);
    user-select: none;
}

.working-hours-toggle:hover {
    background: linear-gradient(135deg, #4c6ef5, #3b5bdb);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(92, 124, 250, 0.4);
}

.working-hours-text {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.working-hours-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.working-hours-toggle.expanded .working-hours-arrow {
    transform: rotate(180deg);
}

.working-hours-toggle.hidden {
    display: none !important;
}

/* Working Hours Container - Blau */
.working-hours-container {
    margin: 0 auto;
    max-width: 600px;
    background: #e7f0ff;
    border-radius: 16px;
    padding: 16px;
    color: #1e40af;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(92, 124, 250, 0.1);
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-bottom: 0 !important;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    margin-top: 0 !important;
}

.working-hours-container.show {
    max-height: 400px;
    opacity: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    pointer-events: auto;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.working-hours-container.hidden {
    display: none;
    margin-bottom: 0 !important;
}

/* Scrollbar für Working Hours */
.working-hours-container::-webkit-scrollbar {
    width: 8px;
}

.working-hours-container::-webkit-scrollbar-track {
    background: rgba(92, 124, 250, 0.1);
    border-radius: 10px;
}

.working-hours-container::-webkit-scrollbar-thumb {
    background: rgba(92, 124, 250, 0.3);
    border-radius: 10px;
}

.working-hours-container::-webkit-scrollbar-thumb:hover {
    background: rgba(92, 124, 250, 0.5);
}

.working-hours-container p {
    margin: 8px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

/* Styling für Scrollbar (Webkit-Browser) */
.warnings-container::-webkit-scrollbar {
    width: 8px;
}

.warnings-container::-webkit-scrollbar-track {
    background: rgba(255, 205, 210, 0.3);
    border-radius: 4px;
}

.warnings-container::-webkit-scrollbar-thumb {
    background: rgba(198, 40, 40, 0.5);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.warnings-container::-webkit-scrollbar-thumb:hover {
    background: rgba(198, 40, 40, 0.7);
}

/* Fallback für Firefox */
.warnings-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 40, 40, 0.5) rgba(255, 205, 210, 0.3);
}

.warnings-container p {
    margin: 8px 0;
    padding: 8px 12px;
    background: rgb(250, 245, 245);
    border-radius: 8px;
    border: 1px solid #f44336;
}

.warnings-container p:first-child {
    margin-top: 0;
}

.warnings-container p:last-child {
    margin-bottom: 0;
}

/* Control Panel Styling */
.control-panel {
    max-width: 900px;
    margin: 10px auto;
    overflow: visible; /* GEÄNDERT: von hidden zu visible */
    position: relative; /* NEU: für Dropdown-Positioning */
    padding-bottom: 20px; /* NEU: Extra Platz unten */
}

.control-panel.hidden {
    display: none;
}

/* Panel Header */
.panel-header {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    padding: 20px;
}

.current-selection h3 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 500;
    text-align: center;
}

.day-navigation {
    display: flex;
    align-items: center;
    gap: 5px; /* Reduziert von 15px auf 5px */
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 14px;
    background: rgb(255, 254, 254);
    color: rgb(122, 122, 122);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.nav-btn span {
    font-size: 18px;
    font-weight: bold;
}

.nav-btn small {
    font-size: 10px;
    opacity: 0.8;
}

.current-day {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.2em;
    font-weight: 600;
}

/* Panel Sections */
.panel-section {
    padding: 0px;
    overflow: visible; /* NEU: für Dropdown */
    position: relative; /* NEU: für Dropdown */
}

.panel-section:last-child {
    border-bottom: none;
}

.section-title {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
}

.current-day-ref {
    color: #0f1880;
    font-weight: 700;
}

/* Absence Controls */
.absence-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    overflow: visible; /* NEU: für Dropdown */
    position: relative; /* NEU: für Dropdown */
}

/* Wrapper für alle Dropdown-Sections */
.dropdowns-wrapper {
    margin-bottom: 12px; /* Abstand zum SUBMIT Button */
}

.absence-group {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    margin: 0; /* NEU: Kein zusätzlicher Margin */
    overflow: visible; /* NEU: für Dropdown */
    position: relative; /* NEU: für Dropdown */
}

/* Enhanced Dropdown Styling */
.absence-group .dropdown {
    width: 80%;
    z-index: 100; /* Stellt sicher, dass Dropdown über anderen Elementen liegt */
}

.absence-group .dropdown-toggle {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
    color: #495057;
    font-weight: 500;
    transition: all 0.3s ease;
}

.absence-group .dropdown-toggle:hover {
    border-color: #0f1880;
    background: white;
}

.absence-group .dropdown.active .dropdown-toggle {
    border-color: #0f1880;
    background: white;
    box-shadow: 0 0 0 3px rgba(15, 24, 128, 0.1);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
}

/* Toggles nebeneinander */
.toggles-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 0; /* removed extra gap so containers can align directly beneath */
    padding: 0; /* remove internal padding so toggle sits flush */
}

/* Ensure the panel-section that contains the toggles has no padding so the
   absolute-positioned containers below start exactly at the toggle's bottom. */
.panel-section.toggles-section {
    padding: 0 !important;
    margin-bottom: 20px; /* Größerer Abstand zu den Dropdowns darunter */
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toggles-section .warnings-toggle,
.toggles-section .working-hours-toggle {
    margin: 0 !important;
    flex: 0 0 220px; /* feste Breite, kein grow/shrink */
}

/* Container fullwidth */
.warnings-container-section,
.working-hours-container-section {
    width: 100%;
    position: relative;
    padding: 0; /* remove panel-section default padding to avoid tiny offset */
    margin: 0;
}

.panel-section .warnings-toggle {
    margin: 0;
}

.panel-section .working-hours-toggle {
    margin: 0;
}

.panel-section .warnings-container {
    margin: 0;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    margin-top: 0 !important;
}

.panel-section .working-hours-container {
    margin: 0;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    margin-top: 0 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .day-navigation {
        flex-direction: column;
        gap: 5px;
    }
    
    .absence-controls {
        flex-direction: column;
    }
    
    .absence-group {
        max-width: none;
    }
    
    .nav-btn {
        min-width: 120px;
    }
    
    .panel-header {
        padding: 15px;
    }
    
    .panel-section {
        padding: 5px;
    }
}

/* Animationen */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-panel:not(.hidden) {
    animation: slideIn 0.5s ease;
}

/* Container für Plan + Control Panel */
.plan-workspace {
    max-width: 95%;
    width: 100%;
    margin: 20px auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: visible; /* Bleibt visible */
    border: 1px solid #cbcaca;
    position: relative; /* NEU: für absolute positioning im Inneren */
}

/* Plan Header - direkt über der Tabelle */
.plan-header {
    background: #faf8f8;
    color: rgb(80, 80, 80);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dcdbdb;
    border-radius: 20px 20px 0 0;
}

.plan-title {
    flex: 1;
}

.plan-title h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.plan-subtitle {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 400;
}

.day-navigation {
    display: flex;
    align-items: center;
    gap: 5px; /* Reduziert von 15px auf 5px */
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 14px;
    background: rgb(255, 254, 254);
    color: rgb(122, 122, 122);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.nav-btn span {
    font-size: 18px;
    font-weight: bold;
}

.nav-btn small {
    font-size: 10px;
    opacity: 0.8;
}

.current-day {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.2em;
    font-weight: 600;
}

/* Tabellen-Container */
.plan-table-container {
    padding: 0;
    background: #fafbfc;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto; /* Horizontales Scrollen erlauben wenn nötig */
    overflow-y: visible;
}

/* Responsive Design für größere Bildschirme */
@media (min-width: 1400px) {
    .plan-workspace {
        max-width: 1400px;
    }
}

@media (min-width: 1600px) {
    .plan-workspace {
        max-width: 1600px;
    }
}

/* Responsive Design für mittlere Bildschirme */
@media (max-width: 768px) {
    .plan-workspace {
        max-width: 98%;
        margin: 10px auto;
        border-radius: 12px;
    }
    
    .plan-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .day-navigation {
        width: 100%;
        justify-content: center;
    }
    
    .plan-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Dropdown Menu - ERWEITERT */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%); /* Zentriert das Menü */
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    max-height: 300px; /* ERHÖHT von 200px auf 300px */
    overflow-y: auto;
    z-index: 1000; /* ERHÖHT von 100 auf 1000 */
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2); /* VERSTÄRKT den Schatten */
    opacity: 0;
    transform: translate(-50%, 5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-top: 4px; /* NEU: Kleiner Abstand zum Toggle */
}

.dropdown.active .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Spezielle Regel für Avail-Bereich Dropdown */
#avail-control-panel .dropdown-menu {
    max-height: 400px; /* Noch größer für mehr Personen */
    min-width: 250px; /* Mindestbreite für bessere Lesbarkeit */
}

/* Verhindert, dass der Control Panel den Dropdown abschneidet */
#plan-control-panel,
#avail-control-panel {
    overflow: visible !important;
    position: relative;
    z-index: 50; /* Niedriger als Dropdown selbst */
}

/* Styling für Scrollbar im Dropdown (Webkit-Browser) */
.dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Fallback für Firefox */
.dropdown-menu {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}
}

#template-selector,
#plan-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

#template-selector select,
#plan-selector select,
#template-selector-avail select {
    min-width: 200px;
    padding: 6px 6px;  /* Reduziert von 8px 12px */
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
}
#load-published-btn,
#template-selector button,
#plan-selector button,
#loadTemplateButtonAvail {
    padding: 6px 8px;  /* Reduziert von 8px 16px */
    background-color: #00a085;
    
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 12px;
}

#template-selector button:hover,
#plan-selector button:hover,
#loadTemplateButtonAvail:hover {
    background-color: #00b894;
}

/* Additional Controls - Same Styling as Absence Controls */
#additional-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    overflow: visible;
    position: relative;
}

#additional-controls .absence-group {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    overflow: visible;
    position: relative;
}

#additional-controls .dropdown {
    width: 80%;
    z-index: 50;
}

#additional-controls .dropdown-toggle {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
    color: #495057;
    font-weight: 500;
    transition: all 0.3s ease;
}

#additional-controls .dropdown-toggle:hover {
    border-color: #0f1880;
    background: white;
}

#additional-controls .dropdown.active .dropdown-toggle {
    border-color: #0f1880;
    background: white;
    box-shadow: 0 0 0 3px rgba(15, 24, 128, 0.1);
}
