:root {
    --primary: #007aff; /* Modernes App-Blau */
    --success: #34c759; /* Apple Grün */
    --danger: #ff3b30;  /* Apple Rot */
    --warning: #ffcc00;
    --text: #1d1d1f;    /* Weiches Schwarz */
    --gray: #86868b;
    --bg: #f5f5f7;      /* Edles Hellgrau für den Hintergrund */
    --card-bg: #ffffff;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 100px; /* Platz für die Bottom Navigation */
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

/* =========================================
   1. BOTTOM NAVIGATION (MILCHGLAS-EFFEKT)
   ========================================= */
.navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)) 0;
    z-index: 1000;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.04);
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray);
    font-size: 0.75rem;
    font-weight: 600;
    gap: 6px;
    transition: transform 0.1s;
}

.nav-link .nav-icon {
    font-size: 1.4rem;
    /* 🔥 NEU: Volle Farbe, aber leicht transparent für den modernen Look */
    filter: opacity(0.4); 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link.active .nav-icon {
    /* 🔥 NEU: Volle Deckkraft und das Icon springt leicht nach oben */
    filter: opacity(1);
    transform: scale(1.25) translateY(-3px); 
}

.nav-link.active .nav-icon {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.15); /* Icon wird leicht größer, wenn aktiv */
}

/* =========================================
   2. DER MAGISCHE RIESEN-BUTTON
   ========================================= */
.btn-in, .btn-out {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 30px auto;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent; /* Verhindert das blaue Flackern beim Tippen */
}

/* Die Klick-Animation (fühlt sich physisch an) */
.btn-in:active, .btn-out:active {
    transform: scale(0.92);
}

.btn-in {
    background: linear-gradient(135deg, #34c759 0%, #28a745 100%);
    box-shadow: 0 20px 40px rgba(52, 199, 89, 0.3);
}

.btn-out {
    background: linear-gradient(135deg, #ff3b30 0%, #dc3545 100%);
    box-shadow: 0 20px 40px rgba(255, 59, 48, 0.3);
}

/* DER LOGIK-TRICK: Ausblenden der inaktiven Buttons ohne JS! */
.btn-in:disabled, .btn-out:disabled {
    display: none !important;
}

/* =========================================
   3. EINGABEFELDER & TEXT
   ========================================= */
input[type="email"], input[type="password"], input[type="text"], input[type="date"], select {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.1);
    background: var(--card-bg);
    font-size: 1rem;
    box-sizing: border-box;
    margin-bottom: 12px;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; /* Entfernt Standard-iOS-Styling */
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* 🔥 Mindestschrift 16px für ALLE Eingabefelder (auch number, time, textarea).
   Grund: iOS/Safari zoomt beim Antippen automatisch in die Seite hinein, wenn die Schrift
   kleiner als 16px ist. Früher hat "user-scalable=no" das unterdrückt – das wurde entfernt
   (Pinch-Zoom, WCAG 1.4.4), deshalb muss die Schriftgröße das jetzt selbst verhindern. */
input, select, textarea {
    font-size: 16px;
}

/* =========================================
   TOUCH-ZIELE (mind. 44x44px, WCAG 2.5.5)
   =========================================
   .icon-btn  – kleine Symbol-Schaltflächen (✏️ 🗑️ ✖) in Listen
   .aktion-btn – Text-Schaltflächen in Button-Reihen
   Vorher hatten diese Buttons 4–8px Innenabstand und lagen direkt nebeneinander –
   auf dem Handy zu klein und mit hoher Gefahr, versehentlich Löschen zu treffen. */
.icon-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
}

/* =========================================
   KOPFZEILE MITARBEITER-KARTE (Stunden, Admin)
   =========================================
   Links der Name, rechts die Kennzahlen-Box. Die Box braucht ihre ~155px, sonst
   brechen "STUNDENKONTO" und der Wert ineinander. Auf schmalen Geräten (<380px)
   bleibt daneben zu wenig für den Namen – dort stapeln wir beides untereinander,
   sonst läuft die Zeile über den rechten Rand hinaus. */
.ma-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.ma-stats {
    background: white;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid #e5e5ea;
    line-height: 1.3;
    min-width: 155px;
    box-sizing: border-box; /* 155px inkl. Polster statt zzgl. – spart 30px */
}

@media (max-width: 380px) {
    .ma-kopf { flex-direction: column; align-items: stretch; }
    .ma-stats { width: 100%; }
}

.aktion-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    padding: 6px 12px;
    text-align: center;
}

