:root {
    /* --- Globale Theme-Farben (Modernisiertes Standard-Theme) --- */
    --theme-primary: #4f46e5;
    --theme-primary-hover: #4338ca;
    --theme-secondary: #f97316;
    --theme-secondary-hover: #ea580c;
    --theme-nav-bg: #0f172a;
    --theme-nav-active: #1e293b;
    --theme-bg-color: #f8fafc;

    /* --- Funktionale Zuweisungen --- */
    --primary-color: var(--theme-primary);
    --primary-hover: var(--theme-primary-hover);
    --nav-bg: var(--theme-nav-bg);
    --nav-active: var(--theme-nav-active);
    --sub-header-bg: var(--primary-color);
    --bg-color: var(--theme-bg-color);

    --card-bg: #ffffff;
    --text-color: #0f172a;
    --text-light: #64748b;
    --orange-btn: var(--theme-secondary);
    --orange-btn-hover: var(--theme-secondary-hover);
    --danger-color: #ef4444;
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* --- Basis-Formulare --- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.875rem; color: #334155; }
.form-control { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; background-color: #fff; transition: border-color 0.2s, box-shadow 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; font-weight: 500; border: 1px solid transparent; padding: 0.75rem 1.25rem; font-size: 0.95rem; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.btn-primary { color: #fff; background-color: var(--primary-color); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-danger { color: #fff; background-color: var(--danger-color); box-shadow: var(--shadow-sm); }
.btn-orange { background: var(--orange-btn); color: white; border: none; border-radius: 999px; padding: 0.875rem 1.5rem; font-size: 1rem; font-weight: 600; cursor: pointer; width: 100%; text-align: center; box-shadow: 0 4px 10px rgba(249, 115, 22, 0.25); transition: all 0.2s ease; }
.btn-orange:hover { background: var(--orange-btn-hover); color: white; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(249, 115, 22, 0.3); }
.btn-orange:active { transform: translateY(0); }
.btn-secondary { color: #475569; background-color: #f1f5f9; border: 1px solid #cbd5e1; box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background-color: #e2e8f0; color: #0f172a; }

/* --- App Layout (Navigation) --- */
.top-nav {
    background-color: var(--nav-bg);
    padding: 0 1rem;
    position: relative;
    z-index: 1000;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    justify-content: space-between; 
    width: 100%;
    min-height: 64px; 
}

.nav-brand {
    display: flex;
    align-items: center;
    padding-right: 2rem;
}

/* Der Hamburger-Button (wird nur auf Mobile angezeigt) */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    align-items: center;
    padding: 0.5rem;
    transition: color 0.2s;
}
.mobile-menu-toggle:hover, .mobile-menu-toggle:focus {
    color: #ffffff;
    outline: none;
}

.nav-menu {
    display: flex;
    flex-grow: 1;
    align-items: stretch;
}

.nav-group {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: stretch;
}

/* Schiebt den Account-Link ganz nach rechts */
.nav-group:last-child {
    margin-left: auto; 
}

.nav-group li {
    display: flex;
    align-items: stretch;
}

.nav-group a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 0 1.25rem;
    display: flex;
    align-items: center; 
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 3px solid transparent; 
}

.nav-group a:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-group a.active {
    color: #fff;
    border-bottom-color: var(--theme-secondary);
}

/* --- Responsive Navigation (Hamburger Menü) --- */
@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: flex; 
    }
    
    .nav-menu {
        display: none; 
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--nav-bg);
        padding: 1rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    }

    .nav-menu.active {
        display: flex; 
    }

    .nav-group {
        flex-direction: column;
        width: 100%;
    }

    .nav-group:last-child {
        margin-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }

    .nav-group a {
        padding: 1rem 1.5rem;
        border-bottom: none;
        border-left: 4px solid transparent; 
    }

    .nav-group a.active {
        border-bottom-color: transparent;
        border-left-color: var(--theme-secondary);
        background-color: rgba(255, 255, 255, 0.05);
    }

    .account-dropdown {
        flex-direction: column;
        align-items: stretch;
    }

    .account-link {
        color: #fff !important;
        pointer-events: none; 
        font-weight: 700 !important;
        background: transparent !important;
    }

    .account-dropdown-content {
        display: block !important;
        position: static;
        box-shadow: none;
        background-color: transparent;
        border: none;
        padding-left: 1rem;
    }

    .account-dropdown-content a {
        color: #cbd5e1 !important;
        border: none !important;
        padding: 0.75rem 1.5rem !important;
    }

    .account-dropdown-content a:hover {
        background-color: rgba(255, 255, 255, 0.05) !important;
        color: #fff !important;
    }
}

