:root {
    --primary-color: #13543E;
    --secondary-color: #AE9454;
    --background-color: #f5f6fa;
    --text-color: #042E1B;
    --border-color: #dcdde1;
    --header-bg: #042E1B;
    --header-text: #fff;
    --accent-color: #AE9454;
    --gray-light: #f5f6fa;
    --gray-dark: #2c3e50;
    --white: #fff;
    --black: #000;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--gray-light);
}

.site-header {
    margin: 0;
    padding: 0;
}

nav {
    background-color: var(--primary-color);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--header-text);
}

.navigation__trail {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.navigation__brand {
    color: var(--header-text);
    font-size: 1.125rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    user-select: none;
}

.navigation__user {
    position: relative;
    z-index: 1001;
}

.navigation__user-toggle {
    max-width: 14rem;
}

.navigation__user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

nav a {
    color: var(--header-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

nav a:hover {
    background-color: var(--secondary-color);
    color: var(--black);
}

main {
    padding: 2rem;
    flex: 1;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--white);
    color: var(--text-color);
}

/* Inline neben Buttons (Monatsnavigation etc.) — nicht auf 100% Breite ziehen */
.form-input--inline {
    width: auto;
    max-width: none;
    flex: 0 0 auto;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(19, 84, 62, 0.15);
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    color: var(--black);
}

.btn-danger {
    background-color: #e74c3c;
    color: var(--white);
}

.btn-danger:hover {
    background-color: #c0392b;
    color: var(--white);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.table th {
    background-color: var(--header-bg);
    color: var(--header-text);
}

/* Auftragsliste: feste Spaltenbreiten (kein Springen beim Filtern) + kompakte Zeilen */
.project-list .order-list-table {
    margin-top: 0.5rem;
    table-layout: fixed;
    width: 100%;
}

.project-list .order-list-table .col-nr { width: 5.5rem; }
.project-list .order-list-table .col-name { width: 18%; }
.project-list .order-list-table .col-desc { width: 18%; }
.project-list .order-list-table .col-status { width: 6.25rem; }
.project-list .order-list-table .col-hours { width: 5.5rem; }
.project-list .order-list-table .col-cost { width: 7rem; }
.project-list .order-list-table .col-status-since { width: 8.5rem; }
.project-list .order-list-table .col-elo { width: 10%; }
.project-list .order-list-table .col-actions { width: 9.25rem; }

.project-list .order-list-table th,
.project-list .order-list-table td {
    padding: 0.3rem 0.45rem;
    vertical-align: middle;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-list .table-filter-row th {
    background-color: #f3f4f6;
    color: var(--text-color);
    font-weight: normal;
    overflow: visible; /* Status-Dropdown darf herausragen */
}

.project-list .form-input--table-filter {
    width: 100%;
    min-width: 0;
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
    line-height: 1.2;
    height: 1.85rem;
    box-sizing: border-box;
}

.project-list .table-filter-row__desc {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.project-list .btn--compact {
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
    line-height: 1.2;
}

.project-list .order-row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    align-items: center;
}

.project-list .col-nowrap {
    white-space: nowrap;
}

.project-list .col-name,
.project-list .col-desc {
    white-space: nowrap;
}

.project-list .order-elo-links {
    font-size: 0.8rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-list .order-elo-links__line {
    display: inline;
}

.project-list .order-elo-links a {
    margin-right: 0.35rem;
    white-space: nowrap;
}

.project-list .col-actions {
    white-space: nowrap;
    overflow: visible;
}

.project-list .status-filter {
    position: relative;
    width: 100%;
}

.project-list .status-filter__controls {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.project-list .status-filter__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.8rem;
    line-height: 1.2;
    height: 1.85rem;
    max-width: 4.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-list .status-filter__caret {
    font-size: 0.65rem;
    opacity: 0.75;
}

.project-list .status-filter__clear {
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1.2;
    height: 1.85rem;
    min-width: 1.85rem;
}

.project-list .status-filter__menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 40;
    min-width: 11rem;
    max-height: 16rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    padding: 0.35rem 0;
}

.project-list .status-filter__option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.65rem;
    margin: 0;
    font-weight: normal;
    color: var(--text-color);
    cursor: pointer;
    white-space: nowrap;
}

.project-list .status-filter__option:hover {
    background: #f3f4f6;
}

.project-list .status-filter__empty {
    padding: 0.45rem 0.65rem;
    color: #666;
    font-size: 0.85rem;
}

/* Kompakte Zuweisungs-Tabellen (Mitarbeiter-Details) */
.table-compact {
    margin-top: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.table-compact th,
.table-compact td {
    padding: 0.28rem 0.45rem;
    vertical-align: middle;
}

.table-compact .btn-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px;
    min-height: 28px;
    font-size: 1rem !important;
    border-radius: 6px !important;
}

.table-compact .btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Schmale Spalte für 3–4 stellige Mitarbeiternummer */
.table .col-employee-number {
    width: 4em;
    min-width: 3.5em;
}

.error-message {
    color: #e74c3c;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    background-color: #fde8e8;
}

.success-message {
    color: var(--primary-color);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background-color: #e8f8e8;
}

.summary-stats {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.summary-header {
    margin-bottom: 1.5rem;
}

.summary-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 4px;
}

.stat-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.project-breakdown {
    margin-top: 2rem;
    width: 100%;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.summary-table th {
    background-color: var(--gray-light);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--secondary-color);
}

.summary-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.summary-table td:last-child {
    color: var(--secondary-color);
    font-weight: 500;
}

.summary-table tr:last-child td {
    border-bottom: none;
}

.summary-table tr:hover td {
    background-color: var(--gray-light);
}

.filter-back-bar {
    margin: 1rem 0;
    padding: 0.5rem;
    background-color: #e8f0fe;
    border-radius: 6px;
}

.filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filters select,
.filters input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

/* Datumsbereich und Export-Button (von/bis nebeneinander, Export darunter) */
.filters-date-export {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    flex-shrink: 0;
}

.filters-date-range {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.filters-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.filters-date-label {
    font-size: 0.75rem;
    color: var(--text-muted, #666);
    white-space: nowrap;
}

.filters-date-export input[type="date"] {
    width: 130px;
    min-width: 110px;
    padding: 0.25rem 0.4rem;
    font-size: 0.9rem;
}

.filters-date-export .btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.filters-date-export select#csv-encoding,
.filters-date-export select.form-input {
    height: 1.5rem;
    min-height: 1.5rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table td.numeric, .table th.numeric {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.navigation ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.navigation li {
    margin: 0;
    padding: 0;
}

/* Kompaktere und schmalere Vorgangstabelle */
.process-table th,
.process-table td {
    padding: 0.25rem 0.5rem;
    line-height: 1.2;
}

.process-table th:nth-child(1),
.process-table td:nth-child(1) {
    width: 60px;
    min-width: 50px;
    max-width: 80px;
}

.process-table th:nth-child(4),
.process-table td:nth-child(4) {
    width: 90px;
    min-width: 70px;
    max-width: 110px;
    text-align: center;
}

.process-table input,
.process-table select {
    min-width: 40px;
    max-width: 140px;
    font-size: 0.95rem;
    padding: 0.2rem 0.4rem;
}

/* Projektaufschlüsselung Styles */
.breakdown-header {
    margin-bottom: 1.5rem;
}

/* Aufklappbare Zeilen */
.breakdown-expandable {
    cursor: pointer;
    transition: background-color 0.15s;
}
.breakdown-expandable:hover {
    background-color: var(--gray-light) !important;
}
.breakdown-clickable {
    cursor: pointer;
}
.breakdown-clickable:hover {
    background-color: #e8f0fe !important;
}
.expand-icon {
    display: inline-block;
    width: 1.2em;
    margin-right: 0.4rem;
    font-size: 0.75em;
    color: var(--primary-color);
}
.breakdown-detail-row td {
    background-color: #f9f9f9 !important;
}
.breakdown-indent {
    padding-left: 2.5rem !important;
}
.breakdown-subheader {
    font-weight: 600;
    background-color: #f0f0f0 !important;
    font-size: 0.9em;
}
.breakdown-subheader td {
    padding-top: 0.75rem !important;
    padding-bottom: 0.25rem !important;
}
.breakdown-pie-cell {
    padding: 1rem !important;
    vertical-align: top !important;
}
.breakdown-pie-cell .pie-chart-wrapper {
    margin: 0 auto;
    min-width: 480px; /* Diagramm 200px + Abstand + Legende mit 5 Spalten */
}

/* Zwei-Spalten-Layout: Vorgänge links, Mitarbeiter rechts */
.breakdown-detail-cell {
    padding: 1rem !important;
    vertical-align: top !important;
    width: 100%;
}
.breakdown-two-columns {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    width: 100%;
}
.breakdown-three-columns {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    width: 100%;
    flex-wrap: wrap;
}
.breakdown-vorgange-column {
    flex: 1;
    min-width: 280px;
}
.breakdown-mitarbeiter-column {
    flex: 1;
    min-width: 280px;
}
.breakdown-abteilungen-column {
    flex: 1;
    min-width: 280px;
}
.breakdown-column-header {
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 0.5rem;
}
.breakdown-inner-table {
    width: 100%;
    border-collapse: collapse;
}
.breakdown-inner-table th,
.breakdown-inner-table td {
    padding: 0.25rem 0.5rem;
    border: none;
    font-size: 0.9em;
    text-align: left;
}
.breakdown-inner-table th:nth-child(2),
.breakdown-inner-table th:nth-child(3),
.breakdown-inner-table th:nth-child(4),
.breakdown-inner-table td:nth-child(2),
.breakdown-inner-table td:nth-child(3),
.breakdown-inner-table td:nth-child(4) {
    text-align: right;
}
.breakdown-inner-table .breakdown-detail-row td:first-child {
    padding-left: 0.5rem;
}
.breakdown-mitarbeiter-col {
    min-width: 200px;
}
.breakdown-threshold-cell {
    padding: 0.5rem 0.75rem !important;
    vertical-align: middle !important;
}
.threshold-inline {
    margin: 0;
    padding: 0.5rem 0.75rem;
    max-width: 400px;
}
.threshold-inline .threshold-label {
    margin-bottom: 0.25rem;
}

/* Kuchendiagramm (innerhalb Projekt-Aufschlüsselung) */
.pie-chart-container {
    flex-shrink: 0;
}
.pie-chart-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}
.pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    flex-shrink: 0;
    display: block;
}
.pie-chart path {
    cursor: pointer;
}
.pie-chart-empty {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-light);
    border-radius: 50%;
    color: #888;
}
/* Legende: Spalten nur so schmal wie Platz für Label + Tage/%; kein Überlauf in Nachbarspalten */
.pie-legend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
    grid-auto-flow: row;
    gap: 0.4rem 1.25rem;
    font-size: 0.85rem;
    flex: 1 1 12.5rem;
    min-width: 12.5rem;
    align-content: start;
}
.breakdown-pie-cell .pie-legend {
    min-width: 12.5rem;
}
.pie-legend-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    align-items: baseline;
    column-gap: 0.4rem;
    min-width: 0;
    line-height: 1.35;
}
.pie-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: center;
}
.pie-legend-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.pie-legend-pct {
    font-weight: 600;
    color: var(--secondary-color);
    white-space: nowrap;
}

/* Abteilungen: Tabelle + Kuchendiagramm rechts daneben, volle Spaltenbreite */
.breakdown-dept-table-chart {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    width: 100%;
}
.breakdown-dept-table {
    flex: 1 1 auto;
    min-width: 0;
}
.breakdown-dept-pie {
    flex-shrink: 0;
}
.breakdown-dept-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 0.5rem;
    vertical-align: middle;
}
.pie-chart-only {
    display: flex;
    align-items: center;
}

.threshold-control {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: var(--gray-light);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 400px;
}

.threshold-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-color);
}