.btn-login {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(0, 122, 255, 0.2);
}
.btn-login:active {
    transform: scale(0.96);
}

/* =========================================
   4. UHRZEIT & KARTEN
   ========================================= */
.clock-display {
    font-size: 4rem; /* Riesige, klare Uhrzeit */
    font-weight: 800;
    font-variant-numeric: tabular-nums; /* Zahlen springen nicht beim Ticken */
    margin: 10px 0;
    letter-spacing: -2px;
}

.date-text {
    font-size: 0.95rem;
    color: var(--gray);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* =========================================
   5. KALENDER & DIENSTPLAN (HANDY-FIX)
   ========================================= */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.calendar-day {
    background: var(--card-bg);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    padding: 8px 4px;
    text-align: center;
    min-height: 80px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    /* 🔥 DER WICHTIGSTE BEFEHL: Zwingt die Box, auf dem Display zu bleiben */
    min-width: 0; 
    overflow: hidden;
    box-sizing: border-box;
}

/* Im Mehrfachmodus angetippter Tag. Bewusst kräftig, damit auf einen Blick
   erkennbar ist, was beim Speichern angelegt wird. */
.calendar-day.tag-gewaehlt {
    background: #eaf4ff;
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.calendar-day.tag-gewaehlt .day-number {
    color: var(--primary);
    font-weight: 800;
}

.shift-badge {
    font-size: 0.65rem; /* Perfekte Lesbarkeit für Handys */
    color: white;
    padding: 5px 4px;
    border-radius: 6px;
    margin-top: 5px;
    font-weight: 800;
    line-height: 1.1;
    /* 🔥 SCHUTZWAND FÜR LANGE NAMEN: Schneidet ab und setzt ... */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.day-number {
    display: block;
    font-size: 0.8rem;
    color: var(--text);
    margin-bottom: 5px;
}

/* =========================================
   🔥 ADMIN COCKPIT DESIGN (EINSTELLUNGEN)
   ========================================= */

.admin-cockpit-wrapper {
    max-width: 1600px; 
    margin: 0 auto;
    padding: 20px;
}

/* NEU: Das fließende Spalten-Layout (Masonry) */
.cockpit-grid {
    column-count: 3; /* 3 Spalten auf sehr großen Monitoren */
    column-gap: 25px; /* Abstand zwischen den Spalten */
    margin-top: 20px;
}

/* Die einzelnen Boxen */
.cockpit-panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    border-top: 5px solid var(--primary);
    
    /* NEU: Zwingt die Box zusammenzubleiben und gibt Abstand nach unten */
    break-inside: avoid; 
    margin-bottom: 25px; 
}

.cockpit-panel h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* NEU: Responsive Anpassung je nach Bildschirmgröße */
@media (max-width: 1200px) {
    .cockpit-grid {
        column-count: 2; /* Nur 2 Spalten auf normalen Laptops */
    }
}

@media (max-width: 768px) {
    .cockpit-grid {
        column-count: 1; /* Alles brav untereinander auf dem Handy */
    }
}

/* =========================================
   🪄 COCKPIT KLAPP-FUNKTION (ACCORDION)
   ========================================= */

/* Wenn das Panel die Klasse 'collapsed' hat, verstecke alles AUSSER der Überschrift */
.cockpit-panel.collapsed > *:not(h3) {
    display: none;
}

/* Mach die Überschrift klickbar wie einen Button */
.cockpit-panel h3 {
    cursor: pointer;
    user-select: none; /* Verhindert, dass der Text beim schnellen Klicken blau markiert wird */
    margin-bottom: 20px;
    transition: margin 0.2s;
}

/* Wenn das Panel zu ist, braucht die Überschrift keinen Abstand nach unten */
.cockpit-panel.collapsed h3 {
    margin-bottom: 0;
}