/* --- Sub-Header (Das Datum) --- */
.sub-header { background-color: var(--sub-header-bg); color: white; padding: 1.5rem 1rem; box-shadow: inset 0 -1px 0 0 rgba(0, 0, 0, 0.1); }
.sub-header-inner { max-width: 1200px; margin: 0 auto; display: flex; gap: 2rem; width: 100%; }
.sub-header-content { flex: 1; min-width: 100%; display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center; }
.sub-header-spacer { display: none; }
.date-titles .date-main-title { font-size: 1.5rem; margin: 0; color: white; letter-spacing: -0.025em; }
.date-titles .date-subtitle { margin: 0; color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; font-weight: 500; }
.date-carousel { display: flex; background: rgba(0, 0, 0, 0.15); border-radius: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0.25rem; margin-left: auto; }
.date-carousel-item { padding: 0.5rem 0.75rem; text-align: center; cursor: pointer; min-width: 65px; border-radius: 8px; transition: all 0.2s; color: rgba(255, 255, 255, 0.8); }
.date-carousel-item:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.date-carousel-item.active { background: white; color: var(--primary-color); box-shadow: var(--shadow-sm); }
.date-carousel-item .day-name { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.date-carousel-item .day-date { font-size: 0.95rem; font-weight: 500; }

.main-container { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; display: flex; flex-direction: column; gap: 2rem; }
.content-area { flex: 1; min-width: 0; }
.sidebar-right { width: 100%; order: -1; }

@media (min-width: 768px) {
    .main-container { flex-direction: row; }
    .sidebar-right { width: 300px; order: 0; flex-shrink: 0; }
    .sub-header-spacer { width: 300px; display: block; flex-shrink: 0; }
}

/* --- Zeiteintrag-Karten & Listen --- */
.time-entry-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; box-shadow: var(--shadow-sm); transition: all 0.2s ease; }
.time-entry-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: #cbd5e1; }
.entry-details { flex: 1; min-width: 0; }
.entry-details strong { display: block; font-size: 1.05rem; color: var(--text-color); margin-bottom: 0.25rem; }
.entry-details span { display: block; color: var(--text-light); font-size: 0.95rem; line-height: 1.4; }
.entry-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; flex-shrink: 0; }
.duration-badge { background: #f1f5f9; color: #334155; padding: 0.4rem 1rem; border-radius: 999px; font-weight: 600; font-size: 1rem; font-family: monospace; letter-spacing: 0.5px; border: 1px solid #e2e8f0; }
.icon-btn { background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b; cursor: pointer; font-size: 1rem; width: 2.25rem; height: 2.25rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; }
.icon-btn:hover { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.icon-btn[aria-label="Eintrag löschen"]:hover { background: var(--danger-color); border-color: var(--danger-color); }

/* --- Allgemeine Content-Karten --- */
.card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--border-radius); box-shadow: var(--shadow-sm); padding: 2rem; }

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.pulsing-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: var(--danger-color); animation: pulse-red 2s infinite; }

/* --- Mobile Optimierungen --- */
@media (max-width: 767px) {
    .time-entry-item { align-items: flex-start; flex-direction: column; }
    .entry-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; padding-top: 0.5rem; border-top: 1px solid var(--border-color); }

    /* NEU: Datums-Karussell Layout-Fix für Handys */
    .sub-header-content {
        flex-direction: column;
        align-items: stretch; /* Nimmt die volle Breite ein */
        gap: 1rem;
        padding-bottom: 0.5rem;
    }

    .date-titles {
        text-align: center; /* Titel auf dem Handy zentrieren */
    }

    .carousel-wrapper {
        margin-left: 0;
        width: 100%;
        justify-content: space-between; /* Pfeile links und rechts an den Rand drücken */
    }

    .date-carousel {
        flex: 1; /* Karussell nimmt den gesamten Platz zwischen den Pfeilen ein */
        margin: 0;
        min-width: 0; /* WICHTIG: Verhindert, dass das Karussell das Grid zerreißt */
    }
}

/* --- Globales X für Dropdowns --- */
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Platz für das X machen, damit der Text nicht darunter rutscht */
.select-wrapper select {
    width: 100%;
    padding-right: 2.5rem !important; 
}

.select-clear-btn {
    position: absolute;
    right: 30px; /* Position: Zwischen Text und dem Standard-Pfeil */
    cursor: pointer;
    background: #f1f5f9;
    color: #94a3b8;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    display: none; /* Standardmäßig ausgeblendet */
    transition: all 0.2s ease;
    z-index: 5;
}

.select-clear-btn:hover {
    background: #e2e8f0;
    color: #ef4444; /* Wird rot beim Hovern */
}





/* --- Custom Searchable Select Dropdowns --- */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.select-search-input {
    /* Platz für den X-Button rechts machen, damit der Text nicht darunter verschwindet */
    padding-right: 2.5rem !important; 
}

.select-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050; /* Hoch genug, damit es über anderen Elementen liegt */
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
    margin-top: 4px;
}

.select-dropdown-list.show {
    display: block;
}

.select-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    color: var(--text-color);
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f5f9;
}

.select-option:last-child {
    border-bottom: none;
}

.select-option:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

/* Spezielles Styling für den "+ Neu anlegen..." Button */
.select-option.option-new {
    font-weight: 600;
    color: var(--theme-secondary);
    background-color: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    /* Damit der "Neu"-Button beim Scrollen immer oben bleibt: */
    position: sticky; 
    top: 0;
}

.select-option.option-new:hover {
    background-color: #f1f5f9;
    color: var(--theme-secondary-hover);
}