.threshold-value {
    font-weight: 600;
    color: var(--secondary-color);
    padding: 0.25rem 0.5rem;
    min-width: 60px;
    text-align: center;
}

.slider-container {
    position: relative;
    padding: 0.25rem 0;
}

.threshold-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--secondary-color);
    outline: none;
    margin: 0.5rem 0;
}

.threshold-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--header-bg);
    cursor: pointer;
    transition: background 0.15s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.threshold-slider::-webkit-slider-thumb:hover {
    background: var(--primary-color);
}

.threshold-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--header-bg);
    cursor: pointer;
    transition: background 0.15s ease-in-out;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.threshold-slider::-moz-range-thumb:hover {
    background: var(--primary-color);
}

.slider-labels {
    display: none;
}

.monthly-calendar {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.calendar-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.calendar-controls h2 {
    margin: 0 1rem;
}

.employee-selector {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.employee-selector select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--white);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.2s;
}

.employee-selector select:hover {
    border-color: var(--primary-color);
}

.employee-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(19, 84, 62, 0.1);
}

.calendar-header h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5rem;
}

.calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.weekday {
    display: none;
}

.calendar-day {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.1rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--white);
    transition: background-color 0.2s;
    font-size: 0.85rem;
    min-height: 1.7rem;
}

.calendar-day.empty {
    display: none;
}

.calendar-day.weekend {
    background-color: var(--gray-light);
}

.calendar-day.has-hours {
    border-left: 4px solid var(--primary-color);
}

.calendar-day.has-absence {
    border-right: 4px solid #e74c3c;
}

.calendar-day.has-hours.has-absence {
    border-left: 4px solid var(--primary-color);
    border-right: 4px solid #e74c3c;
}

.day-info {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.day-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.day-number, .weekday-label {
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 400;
    font-family: inherit;
    opacity: 0.7;
}

.weekday-label {
    font-size: 0.85rem;
    color: #3a4a3a;
    font-weight: 400;
    font-family: inherit;
    opacity: 0.7;
    font-weight: 400;
    font-family: inherit;
}

.weekday-label.sunday {
    color: #c0392b;
    font-weight: 600;
    opacity: 1;
}

.day-number.sunday {
    color: #c0392b;
    font-weight: 600;
}

.hours {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
    min-width: 3.2rem;
    text-align: right;
}

.calendar-day:hover {
    background-color: var(--gray-light);
    cursor: pointer;
}

.monthly-overview-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.employee-selector {
    width: 260px;
    min-width: 180px;
    max-width: 320px;
    margin: 0;
}

/* Abwesenheits-spezifische Styles */
.absence-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

.absence-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.absence-badge.paid {
    background-color: #e8f5e8;
    color: #2e7d2e;
    border: 1px solid #a8d8a8;
}

.absence-badge.unpaid {
    background-color: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5b2b2;
}

/* Prüfansicht: Code laut Lohngruppe nicht an Abrechnung */
.absence-badge.excluded {
    background-color: #e8e8e8;
    color: #666666;
    border: 1px solid #c8c8c8;
    opacity: 0.85;
}

/* Stunden-Badge: gleiche Größe/Rahmen wie Code-Badges (K, GZ, etc.) */
.hours-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 600;
    background-color: #e8f5e8;
    color: #2e7d2e;
    border: 1px solid #a8d8a8;
    display: inline-block;
}

/* Gebucht: Abwesenheit ohne Ersatzzeit – roter Kasten in Gebucht-Spalte, nicht in Summen */
.hours-badge-no-ersatzzeit {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 600;
    background-color: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5b2b2;
    display: inline-block;
}

/* Auffüllung aus ÜZ-Bank (Monats-Deckel) */
.monthly-cap-fill-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-weight: 600;
    font-size: 0.7rem;
    line-height: 1.2;
    background-color: #e8f0ec;
    color: #13543E;
    border: 1px solid #a8c4b4;
}

/* Abwesenheit an Nicht-Arbeitstag (Work-Week-Soll 0) */
.absence-non-workday-warn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.2rem;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    background-color: #fef3e6;
    color: #E67E22;
    border: 1px solid #f0c49a;
}

/* Bezahlte Stunden bei Urlaub/Krank/Sozialtag (ohne manuellen Eintrag) */
.eintrag-paid-hours {
    background-color: #e8f5e8;
    color: #2e7d2e;
    border: 1px solid #a8d8a8;
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
}

/* OT1000 not imported: override border style and add transparency + arrow */
/* These rules must come AFTER .paid and .unpaid to override them */
.absence-badge.paid.ot1000-not-imported {
    border: 1px dashed #a8d8a8 !important;
    background-color: #e8f5e8 !important;
    color: #2e7d2e !important;
    opacity: 0.7 !important;
    position: relative !important;
}

.absence-badge.unpaid.ot1000-not-imported {
    border: 1px dashed #f5b2b2 !important;
    background-color: #fde8e8 !important;
    color: #c0392b !important;
    opacity: 0.7 !important;
    position: relative !important;
}

.absence-badge.paid.ot1000-not-imported::after,
.absence-badge.unpaid.ot1000-not-imported::after {
    content: "↗" !important;
    position: absolute !important;
    top: -3px !important;
    right: -3px !important;
    font-size: 0.65em !important;
    line-height: 1 !important;
    font-weight: bold !important;
    z-index: 10 !important;
    background-color: white !important;
    border-radius: 50% !important;
    width: 12px !important;
    height: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 2px rgba(0,0,0,0.2) !important;
}

.absence-badge.ot1000-imported {
    background-color: #e8f5e8;
    color: #2e7d2e;
    border: 1px solid #a8d8a8;
}

.absence-hours {
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.8;
}

.absence-legend {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.absence-legend h4 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 1rem;
}

.legend-grid {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0.2rem;
}

.legend-badge {
    box-sizing: border-box;
    flex: 0 0 2.75rem;
    width: 2.75rem;
    min-width: 2.75rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.15rem;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.legend-badge.paid {
    background-color: #e8f5e8;
    color: #2e7d2e;
    border: 1px solid #a8d8a8;
}

.legend-badge.unpaid {
    background-color: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5b2b2;
}

.legend-text {
    font-size: 0.8rem;
    color: var(--text-color);
}

/* Separate Abwesenheitskalender-Styles */
.absence-calendar {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.absence-calendar .calendar-grid {
    display: block;
}

.absence-calendar .weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.absence-calendar .weekday {
    display: block;
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    background-color: var(--header-bg);
    color: var(--header-text);
    border-radius: 4px;
}

.absence-calendar .weekday.saturday {
    background-color: var(--gray-light);
    color: var(--text-color);
}

.absence-calendar .weekday.sunday {
    background-color: var(--gray-light);
    color: #c0392b;
}

.absence-calendar .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.absence-calendar .calendar-day {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--white);
}

.absence-calendar .calendar-day.other-month {
    opacity: 0.3;
}

.absence-calendar .calendar-day.weekend {
    background-color: var(--gray-light);
}

.absence-calendar .day-number {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

@media (max-width: 900px) {
    .monthly-overview-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    .employee-selector {
        width: 100%;
        max-width: 100%;
    }
    
    .absence-calendar .calendar-days {
        grid-template-columns: repeat(7, 1fr);
    }
}

/* Navigation Dropdown Styles */
.navigation .dropdown {
    position: relative;
    display: inline-block;
}

.navigation .dropdown.dropdown-open {
    z-index: 1001;
}

.dropdown-toggle {
    background: none;
    border: none;
    color: var(--header-text);
    text-decoration: none;
    padding: 0 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-toggle:hover {
    background-color: var(--secondary-color);
    color: var(--black);
}

.dropdown-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.dropdown-arrow.open {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
}

.dropdown-menu li {
    margin: 0;
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-menu a:hover {
    background-color: var(--gray-light);
}

.dropdown-menu--end {
    left: auto;
    right: 0;
}

.dropdown-menu__action {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-menu__action:hover {
    background-color: var(--gray-light);
}

/* Admin Panel Styles */
.admin-panel {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.admin-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.admin-header h1 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background-color: var(--gray-light);
}

.nav-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.admin-content {
    padding: 1.5rem;
}

.admin-overview h2 {
    margin-top: 0;
    color: var(--text-color);
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.overview-card {
    background-color: var(--gray-light);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.overview-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.overview-card p {
    margin: 0;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Modal Dialog Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    z-index: 10000;
    position: relative;
    padding: 1.5rem;
}

.modal h3 {
    margin: 0;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .admin-nav {
        flex-direction: column;
    }
    
    .overview-cards {
        grid-template-columns: 1fr;
    }
    
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background-color: var(--gray-light);
        margin-top: 0.5rem;
    }
    
    .modal {
        width: 95% !important;
        max-width: 95% !important;
        padding: 1rem;
    }
}

/* Context Menu Styles */
.context-menu {
    font-family: inherit;
}

.context-menu .menu-item-primary {
    transition: all 0.2s ease;
}

.context-menu .menu-item-primary:hover {
    background: #13543E !important;
    color: white !important;
}

.context-menu .menu-item-secondary {
    transition: all 0.2s ease;
}

.context-menu .menu-item-secondary:hover {
    background: #f8f9fa !important;
}

.context-menu .menu-item-danger {
    transition: all 0.2s ease;
}

.context-menu .menu-item-danger:hover {
    background: #E74C3C !important;
    color: white !important;
}

/* Stundenzettel-Scan-Import Review: PDF + Tabelle nebeneinander */
.timesheet-scan-review-grid {
    display: grid;
    grid-template-columns: minmax(280px, 38%) 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-top: 0.5rem;
}

@media (max-width: 960px) {
    .timesheet-scan-review-grid {
        grid-template-columns: 1fr;
    }
}

.timesheet-scan-review-pdf-col {
    position: sticky;
    top: 0.5rem;
}

.timesheet-scan-iframe-wrap {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: var(--white);
}

.timesheet-scan-iframe {
    display: block;
    width: 100%;
    height: min(52vh, 640px);
    border: none;
}

.timesheet-scan-table-scroll {
    overflow-x: auto;
    max-width: 100%;
}
/* ── Admin page layout patterns ─────────────────────────────── */

.admin-page {
    max-width: 1200px;
}

.admin-page__header {
    margin-bottom: 1.25rem;
}

.admin-page__header h2 {
    margin: 0 0 0.35rem 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.admin-page__lede {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.45;
    max-width: 40rem;
}

.panel {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.15rem;
}

.panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.panel__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
}

.panel__meta {
    margin: 0;
    color: #666;
    font-size: 0.85rem;
}

.panel--muted {
    background: #f8f9fa;
    border-color: #e8e8e8;
}

.master-detail {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 800px) {
    .master-detail {
        grid-template-columns: 1fr;
    }
}

.master-detail__master,
.master-detail__detail {
    min-width: 0;
}

.selectable-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--white);
}

.selectable-list__item {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    transition: background-color 0.15s;
}

.selectable-list__item:last-child {
    border-bottom: none;
}

.selectable-list__item:hover {
    background: #f5f6fa;
}

.selectable-list__item.is-selected {
    background: #e8f0ec;
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.selectable-list__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.9rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.selectable-list__main:hover,
.selectable-list__main:focus-visible {
    outline: none;
}

.selectable-list__name {
    font-weight: 600;
    color: var(--text-color);
}

.selectable-list__meta {
    font-size: 0.85rem;
    color: #666;
}

.selectable-list__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    color: var(--primary-color);
    transition: background-color 0.15s;
    flex-shrink: 0;
    box-sizing: border-box;
    vertical-align: middle;
}

.btn-icon:hover {
    background: #e8f0ec;
}

.btn-icon:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-icon__glyph {
    color: white;
    font-size: 1rem;
    line-height: 1;
}

.btn-icon--danger {
    color: #E74C3C;
    background: #E74C3C;
}

.btn-icon--danger:hover {
    background: #c0392b;
}

.btn-icon--danger svg {
    stroke: white;
}

.btn-icon--edit {
    background: #13543E;
    color: #fff;
}

.btn-icon--edit:hover {
    background: #042E1B;
}

.btn-icon--edit svg {
    stroke: white;
}

.btn-icon--save {
    background: #13543E;
    color: #fff;
}

.btn-icon--save:hover {
    background: #042E1B;
}

.icon-btn-group {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    padding: 2.5rem 1.5rem;
    min-height: 16rem;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: #fafafa;
}

.empty-state__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.empty-state__text {
    margin: 0;
    max-width: 22rem;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.45;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}

.inline-form .form-group {
    margin: 0;
    flex: 1 1 8rem;
    min-width: 0;
}

.inline-form .form-group label,
.inline-form .form-label,
.stack-sm > .form-group > .form-label,
.stack-md > .form-group > .form-label,
.panel .form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.25rem;
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stack-md {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.schema-create {
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

/* Admin-Detail-Tabellen (Feiertage, Spesen, …) — NICHT für Monatsübersicht/calendar_grid */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    table-layout: auto;
}

.admin-table th,
.admin-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-table tbody tr:hover {
    background: #f5f6fa;
}

.admin-table .col-date {
    width: 7.5rem;
    white-space: nowrap;
}

.admin-table .col-fraction {
    width: 4.5rem;
    white-space: nowrap;
}

.admin-table .col-name {
    width: auto;
}

.admin-table .col-actions {
    width: 1%;
    white-space: nowrap;
    padding-right: 0.5rem;
}

/* —— Selbstbuchung (Zeit) —— */
.me-booking {
    max-width: 40rem;
    margin: 0 auto;
    padding: 1rem 1rem 3rem;
}

.me-booking__meta,
.me-booking__locked,
.me-muted {
    color: var(--baessler-text-muted, #666);
    font-size: 0.95rem;
}

.me-booking__locked {
    color: var(--baessler-error, #B42318);
    font-weight: 600;
}

.me-day-list__main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.me-day-list__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: #555;
}

.me-chip {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.me-chip--missing { background: #E74C3C; }
.me-chip--deviation { background: #E67E22; }
.me-chip--today { background: #13543E; }
.me-chip--pending { background: #AE9454; }
.me-chip--ok { background: #666; }
.me-chip--locked { background: #999; }

.me-interval-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.me-interval {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-color, #e6e6e6);
    align-items: baseline;
}

.me-interval__hours {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--baessler-text, #333);
}

.me-interval--break {
    opacity: 0.75;
    font-style: italic;
}

.me-interval--break .me-interval__hours {
    font-weight: 400;
}

.me-sum-rows {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color, #e6e6e6);
}

.me-sum-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.25rem 0;
    font-weight: 600;
}

.me-sum-row__value {
    font-variant-numeric: tabular-nums;
}

.me-sum-row--warn {
    color: var(--baessler-error, #B42318);
}

.error-message { color: #E74C3C; }
.success-message { color: #13543E; }
